[Catalyst] Catalyst::component()

Bernhard Graf catalyst at augensalat.de
Wed Oct 5 00:10:56 CEST 2005


On Tuesday 04 October 2005 23:54, Bernhard Graf wrote:

#-)

# simplified
sub component_refactored {
    my $c = shift;

    return sort keys %{ $c->components } unless @_;

    my $name = shift;

    return $c->components->{$name}
	unless ref($name) eq 'Regexp';

    for my $component ( keys %{ $c->components } ) {
        return $c->components->{$component}
	    if $component =~ /$name/;
    }
    return;
}
-- 
Bernhard Graf



More information about the Catalyst mailing list