[kw-pm] why is my $PWD uninitialized?
Robert P. J. Day
rpjday at crashcourse.ca
Mon May 31 06:02:03 PDT 2010
(aside: i'm suddenly immersed in a bunch of perl code so while my
perl is very rusty, i'm going to be asking some admittedly dumb
questions over the next little while as i get back to speed.)
i'm rewriting a tutorial on the "udev" facility in linux, and it
turns out that the source tarball has a "test" component that
simulates plugging and unplugging various devices and checking the
messages generated against what's expected. very cool.
however, when i try to run the script on my ubuntu system:
$ sudo test/udev-test.pl
Use of uninitialized value $PWD in concatenation (.) or string at test/udev-test.pl line 1735.
udev-test will run 142 tests:
TEST 1: no rules
device '/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda' expecting node/link 'sda'
Use of uninitialized value $PWD in concatenation (.) or string at test/udev-test.pl line 1663.
Use of uninitialized value $PWD in concatenation (.) or string at test/udev-test.pl line 1663.
add: error
Can't exec "tree": No such file or directory at test/udev-test.pl line
1685.
Use of uninitialized value $PWD in concatenation (.) or string at test/udev-test.pl line 1698.
Use of uninitialized value $PWD in concatenation (.) or string at test/udev-test.pl line 1698.
remove: ok
... etc etc ...
the script udev-test.pl opens with:
...
use warnings;
use strict;
my $PWD = $ENV{PWD};
my $sysfs = "test/sys/";
...
down at line 1735, there is:
print CONF "udev_rules=\"$PWD\"\n";
while at line 1663:
if ((-e "$PWD/$udev_root$rules->{exp_name}") ||
(-l "$PWD/$udev_root$rules->{exp_name}")) {
i'm baffled -- shouldn't that variable be initialized? or am i just
forgetting something hideously basic about my perl?
rday
--
========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA
Linux Consulting, Training and Kernel Pedantry.
Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================
More information about the kw-pm
mailing list