The warnings are just pointing you at a potential problem. It's only seeing those variables used in your script once, which generally means you're setting them and not using them, or using them without setting them, that sort of thing.

If you know what you're doing, and setting them once and using them via a script that you're requireing, then this warning is spurious and you need a way to quell the warning. The easiest way is just to mention it a second time, in a no-op fashion:

$used_once = "some value"; $used_once; # void context, does nothing
Arguably changing your required code into a proper module would force you into a syntax that's more compatible with this warning, but the workaround above should help you for now. A possible syntax I wouldn't be surprised coming out of this:
use EmeraldWarp::DBI; # instead of requiring it our $database = "whatever"; ... # the actual "work" is placed in a 'new' subroutine # instead of being executed as part of the loading of # the module my $dbh = new EmeraldWarp::DBI($database); # or just "whatever" and o +mit $database entirely ...

In reply to Re: Good programming practice by Fastolfe
in thread Good programming practice by Purdy

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.