Ovid += infinity :D))

I've been chasing my tail over something extremely similar myself of late - to the point of drafting a SoPW node. Ovid has, unknown to him 'til now, saved me the trouble of the posting and provided the clarity/insight I was seeking...

My algorithm did the simplest test (eval { require ...}) first, going on to test for a local file scoped package after that - so a non-existent package always exists if a test is made for the existence of the stash.

It never even occurred to me that, as Ovid points out, the require causes vivification of a stash for the package - whether or not it exists ... doh !!!

Many thanx again Ovid.

.oO(Wonder whether my sig should be changed to read: "A user level that overstates my experience by an order of magnitude" ?)

Update:

Nearly, but not quite - some more extensive testing (appears to) show that a stash is always created - but would appear to be empty i.e. no keys, if the package is non-existent. So whereas require creates the stash and (sometimes) partially populates it, the test for the stash also appears to create a stash - but seemingly always empty ... or more accurately, an existent package always has the standard packages & classes as its keys.

Any road up, it's close enough for jazz at this joint :D))

A user level that continues to overstate my experience :-))

In reply to Re: How Can I Know If a Package is "Real"? by Bloodnok
in thread How Can I Know If a Package is "Real"? by Ovid

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.