dcd@tc.fluke.COM (David Dyck) (08/26/90)
The perl manual states: If you want to modify the debugger, copy perldb.pl from the perl library to your current directory and modify it as necessary. The source file perldb.pl states: # .... It also inserts a do 'perldb.pl' before the first line. In perl PL18 I could load a custom perldb.pl script in the current directory, and it would get used when invoking 'perl -d'; In PL28 this feature is no longer enabled, and perl (by default) looks in the 'standard library places'. I can use the -I . to cause it to look in the current directory. The sources indicate that PL28 looks for 'perldb.pl' with 'require', and PL18 looked with 'do'. 1) Why doesn't 'require' look in the current directory first? 2) Are the manual and comments in perldb.pl wrong? 3) The reason I wanted to customize the library is I run under SunOS using "on -i hostname" a lot, and the following perldb.pl lines fail: open(IN,"/dev/tty"); # so we don't dingle stdin open(OUT,">/dev/tty"); # so we don't dongle stdout If these line were change to the following I would not need to do this customization. open(IN,"/dev/tty") || open(IN,"<&STDIN"); # so we don't dingle stdin open(OUT,">/dev/tty") || open(OUT,">&STDOUT"); # so we don't dongle stdout Does anyone see anything wrong with making this change? PS. perl patch 28 has not appeared in comp.lang.perl here in the northwest. I was able to get a copy from Larry's patch server. (thanks) David Dyck Domain: dcd@tc.fluke.COM Voice: +1 206 356 5807 UUCP: {uunet,uw-beaver,decwrl,microsof,sun}!fluke!dcd Snail: John Fluke Mfg. Co. / P.O. Box 9090 / Everett WA 98206-9090 / USA
vixie@decwrl.dec.com (Paul A Vixie) (08/27/90)
Hear, hear!
[dcd@tc.fluke.COM (David Dyck)]
>> 1) Why doesn't 'require' look in the current directory first?
As the author of the original &require(), I agree with this sentiment.
Having "." implicitly included at the END of the search path is not
useful -- the whole reason for having things in "." is to override the
library version of some thing. Larry -- please change! PL28 is broken
enough and new enough that this behaviour isn't cast in stone yet.
--
Paul Vixie
DEC Western Research Lab <vixie@wrl.dec.com>
Palo Alto, California ...!decwrl!vixie
merlyn@iwarp.intel.com (Randal Schwartz) (08/27/90)
In article <1990Aug26.055821.22669@tc.fluke.COM>, dcd@tc (David Dyck) writes: | In perl PL18 I could load a custom perldb.pl script | in the current directory, and it would get used when | invoking 'perl -d'; | | In PL28 this feature is no longer enabled, and perl | (by default) looks in the 'standard library places'. | I can use the -I . to cause it to look in the current directory. Correct. | The sources indicate that PL28 looks for 'perldb.pl' with 'require', and | PL18 looked with 'do'. | | 1) Why doesn't 'require' look in the current directory first? So you don't get unexpected behavior from "system" software when you have a getopts.pl in one of your directories. Both 'do' and 'require' use the same logic while looking for the file. Only the directories in @INC are searched, and there's no longer an implied check of the current directory ahead of the @INC list. '.' is now an explicit entry at the *end* of the list. | 2) Are the manual and comments in perldb.pl wrong? Yes. I already noticed this in "the book", and Larry is updating the manpage. (Larry, I also object to 'loading custom ...' because even the standard one says that! :-) | 3) The reason I wanted to customize the library is I run under SunOS | using "on -i hostname" a lot, and the following perldb.pl lines | fail: | | open(IN,"/dev/tty"); # so we don't dingle stdin | open(OUT,">/dev/tty"); # so we don't dongle stdout | | If these line were change to the following I would not | need to do this customization. | | open(IN,"/dev/tty") || open(IN,"<&STDIN"); # so we don't dingle stdin | open(OUT,">/dev/tty") || open(OUT,">&STDOUT"); # so we don't dongle stdout | | Does anyone see anything wrong with making this change? Sounds like something Larry can change for the next patch. Right Larry? What does this break? | PS. | perl patch 28 has not appeared in comp.lang.perl here in the | northwest. I was able to get a copy from Larry's patch server. | (thanks) Well, it made it to *this* part of the Northwest (the south-Northwest :-). 'course, I'm on the Internet and get my articles an average of 15 minutes from when they were posted, but that shouldn't make *that* much difference.... # totally overlooked new feature for obscure JAPHs follows... whee!... # actually, I think Larry put this in just for good obscure coding. :-) print unpack("u","92G5S=\"!A;F]T:&5R(%!E<FP@:&%C:V5R+") -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/
lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (08/29/90)
In article <1990Aug26.055821.22669@tc.fluke.COM> dcd@tc.fluke.COM (David Dyck) writes:
: The perl manual states:
:
: If you want to modify the debugger, copy perldb.pl from the
: perl library to your current directory and modify it as
: necessary.
:
: The source file perldb.pl states:
: # .... It also inserts a do 'perldb.pl' before the first line.
:
: In perl PL18 I could load a custom perldb.pl script
: in the current directory, and it would get used when
: invoking 'perl -d';
:
: In PL28 this feature is no longer enabled, and perl
: (by default) looks in the 'standard library places'.
: I can use the -I . to cause it to look in the current directory.
:
: The sources indicate that PL28 looks for 'perldb.pl' with 'require', and
: PL18 looked with 'do'.
:
: 1) Why doesn't 'require' look in the current directory first?
Two reasons. First, you don't want things behaving funny just because you
happened to cd into the wrong directory. Second, most requires will end
up getting stuff out of the perl library, and your scripts will start
up considerably faster if it looks there first.
For a normal require, if you want it to look in the current directory first,
put
unshift(@INC,pop(@INC));
For a special perldb.pl, you'll have to say
perl -dI . script
: 2) Are the manual and comments in perldb.pl wrong?
Yes.
: 3) The reason I wanted to customize the library is I run under SunOS
: using "on -i hostname" a lot, and the following perldb.pl lines
: fail:
:
: open(IN,"/dev/tty"); # so we don't dingle stdin
: open(OUT,">/dev/tty"); # so we don't dongle stdout
:
: If these line were change to the following I would not
: need to do this customization.
:
: open(IN,"/dev/tty") || open(IN,"<&STDIN"); # so we don't dingle stdin
: open(OUT,">/dev/tty") || open(OUT,">&STDOUT"); # so we don't dongle stdout
:
: Does anyone see anything wrong with making this change?
No. In fact, I just changed my copy to do that.
Larry