Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^7: Global variables in Perl

by ikegami (Pope)
on Jun 04, 2010 at 21:51 UTC ( #843218=note: print w/replies, xml ) Need Help??


in reply to Re^6: Global variables in Perl
in thread Global variables in Perl

You're missing package SS::ExportScalar;, so the script never imports DEBUG, so DEBUG is not declared in the script, so it's a bareword, so strict throws an exception.

Replies are listed 'Best First'.
Re^8: Global variables in Perl
by taioba (Acolyte) on Jun 04, 2010 at 22:08 UTC

    Sorry, must have got garbled in the transfer to the website. See the whole thing below. Note that if this was the case, the script would not have run the second time after changing strict and execution would be aborted at compilation because Perl wouldn't find ExportScalar.

    type ExportScalar.pm package ExportScalar; use strict; use warnings; use Exporter; our @ISA = qw( Exporter ); our @EXPORT_OK = qw( DEBUG ); our $DEBUG = 1; sub DEBUG { if (@_) { $DEBUG = shift; } return $DEBUG; } 1;

      Ooooooops, my bad! It has to be 'package SS::ExportScalar' instead of just 'package ExportScalar'! Thank you so much! My NPR donation will be diverted to the Perl Monks! ;o)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://843218]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2018-07-17 17:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (374 votes). Check out past polls.

    Notices?