> > Note that 'use vars' is supposedly depreciated, so don't > > use it if your script depends on 5.6 features. Placing > > 'our' in a lexical scope probably makes it externally > > visible until you leave the scope, 'use vars' imports > > into your symbol table. Hope this is right :) > > That's not how I see it.
What part don't you understand? "Note that 'use vars' is supposedly depreciated" - see "Programming Perl" page 861 "so don't use it if your script depends on 5.6 features." Or better said as "To ensure your script/module works on earlier versions 'use vars', but use 'our' if your project won't run with less than 5.6.0 anyway." > Both 'use vars' and 'our' are used to keep "use strict 'vars'" > happy, by declaring a global variable and allowing one to use > it without specifying the full package name. And I use strictures to ensure my code is readable... so having to 'use vars' or 'our' is part of that. The difference is I'm trying to keep myself/other coders happy, not strict :) > The difference is that 'use vars' is not lexically scoped and > affects the entire package, whereas 'our' takes the same scoping > rules as 'my', but in contrast with 'my', refers to the same > global variable. I should have read the documentation for 'our', obviously. The difference between 'use vars' and 'our' are subtle! > As far as I understand it, this has nothing to do with importing > in the symbol table. You've never seen the implementation of 'use vars' then :) The tail end of which is: *{"${callpack}::$sym"} = ( $ch eq "\$" ? \$ {"${callpack}::$sym"} : $ch eq "\@" ? \@ {"${callpack}::$sym"} : $ch eq "\%" ? \% {"${callpack}::$sym"} : $ch eq "\*" ? \* {"${callpack}::$sym"} : $ch eq "\&" ? \& {"${callpack}::$sym"} : do { require Carp; Carp::croak("'$ch$sym' is not a valid variable name"); }); Which I assure you has a LOT to do with importing into symbol tables. This is the reason 'use vars' is package scoped. Jonathan Paton ===== ---------------BEGIN GEEKCODE BLOCK-----------v3.12 GCS/E d+ s+: a20 C++(+++)>$ UHL++>+++ P+++ L++>++++ E- W++(-) N+ o? K- w--- !O M-- !V PS-- PE++ Y++ PGP t@ 5-- X-- R- tv- b DI+ D- G++ e h! !r--->++ !y--- ----------------END GEEKCODE BLOCK----------------- JAPH: print`perldoc perlembed`=~/(Ju.*)/,"\n" __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]