Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

cleverett's scratchpad

by cleverett (Friar)
on Mar 08, 2010 at 20:41 UTC ( [id://827429]=scratchpad: print w/replies, xml ) Need Help??

sub produce { my ( $pkg, @args ) = @_; my %args = %{ {@args} }; my $type = delete $args{type} || q{}; my %attr = %{ delete $args{attrs} || {} }; my ( $item_module, $item_class ) = $pkg->find_product( $type, %att +r ); if ( !exists $already_required{$item_class} ) { ## compile inside eval, so we get a real error message at leas +t once local $EVAL_ERROR = q{}; my $is_compiled = eval { require $item_module; return 1; }; if ( !$is_compiled ) { $EVAL_ERROR ||= 'Unknown error'; confess "$item_module didn't compile: $EVAL_ERROR"; } # track already compiled classes my @parents; { no strict 'vars'; *parents = *{"$item_class\::ISA"}{ARRAY}; } foreach my $p (@parents) { next if ! $p =~ m/^TDP::/; $already_required{$p} = ++$counter } $already_required{$item_class} = ++$counter; } return $item_class->new(%args); }
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-25 16:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found