Greetings and a HNY for 2014 to all you fellow monasterians ,

I have a module that should be capable of auto-exporting, via the import() sub, an initialized variable, $VAR, via a typeglob i.e. not via Exporter, into the useing packages namespace. At its simplest (I'm afraid that I'm not at liberty to divulge the exact details), my module code is along the lines of ...

use warnings; use strict; package Package; my $Val; sub import { Val = qw/some_val/; my $caller = caller; no strict qw/refs/; *{"$caller\::VAR"} = *Val; } 1;
The variable is, indeed, set i.e. I see "Some_val" c/w "Something's wrong", if the declaration is made thus...
use Package; our $VAR; warn $VAR;
My question now is, what have I overlooked such that cases where the variable declaration is made in a list work e.g. neither of the following 2 cases work...
use Package; our ($VERSION, $VAR); warn $VAR;
or
use package; our ($VAR, $VERSION); warn $VAR;
In both of the above cases, I see the "Something's wrong" warning.

Any thoughts/insights etc. gratefully received

TIA ,

Further update:

Code will never run without relaxing <C>strict refs<C/> ... doh!!

Update:

Add clarification thanx to choroba who was good enough to point out the lack of clarity in the OP.

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

In reply to glob'ing and variable setting by Bloodnok

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.