Progress ....

Yes, I agree that 'Dead or Alive' is too simplistic (except to the extent for example that once the testme.pl file exits and its namespace is taken down all possibilities of persistence finally disappear, but not so other sub-files that may be brought into the app as 'helpers').

My original misreading of the very doc you quote "Unlike local variables in C or C++, Perl's lexical variables ..." contributed to my confusion where it goes on to say "... If declared at the outermost scope (the file scope), then lexicals work somewhat like C's file statics. They are available to all functions in that same file declared below them, but are inaccessible from outside that file...", which I can now de-confuse for myself by adding '..inaccessible from outside.. EXCEPT IF REFERRED TO BY AN EXPORTED SUB!'

So my explanation to myself now goes along the lines: "by referring to its own file-scoped lexicals, a module's exported subs become agents to the persisting state of those lexicals, available to any importer of those subs". Would you agree?

"...(or in your case use Importer 'DataBank';, which as I understand it is equivalent)"... Yes, it just pre-empts Exporter's (again confusing) need to otherwise firstly establish an Import function for the caller, some of that oblique wizardry we referred to earlier, (and cannot really do without as you rightly say, but better kept 'under the hood' as much as possible perhaps?).

Thanks again.


In reply to Re^4: modular file scoping by Pstack
in thread modular file scoping by Pstack

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.