Fellow monks, I come to you with a multitude of problems, all slightly related to one another, seeking the preservation of my sanity...
1) Are there any caveats about an eval use that I should be aware about? Specifically, why does the following snippet not work as expected?2) How can I use a local package to demonstrate a throwaway? I tried something similar to this, but Perl complained about not being able to find the package in @INC.use warnings; eval "use Data::Dumper;"; print Dumper "asdf"; Name "main::Dumper" used only once: possible typo at - line 3. print() on unopened filehandle Dumper at - line 3.
3) I'm trying to dynamically load a package dependant on @ARGV (hence the attempt at eval). And the package to be included defines constants, but does not export them. Should I be able to access these constants by referring to them with their full package names? If I do not use any eval trickery and type out Package::Name::CONSTANT, it works as expected. But if I try saying eval("use $argv;"); it does not yield any compilation errors, but Package::Name::CONSTANT throws any error like a bareword.use Durf; print(ALPHA); package Durf; use constants ALPHA => 1; 1;
All of the above are stumping my peers, and any light you could shed on the situation would be much appreciated.
Cheers.In reply to eval use, local packages, and use constants by deep submerge
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |