our @GLOBAL_SYMBOLS; # these are not package constants, but Perl artif +acts BEGIN { @GLOBAL_SYMBOLS = qw(BEGIN EXPORT); }
sub is_constant { my $k = shift; return $k =~ /^[A-Z]+$/ && !grep { $_ eq $k } @GLOBAL_SYMBOLS }
Bah, use a hash, Luke! Use a hash!
our %GLOBAL_SYMBOL; # these are not package constants, but Perl artifa +cts BEGIN { %GLOBAL_SYMBOL = map { $_ => 1 } qw(BEGIN EXPORT ISA EXPORT_OK GLO +BAL_SYMBOL); }
sub is_constant { my $k = shift; return $k =~ /^[A-Z_0-9]+$/ && !$GLOBAL_SYMBOL{$k}; }

BTW did you forget to exclude @GLOBAL_SYMBOLS, by any chance? And, why not use a lexical for it?

BTW I think this functionality is generally interesting enough to deserve its own module on CPAN. Let's call it ExportAll, or something else like that. And, as the helper subs would reside in that module, they wouldn't be exported themselves.

Update: Oh no, I see you only support only upper case letters only names (which would exclude @GLOBAL_SYMBOLS). Which seems too restrictive to my taste.


In reply to Re^2: sharing symbols by bart
in thread sharing symbols by mungohill

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.