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?
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.
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 Durf; print(ALPHA); package Durf; use constants ALPHA => 1; 1;
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.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.