Hello,

I have a piece of code calls a function in a module A. That function calls a function in module B along with using one of the global variables in module B as an argument to that function.

package Foo::A; use 5.008; use strict; use warnings; require Exporter; #use AutoLoader qw(AUTOLOAD); use Carp; use Foo::B ':all'; our @ISA = qw(Exporter); @EXPORT or @EXPORT_OK our %EXPORT_TAGS = ( 'all' => [ qw( aMethod ... ) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw(); our $VERSION = '1.00'; ... sub aMethod { bMethod("$OURVAR test data"); } ... 1; __END__ ############################################3 package Foo:B; use 5.008; use strict; use warnings; require Exporter; #use AutoLoader qw(AUTOLOAD); our @ISA = qw(Exporter); our %EXPORT_TAGS = ( 'all' => [ qw( bMethod $OURVAR ) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw(); our $VERSION = '1.00'; # something like this sub bMethod { my $foo = shift; print "$foo\n"; } ... 1; __END__
The error is as follows:

Use of uninitialized value in concatenation (.) or string at C:/Perl/site/lib/Foo/B.pm line 141.

The error refers to the $OURVAR which is exported by the "B" module along with the bMethod().

Why am I getting this error? How do I fix it?

Thank you :)

-P0w3rK!d


In reply to Use of uninitialized value in concatenation (.) or string by P0w3rK!d

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.