Changeset 10620 for lang/perl/Nanto

Show
Ignore:
Timestamp:
04/28/08 08:57:20 (7 years ago)
Author:
tokuhirom
Message:

Nanto::Factory::* があればそれでいいんだ

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Nanto/trunk/lib/Nanto/Role/Context.pm

    r10611 r10620  
    4747sub factory { 
    4848    my ($self, $module) = @_; 
    49     my $factory = join('::', $self->base_name, 'Factory', $module); 
    50     $factory->use or die $@; 
     49 
     50    my $factory; 
     51    for my $base ($self->base_name, 'Nanto') { 
     52        $factory = join('::', $base, 'Factory', $module); 
     53        if ($factory->use) { 
     54            last; # ok. 
     55        } 
     56    } 
     57    if ($@) { 
     58        die "Cannot load: $module, $@"; 
     59    } 
    5160 
    5261    croak "$factory does not Nanto::Role::Factory" unless $factory->does('Nanto::Role::Factory');