home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam

Programming Perl


7.2.76 vars - Predeclare Global Variable Names

use vars qw($frob @mung %seen);

This module predeclares all variables whose names are in the list, allowing you to use them under use strict , and disabling any typo warnings.

Packages such as the AutoLoader and SelfLoader that delay loading of subroutines within packages can create problems with file-scoped lexicals defined using my . This is because they move the subroutines outside the scope of the lexical variables. While the use vars pragma cannot duplicate the effect of file-scoped lexicals (total transparency outside of the file), it can act as an acceptable substitute by pre-declaring global symbols, ensuring their availability to the routines whose loading was delayed.

See also the subs module.


7.2.75 Time::Local - Efficiently Compute Time from Local and GMT Time Book Index 8. Other Oddments

[ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ]







(追記) (追記ここまで)


(追記) (追記ここまで)


AltStyle によって変換されたページ (->オリジナル) /