LPM: Many Monkeys - conditional use
Rich Bowen
rbowen at rcbowen.com
Fri Mar 24 07:08:45 CST 2000
David Hempy wrote:
>
> This question has nothing to do with Win32, so don't get scared off just yet...
...
> >if (Win32::IsWinNT()) {
> > use Win32::FileSecurity;
> >}
Oooh, I know!
use statement get executed first. Always. So your if is ignored. You
need to require it, or do some fancy magic in BEGIN blocks. Perhaps ...
BEGIN {
unless (Win32::FsType() =~ /NTFS/) {
print "Can't do permissions here...it's as safe
as its going to get.\n ";
exit(0);
}
use Win32::FileSecurity;
The BEGIN block gets done before the use.
Or, if you use require, and then call import() to get the functions that
you want ... which is sort of what use does anyway.
Rich
--
http://www.ApacheUnleashed.com/
Lexington Perl Mongers - http://lexington.pm.org/
PGP Key - http://www.rcbowen.com/pgp.txt
More information about the Lexington-pm
mailing list