princepawn has asked for the wisdom of the Perl Monks concerning the following question:
why you ask? just look at this. I would rather not maintain this regex:my $retval = eval $source; warn $retval->package; # prints package of evaluated # source
my $code = join( '', <$fh> ); close( $fh ); eval $code; if ( $@ ) { $r->log_error( $@ ); return SERVER_ERROR; } my $package = ($code =~ /^\s*package\s+([\w:]+);/m)[0];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting the package of evaluated source code:
by maverick (Curate) on Aug 26, 2001 at 22:01 UTC | |
|
Re (tilly) 1: Getting the package of evaluated source code:
by tilly (Archbishop) on Aug 27, 2001 at 08:17 UTC |