in reply to runtime eval() and constants
I kinda expected it to complain about a bareword,You didn't even give perl a -w option, so it's no wonder you don't get warnings. However, be glad Perl won't warn about barewords when the bareword looks like a package name, or otherwise you'd get lots of warnings when constructing objects or calling class methods.
go resolve the bareword as a constant,Note that if you require a module, it won't get executed until run time, so constants won't be made or exported until run time. Hence, if you do:
perl will compile DBI::SQL_VARCHAR as being a string before DBI.pm is executed (which will export the DBI::SQL_VARCHAR "constant".eval "require DBI; DBI::SQL_VARCHAR";
Note that this isn't anything special about "eval". It just has to do with the order in which things are compiled/run.
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: runtime eval() and constants
by dpmott (Scribe) on Dec 08, 2003 at 18:31 UTC |