in reply to Who's who in interpackage global vars

Good stuff to know - yes - but, forgive me if I find it annoying :P

I want an external module to be able to use a var from the main package -- and all good perlers use strict, but we can't use the two together :P

Whats the solution then? Just a simple "don't"?

-- JP

  • Comment on Re: Who's who in interpackage global vars

Replies are listed 'Best First'.
Re: Re: Who's who in interpackage global vars
by davorg (Chancellor) on Feb 20, 2001 at 21:11 UTC

    Well, define the variable you want to share as a package variable rather than a lexical variable.

    use vars qw($var); $var = 'some value'; &Package::printvar; package Package; sub printvar { print $main::var; }
    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me