Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

cleverett's scratchpad

by cleverett (Friar)
on Mar 08, 2010 at 20:41 UTC ( #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
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2015-07-06 09:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (71 votes), past polls