[Catalyst] Catalyst::component()

Wade.Stuart at fallon.com Wade.Stuart at fallon.com
Tue Oct 4 17:08:32 CEST 2005

To clarify what I mean about $c->comp...

sub component {
    my $c = shift;

    if (@_) {

        my $name = shift;

        if ( my $component = $c->components->{$name} ) {
            return $component;

        else {
            for my $component ( keys %{ $c->components } ) {
                return $c->components->{$component} if $component =~

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

Is the current code,  If I send a string that you think should match
exactly but does not,  I get back a what appears to be random component
that hits the regex in some cases.  In my mind,it should work such that if
I send a string to it, and have no exact matches -- send back a fail.  If I
want a regex match I should be able to explicitly send the regex and get a
regex match or fail.  The bottom (fall through) case is still acceptable in
my mind -- no @_ = default of list all components.

Does this make sense to anyone else?

More information about the Catalyst mailing list