in reply to constant and eval (are they enemies?)
eval returns whatever the block of code returns. A block of code returns the return value of the last evaluated statement. use is a compile-time keyword, and at runtime, nothing happens in your evaled code, so it returns undef. Undef is false, so $@ is warned. But because nothing went wrong, $@ is empty, and warn warns "something's wrong".
Fix it like this:
eval "..."; warn $@ if $@;
Or like this (make it return true):
The first solution is better, imho.eval "...; 1;" or warn $@;
- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.
|
---|
In Section
Seekers of Perl Wisdom