Closed p5pRT closed 21 years ago
perldoc perlmodlib states:
....
To find out all modules installed on your system\, including those without documentation or outside the standard release\, just do this:
% find `perl -e 'print "@INC"'` -name '*.pm' -print ...
but since '.' is in most @INC lists\, this find command will report more than desired\, especially if the users happens to have their current directory in the root "/"
of course\, the following is probably too verbose\, right?
% find `perl -e 'print join " "\, grep { $_ ne "." } @INC'` -name '*.pm' -print
David Dyck (via RT) wrote:
perldoc perlmodlib states:
\.\.\.\. To find out all modules installed on your system\, including those without documentation or outside the standard release\, just do this​: % find \`perl \-e 'print "@​INC"'\` \-name '\*\.pm' \-print \.\.\.
but since '.' is in most @INC lists\, this find command will report more than desired\, especially if the users happens to have their current directory in the root "/"
of course\, the following is probably too verbose\, right?
% find `perl -e 'print join " "\, grep { $_ ne "." } @INC'` -name '*.pm' -print
Forward this to the golfers if you find it too verbose ;-) However % find `perl -Te 'print "@INC"'` -name '*.pm' -print does what you want and is one character longer.
I applied the change below :
Change 18050 by rgs@rgs-home on 2002/10/22 19:11:12
perlmodlib.pod nit suggested by David Dyck (bug #18055) Regenerate perlmodlib.pod
Affected files ...
...... //depot/perl/pod/perlmodlib.PL#16 edit ...... //depot/perl/pod/perlmodlib.pod#68 edit
Differences ...
==== //depot/perl/pod/perlmodlib.PL#16 (text) ====
@@ -149\,7 +149\,7 @@ those without documentation or outside the standard release\, just do this:
- % find `perl -e 'print "@INC"'` -name '*.pm' -print + % find `perl -Te 'print "@INC"'` -name '*.pm' -print
They should all have their own documentation installed and accessible
via your system man(1) command. If you do not have a B\
==== //depot/perl/pod/perlmodlib.pod#68 (text) ====
@@ -175\,6 +175\,10 @@
Predeclare global variable names (obsolete)
+=item version + +Perl extension for Version Objects + =item vmsish
Control VMS-specific language features @@ -1343\,7 +1347\,7 @@ those without documentation or outside the standard release\, just do this:
- % find `perl -e 'print "@INC"'` -name '*.pm' -print + % find `perl -Te 'print "@INC"'` -name '*.pm' -print
They should all have their own documentation installed and accessible
via your system man(1) command. If you do not have a B\
On Tue\, Oct 22\, 2002 at 10:28:18PM +0200\, Rafael Garcia-Suarez wrote:
Forward this to the golfers if you find it too verbose ;-)
find-golf@find.org ? :-)
However % find `perl -Te 'print "@INC"'` -name '*.pm' -print does what you want and is one character longer.
Very clever
@@ -149\,7 +149\,7 @@ those without documentation or outside the standard release\, just do this:
- % find `perl -e 'print "@INC"'` -name '*.pm' -print + % find `perl -Te 'print "@INC"'` -name '*.pm' -print
They should all have their own documentation installed and accessible via your system man(1) command. If you do not have a B\
But maybe a bit too clever. I think that there ought to be at least a line somewhere close explaining quite why you're using the -T flag here.
[Turn on tainting\, tainting removes . from @INC\, which is what we want to find installed modules\, but exclude modules in the current directory]
Nicholas Clark -- Befunge better than perl? http://www.perl.org/advocacy/spoofathon/
% find \`perl \-Te 'print "@​INC"'\` \-name '\*\.pm' \-print
For the record here is a NT command line that does almost the same thing
for /f "usebackq" %I IN (`"perl -Te $\,=$/;print@INC;"`) DO dir /s /n "%I\*.pm"
Maybe that should go in the doc as well? (note that presence or absence of a space in the above is vital.)
Yves
Nicholas Clark \nick@​unfortu\.net wrote:
On Tue\, Oct 22\, 2002 at 10:28:18PM +0200\, Rafael Garcia-Suarez wrote:
- % find `perl -e 'print "@INC"'` -name '*.pm' -print + % find `perl -Te 'print "@INC"'` -name '*.pm' -print
They should all have their own documentation installed and accessible via your system man(1) command. If you do not have a B\
But maybe a bit too clever. I think that there ought to be at least a line somewhere close explaining quite why you're using the -T flag here.
What about adding also a note about perllocal ? Like this :
--- perlmodlib.PL +++ perlmodlib.PL Wed Oct 23 13:03:36 2002 @@ -151\,6 +151\,7 @@
% find `perl -Te 'print "@INC"'` -name '*.pm' -print
+(The -T is here to prevent '.' from being listed in @INC.)
They should all have their own documentation installed and accessible
via your system man(1) command. If you do not have a B\
=head2 Extension Modules
I've added something like this as change 18052. perllocal wasn't documented anywhere in the pods\, except in MakeMaker.
I wrote :
--- perlmodlib.PL +++ perlmodlib.PL Wed Oct 23 13:03:36 2002 @@ -151\,6 +151\,7 @@
% find \`perl \-Te 'print "@​INC"'\` \-name '\*\.pm' \-print
+(The -T is here to prevent '.' from being listed in @INC.) They should all have their own documentation installed and accessible via your system man(1) command. If you do not have a B\
program\, you can use the Perl B\ program instead\, which @@ -158\,6 +159\,10 @@ have a B\ program but it doesn't find your modules\, you'll have to fix your manpath. See L\ for details. If you have no system B\ command\, you might try the B\ program. + +The command C\ gives you a (possibly incomplete) list +of the non-standard modules that have been installed on your system. +(The perllocal.pod file is updated by the standard MakeMaker install process.) =head2 Extension Modules
Op een mooie herfstdag (Wednesday 23 October 2002 13:16)\, schreef Orton\, Yves:
% find \`perl \-Te 'print "@​INC"'\` \-name '\*\.pm' \-print
For the record here is a NT command line that does almost the same thing
for /f "usebackq" %I IN (`"perl -Te $\,=$/;print@INC;"`) DO dir /s /n "%I\*.pm"
Maybe that should go in the doc as well? (note that presence or absence of a space in the above is vital.)
I'd say:
for /f "usebackq" %I in (`perl -Tle "print for @INC"`) do @dir /s/b "%I\*.pm"
(the real diff is in the '@' and the '/b'\, to get a comparable result)
good luck\,
Abe -- Amsterdam Perl Mongers http://amsterdam.pm.org perl -wle '$_=q.dtr aJfagne wexrshuctahovkjhcskem nPoeprlritqlbu.; print@{{split//}}{"a".."x"}'
Orton\, Yves wrote:
% find \`perl \-Te 'print "@​INC"'\` \-name '\*\.pm' \-print
For the record here is a NT command line that does almost the same thing
for /f "usebackq" %I IN (`"perl -Te $\,=$/;print@INC;"`) DO dir /s /n "%I\*.pm"
Maybe that should go in the doc as well? (note that presence or absence of a space in the above is vital.)
Or\, perhaps more portably:
perl -TlMFile::Find -e "find { no_chdir => 1\, wanted => sub { /\.pm\z/ && print } }\, @INC"
Tested on ActiveState Perl\, with Windows 95. The no_chdir is both so that $_ contains full paths\, and to avoid taint problems due to chdir.
-- my $n = 2; print +(split //\, 'e\,4c3H r ktulrnsJ2tPaeh' ...."\n1oa! er")[map $n = ($n * 24 + 30) % 31\, (42) x 26]
On Wed\, 23 Oct 2002 at 20:49 -0400\, Benjamin Goldberg \<goldbb2@earthlink.ne...:
Orton\, Yves wrote:
% find \`perl \-Te 'print "@​INC"'\` \-name '\*\.pm' \-print
For the record here is a NT command line that does almost the same thing
for /f "usebackq" %I IN (`"perl -Te $\,=$/;print@INC;"`) DO dir /s /n "%I\*.pm"
Maybe that should go in the doc as well? (note that presence or absence of a space in the above is vital.)
One should note that usebackq is a Windows 2000 specific enhancement to CMD.EXE. (Our older NT 4 systems didn't even have this in the documentation) Learned something new\, thanks!
Or\, perhaps more portably:
perl -TlMFile::Find -e "find { no_chdir => 1\, wanted => sub { /\.pm\z/ && print } }\, @INC"
Tested on ActiveState Perl\, with Windows 95. The no_chdir is both so that $_ contains full paths\, and to avoid taint problems due to chdir.
I'm glad to see someone suggesting a perl only solution with File::Find!
Abe Timmerman said on 24 October 2002 00:09
I'd say:
for /f "usebackq" %I in (`perl -Tle "print for @INC"`) do @dir /s/b "%I\*.pm"
(the real diff is in the '@' and the '/b'\, to get a comparable result)
Oh yeah. Much nicer. Thanks\, I somehow overlooked the /b option.
Now\, the question is should it go into perlmodlib? IMO it should.
Actually\, that raises an interesting point for me. Are there any decent statistics as to how many users/installations there are in the various OS arenas?
I say this because generally speaking the documentation has a very strong unix/sh bias. This isnt so bad\, but if there are a sufficient number of people using other OS's then surely beefing up the docs with examples relevant to them would be a good idea.
Id be really interested in knowing the number of users on
Mac *nix/sh W32/bash W32/cmd
yves
Or\, perhaps more portably:
perl -TlMFile::Find -e "find { no_chdir => 1\, wanted => sub { /\.pm\z/ && print } }\, @INC"
Tested on ActiveState Perl\, with Windows 95. The no_chdir is both so that $_ contains full paths\, and to avoid taint problems due to chdir.
Yup\, thats better too. :-)
Although I think it should be case insensitive\, and that it should return MS style paths.
perl -TlMFile::Find -e "find { no_chdir => 1\, wanted => sub { s!/!\\!g; /\.pm\z/i && print } }\, @INC"
Now I really think some non *nix/sh examples should go in perlmodlib...
Yves
"Orton\, Yves" \yves\.orton@​mciworldcom\.de wrote:
Abe Timmerman said on 24 October 2002 00:09
I'd say:
for /f "usebackq" %I in (`perl -Tle "print for @INC"`) do @dir /s/b "%I\*.pm"
(the real diff is in the '@' and the '/b'\, to get a comparable result)
Oh yeah. Much nicer. Thanks\, I somehow overlooked the /b option.
Now\, the question is should it go into perlmodlib? IMO it should.
In fact I would be in favor of the pure perl solution (and in all docs likewise\, except of course for platform-specific docs.) But a true cross-platform solution would be perhaps too verbose.
In fact I would be in favor of the pure perl solution (and in all docs likewise\, except of course for platform-specific docs.) But a true cross-platform solution would be perhaps too verbose.
Then we should provide at least a few different ways for people to do it on different OS's.
Considering and assuming that the vast majority of users are on either win32 or *nix then a shell solution and a win32 solution should be provided. (Preferably pure perl to avoid 9x/NT/2k+ issues).
If there are other platforms that have sufficient usage then they should be represented as well.
Just my $0.02
:-)
Yves
arthur@contiller.se - Status changed from 'new' to 'open'
This bug is still open\, and after reading all the posts I've come up with the following patch. It's not feasible to list implementations for every possible (even noteworthy) environment\, so I've just added a little note to describe the proper environment for that command. Also\, a Perl only implementation will ruin the "quick and easy" nature of what's already provided.
Casey West
-- Shooting yourself in the foot with FidoNet You put your foot in your mouth\, then echo it internationally.
Casey
As an alternative\, replace the find command with perl:
% perl -MFile::Find=find -Tlwe \ 'find { wanted => sub { print if /\.pm\z/ }\, no_chdir => 1 }\, @INC'
Robin -----Original Message----- From: Casey West [mailto:casey@geeknest.com] Sent: 23 April 2003 17:32 To: perl5-porters@perl.org Subject: [PATCH] [perl #18055] Clarify for bug resolution.
This bug is still open\, and after reading all the posts I've come up with the following patch. It's not feasible to list implementations for every possible (even noteworthy) environment\, so I've just added a little note to describe the proper environment for that command. Also\, a Perl only implementation will ruin the "quick and easy" nature of what's already provided.
Casey West
-- Shooting yourself in the foot with FidoNet You put your foot in your mouth\, then echo it internationally.
This e-mail and any attachments may contain confidential and/or privileged material; it is for the intended addressee(s) only. If you are not a named addressee\, you must not use\, retain or disclose such information.
NPL Management Ltd cannot guarantee that the e-mail or any attachments are free from viruses.
NPL Management Ltd. Registered in England and Wales. No: 2937881 Registered Office: Teddington\, Middlesex\, United Kingdom TW11 0LW.
On onsdag\, apr 23\, 2003\, at 18:54 Europe/Stockholm\, Robin Barker wrote:
Casey
As an alternative\, replace the find command with perl:
% perl \-MFile​::Find=find \-Tlwe \\ 'find \{ wanted => sub \{ print if /\\\.pm\\z/ \}\, no\_chdir => 1 \}\,
@INC'
That should be way more portable.
Arthur
It was Wednesday\, April 23\, 2003 when Robin Barker took the soap box\, saying: : Casey : : As an alternative\, replace the find command with perl: : : % perl -MFile::Find=find -Tlwe \ : 'find { wanted => sub { print if /\.pm\z/ }\, no_chdir => 1 }\, : @INC'
One of the biggest complaints people have had with that is the output is so unix centric. However\, thanks to Ken Williams (who reminded me of File::Spec) and Jonathan Steinert (for win32 testing) I've got an almost portable shell solution.
% perl -MFile::Find=find -MFile::Spec::Functions -Tlwe \ 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }\, no_chdir => 1 }\, @INC'
With the caveat that under win32 the quotes need to be doubled.
I'd be happy with this solution.
Casey West
-- If you put garbage in a computer nothing comes out but garbage. But this garbage\, having passed through a very expensive machine\, is somehow ennobled and none dare criticize it.
It was Wednesday\, April 23\, 2003 when Casey West took the soap box\, saying: : It was Wednesday\, April 23\, 2003 when Robin Barker took the soap box\, saying: : : Casey : : : : As an alternative\, replace the find command with perl: : : : : % perl -MFile::Find=find -Tlwe \ : : 'find { wanted => sub { print if /\.pm\z/ }\, no_chdir => 1 }\, : : @INC' : : One of the biggest complaints people have had with that is the output : is so unix centric. However\, thanks to Ken Williams (who reminded me : of File::Spec) and Jonathan Steinert (for win32 testing) I've got an : almost portable shell solution. : : % perl -MFile::Find=find -MFile::Spec::Functions -Tlwe \ : 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }\, : no_chdir => 1 }\, @INC' : : With the caveat that under win32 the quotes need to be doubled. : : I'd be happy with this solution.
Oh\, and here's the patch.
Casey West
-- Shooting yourself in the foot with Mac Finder It's easy to shoot yourself in the foot -- just point and shoot.
On Wed\, Apr 23\, 2003 at 01:38:13PM -0400\, Casey West wrote:
--- perl-current.orig/pod/perlmodlib.PL Mon Apr 21 10:50:06 2003 +++ perl-current/pod/perlmodlib.PL Wed Apr 23 13:33:25 2003 @@ -147\,9 +147\,12 @@
To find out I\
modules installed on your system\, including those without documentation or outside the standard release\, -just do this: +just use the following command (under the default win32 shell\, +the quotes should be doubled).
Would you consider changing it to say "double quotes should be used instead of single quotes"? I fear "the quotes should be doubled" is ambiguous; it could mean either '' or ".
Ronald
It was Wednesday\, April 23\, 2003 when Ronald J Kimball took the soap box\, saying: : : Would you consider changing it to say "double quotes should be used instead : of single quotes"? I fear "the quotes should be doubled" is ambiguous; it : could mean either '' or ".
You beat me to it\, I was on my way. Here is the full patch once again\, and hopefully for the last time. :-)
Casey West
-- "I loathe people who keep dogs. They are cowards who haven't got the guts to bite people themselves." --August Strindberg
On Wed\, Apr 23\, 2003 at 01:55:46PM -0400\, Casey West wrote:
It was Wednesday\, April 23\, 2003 when Ronald J Kimball took the soap box\, saying: : : Would you consider changing it to say "double quotes should be used instead : of single quotes"? I fear "the quotes should be doubled" is ambiguous; it : could mean either '' or ".
You beat me to it\, I was on my way. Here is the full patch once again\, and hopefully for the last time. :-)
--- perl-current.orig/pod/perlmodlib.PL Mon Apr 21 10:50:06 2003 +++ perl-current/pod/perlmodlib.PL Wed Apr 23 13:50:40 2003 @@ -147\,9 +147\,12 @@
To find out I\
modules installed on your system\, including those without documentation or outside the standard release\, -just do this: +just use the following command (double quotes should be used instead
+of single quotes).
Wait\, now you've left out the part about the Win32 shell! :D
I think what we want is:
(under the default win32 shell\, double quotes should be used instead of single quotes)
Sorry!
Ronald
It was Wednesday\, April 23\, 2003 when Ronald J Kimball took the soap box\, saying: : Wait\, now you've left out the part about the Win32 shell! :D : : I think what we want is: : : (under the default win32 shell\, double quotes should be used instead of : single quotes)
I will become a better proof-reader. I will slow down before I send. I will eat my own dog food.
: Sorry!
No worries\, it's the right thing to do. :-)
Casey West
-- Shooting yourself in the foot with FidoNet You put your foot in your mouth\, then echo it internationally.
Casey West wrote:
--- perl-current.orig/pod/perlmodlib.PL Mon Apr 21 10:50:06 2003 +++ perl-current/pod/perlmodlib.PL Wed Apr 23 13:57:19 2003
Thanks\, applied as #19320\, (plus regeneration of perlmodlib.pod.)
-- Untouched is not *NIX
@rgs - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#18055 (status was 'resolved')
Searchable as RT18055$