[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

RE: [FWP] Parsing (simple)





> > $snippet = "...";  # long, hairy code here.
> > eval "package code; $^W=0; $snippet";
> > @variables = keys %code::;
>
> How about this?
>
>     local $SIG{__WARN__} =
>         sub {
>             push @variables,
>                 $_[0] =~ /Global symbol "([^"]+)" requires/g;
>         };
>     eval "use strict; $snippet";
>

Nice, certainly more fun than mine, but *perhaps* not portable. What happens
if your perl gets built with alternative language error messages?

----
Behind every successful programmer, there is a person with a wooden mallet,
hitting him in the head to let him know when the program is finished.
___________
Jeff Boes  <><  jboes@qtm.net
Mur Consulting  http://murconsulting.hypermart.net/


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe