[17340] in Perl-Users-Digest
Perl-Users Digest, Issue: 4762 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 30 14:10:37 2000
Date: Mon, 30 Oct 2000 11:10:24 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <972933023-v9-i4762@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 30 Oct 2000 Volume: 9 Number: 4762
Today's topics:
Re: Comparing two files (Tom Christiansen)
Re: Comparing two files <mjcarman@home.com>
Re: Comparing two files <james@NOSPAM.demon.co.uk>
Re: Comparing two files (Tom Christiansen)
Re: Comparing two files (Mark-Jason Dominus)
Re: Comparing two files <camerond@mail.uca.edu>
Drawing a blank charlie.bursell@healthcare.com
Re: Drawing a blank nobull@mail.com
Re: Encrypting cookies? <ubl@schaffhausen.de>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 Oct 2000 08:39:53 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: Comparing two files
Message-Id: <39fd9649@cs.colorado.edu>
In article <slrn8vqfca.ac5.mgjv@martien.heliotrope.home>,
Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
>Oh, come on, Tom. perldoc is perfectly useable for most beginning users
>and many cursory uses of the documentation.
It is not *merely* that we're talking about surpassingly nasty code
that is slow to execute, a terror to read, and virtually impossible
to extend, code that is replete with countless hacks and grave
security bugs. These sins might possibly, least in theory. be
remedied through patches--assuming a decent programmer could hold
his cookies long enough while looking at that completely awful code
to effect this.
And in fact, although it induced many painful weeks of projectile
vomiting, I did stick my retching face into the code long enough
to remedy most of the glaring security holes that rendered any
system with the old version on it as wide-open to wickedry as a
jewelry shop whose doorway is defended by a transparent curtain
of cellophane. If you have a version of perldoc on your system
from a release prior to 5.6, you should immediately remove it.
Let's not wait until someone finally broadcasts pathetically turnkey
exploits in the pertinent public forums for this to happen.
But those sins, great though they appear, are still the lesser
manifestation of that program's evil. More important is the fact
that it is fundamentally misdesigned, an issue which cannot be
ameliorated through any number of cosmetic band-aids. Instead, a
completely new program, one first designed and only then written,
must be created to replace it.
And yes, before you splutter about squeaky wheels and complaints
without cures, I *have* put my money where my mouth is, so to speak.
I did the work. That's part of the demo I included in the supercited
posting.
>At least it gives everyone
>who has Perl installed a common way to get to the manual.
This reassuring platitude, doubtless intended to assuage the shame
many should feel in advocating this collective embarrassment, is
nevertheless *FALSE*. Ask a MacOS person, for example.
Repeat after me:
MICROSOFT IS NOT THE WHOLE FRICKING WORLD.
>It makes it
>easier for this group to communicate the eternal phrase "RTFM and here's
>where to find it".
>However, I do not feel like having to explain to each person who isn't
>used to having man, grep, sed and awk around what
>
># man perl
>
>means. I also don't feel like saying it and leaving it unexplained.
It's part of our culture and lingo. You merely them to consult the
perlsec manpage, or perlsec(1), or the chroot manpage, or chroot(2).
And you give them things like this. The Camel glossary reads:
=item B<manpage>
A "page" from the manuals, typically accessed via the I<man>(1)
command. A manpage contains a SYNOPSIS, a DESCRIPTION, a list
of BUGS, and so on, and is typically longer than a page. There
are manpages documenting I<commands>, I<syscalls>, I<library>
I<functions>, I<devices>, I<protocols>, I<files>, and such. In
this book, we call any piece of standard Perl documentation
(like I<perlop> or I<perldelta>) a manpage, no matter what
format it's installed in on your system.
The Camel also says in its Prologue:
When we refer to a "Perl manpage" in this book, we're talking
about this set of online Perl manual pages, sitting on your
computer. The name I<manpage> is purely a convention meaning
a file containing documentation--you don't need a Unix-style
I<man> program to read one. You may even have the Perl manpages
installed as HTML pages, especially on non-Unix systems.
>Everyone who has Perl
>has perldoc. That is its strength.
Even were that true -- AND IT IS NOT TRUE -- it does not overcome
the terrible bugs and intractable design flaws.
Martien, you are clearly a competent programmer. I challenge you
to look at the source code to the old perldoc program with an eye
toward, oh, let's say maintainability. Think of software design
principles. Note: I do not suggest doing so on an empty stomach.
Then we can talk for a good twenty pages or more about the brain-dead,
non-extensible, special-purpose, counterintuitive botch of its
user-interface. Except let's not bother. Just use the new stuff
instead and relegate the old fossil to the Lower Coprolithic Period
where it belongs. And even if you don't have the old stuff, use
the abbreviated descriptions so as not to promote unhealthy habits
amongst the untooled neophytes.
--tom
------------------------------
Date: Mon, 30 Oct 2000 09:33:59 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: Comparing two files
Message-Id: <39FD94E7.842AE250@home.com>
Mark-Jason Dominus wrote:
>
[snip of code sample and IRC distaste for it.]
>
> I replied that the entire run of MAKE_SLIDES took 1.5 seconds before,
> and with the addition of 155 calls to 'cmp' it now took about 2.5
> seconds, so I was not really interested in spending a lot of time and
> effort writing code to maintain a database of hash fingerprints just
> to save one second per run.
Seems logical. You were (apparently) dealing with purists who are
obsessed with the ideal of maximal efficiency of the code, and never
mind how much real world time is consumed. Spending an hour to save a
second is silly. Unless, of course, it's something that's going to be
run thousands of times. (i.e. >> 3600)
> This sort of thing comes up in the newsgroups too. A lot of people
> have a funny blind spot about doing everything in Perl and not calling
> any external programs. Like everything else, what is approrpiate
> depends on the circumstances.
I've noticed this trend as well. The only explanation I can think of
(that makes any sense to me, at least) is that if you're answering a
post here, you can't rely on other readers using a certain platform. So
telling someone to call `diff f1 f2` isn't helpful if the person asking
the question is on Win*. Therefore, people try to do everything in Perl
so that it's usable by everyone reading the ng. But *not* using the
tools available on your platform when you *don't* need portability is a
form of insanity. (Or maybe false Hubris.)
-mjc
------------------------------
Date: Mon, 30 Oct 2000 18:02:48 +0000
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: Comparing two files
Message-Id: <ant3018480e8fNdQ@oakseed.demon.co.uk>
In article <39fd9649@cs.colorado.edu>, Tom Christiansen
<URL:mailto:tchrist@perl.com> wrote:
> In article <slrn8vqfca.ac5.mgjv@martien.heliotrope.home>,
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> >Oh, come on, Tom. perldoc is perfectly useable for most beginning
> >users and many cursory uses of the documentation.
[snip Tom's entertaining description of perldoc code]
> >At least it gives everyone who has
> >Perl installed a common way to get to the manual.
I do wish we could quash that misconception in this group.
I would get *so* much more out of people's answers if they
included a little more than just a perldoc reference.
> This reassuring platitude, doubtless intended to assuage the shame
> many should feel in advocating this collective embarrassment, is
> nevertheless *FALSE*. Ask a MacOS person, for example.
Or a RISC OS person.
Or an EPOC person.
Or any number of other non-UNIX like platforms.
> Repeat after me:
>
> MICROSOFT IS NOT THE WHOLE FRICKING WORLD.
MICROSOFT IS NOT THE WHOLE FRICKING WORLD.
In fact it is a perversion that deserves to be ignored
as much as possible. :-)
> >However, I do not feel like having to explain to each person who
> >isn't used to having man, grep, sed and awk around what
> >
> ># man perl
> >
> >means. I also don't feel like saying it and leaving it unexplained.
>
> It's part of our culture and lingo. You merely them to consult the
> perlsec manpage, or perlsec(1), or the chroot manpage, or chroot(2).
Hmmm, this sounds remarkably similar to Martien's argument for perldoc.
Not having either manpages nor perldoc I don't feel inclined to agree
without reservations. If there is a one-to-one mapping between manpages
and the HTML documents from perl.com then I would agree more readily.
> >Everyone who has Perl has perldoc. That is its strength.
The opposite is true, and that's its weakness.
> Then we can talk for a good twenty pages or more about the
> brain-dead, non-extensible, special-purpose, counterintuitive
> botch of its user-interface.
Gosh, I'd hate to be the original author right now.
I'd like to know what the valid range of keywords for perldoc is.
In other words, are they always "words" in the /^\w+$/ sense?
Do the keywords always match with an =item line in a POD document
somewhere, or do they scan all POD text found in @INC? If I knew
how perldoc was *supposed* to behave I would have a go at
implementing a quick hack perldoc equivalent just so that I can
look up perldoc references in the sources I actually do have
access to on my various platforms (eg. the HTML docs or site_perl
POD docs). Any help, much appreciated. Thanks.
--
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02
------------------------------
Date: 30 Oct 2000 11:19:27 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: Comparing two files
Message-Id: <39fdbbaf@cs.colorado.edu>
In article <ant3018480e8fNdQ@oakseed.demon.co.uk>,
James Taylor <james@NOSPAM.demon.co.uk> wrote:
>I do wish we could quash that misconception in this group.
You and me both.
>MICROSOFT IS NOT THE WHOLE FRICKING WORLD.
>In fact it is a perversion that deserves to be ignored
>as much as possible. :-)
I do my best, I assure you. :-)
>Hmmm, this sounds remarkably similar to Martien's argument for perldoc.
>Not having either manpages nor perldoc I don't feel inclined to agree
>without reservations. If there is a one-to-one mapping between manpages
>and the HTML documents from perl.com then I would agree more readily.
I'm trying to get people to realize that "manpage" == "documentation",
rather than what happens when you run some mythical "man" program. :-)
>> Then we can talk for a good twenty pages or more about the
>> brain-dead, non-extensible, special-purpose, counterintuitive
>> botch of its user-interface.
>
>Gosh, I'd hate to be the original author right now.
Virtually all the ad-hoc "tools" that come with Perl and were written
in it are supernasty draft prototypes that weren't designed in any
sense, but escaped without a proper rewrite. They're nearly
universally terrible examples of good coding. perlbug is also
this way, or perlcc. Simon (and I) rewrote perlcc, and I've
rewritten perldoc.
>I'd like to know what the valid range of keywords for perldoc is.
>In other words, are they always "words" in the /^\w+$/ sense?
>Do the keywords always match with an =item line in a POD document
>somewhere, or do they scan all POD text found in @INC? If I knew
>how perldoc was *supposed* to behave I would have a go at
>implementing a quick hack perldoc equivalent just so that I can
>look up perldoc references in the sources I actually do have
>access to on my various platforms (eg. the HTML docs or site_perl
>POD docs). Any help, much appreciated. Thanks.
Have you looked at my rewrite? A Unix-specific snapshot (because
of the tar format)
http://doriath.perl.com/misc/perlman-alpha0.tar.gz.
And was announced in this newsgroup, in p5p, and here:
http://use.perl.org/news/00/09/08/1634222.shtml
Although Chris was a bit off, because he didn't realize how the links
worked.
I've been working on the perldoc rewrite, as documented in the new
Camel's intro chapter. If you've read it, that description provides
just the vaguest sketch of the real story. Here are some simple
demos of how to search the through all perl documentation with the
new command.
If you *haven't* read what the Camel says, here's a very simple set
of examples showing the search abilities. Note that these demos
are of course all really calling the very same program, just through
convenient aliases. People who don't like aliases (whether shell
or argv or some other such way) can always use the longer, drawn-out
forms.
First, the simple stuff:
$ perlop comma
(dumps out the =head with Comma in it)
$ perlfunc split
(dumps out the =item for split)
(yes, this is like perldoc -f split)
(i have ideas to make this run superfast, instead of
how nasty perldoc works)
$ perlvar ORS
(dumps out the =item for $\, naturally)
$ perldiag 'assigned to typeglob'
(dumps out the use diagnostics whose =head matches that)
$ perlsub -a closures
generated on the fly using C<eval> or anonymous subroutines (closures).
for generation of closures as detailed in L<perlref>. Actual
a closure (an anonymous function that accesses enclosing lexicals).
scoped, those anonymous subroutines can act like closures... (Gee,
See L<perlref/"Function Templates"> for more about references and closures.
Now for the metapages. This next one is like "perldoc -f round"--and
they'll use the same code, of course.
$ perlfaqs round
(dumps out the FAQ whose =head talks about rounding)
"perlfaqs" is a metapage meaning all the perlfaq?.pod pages.
"perlhelp" is all the standard manpages (not modpods, though).
Other metapages would correspond to groupings like core, tutorials,
extension stuff, etc.
$ perlhelp CORE::GLOBAL
perldelta:(or globally by importing them into the CORE::GLOBAL::
perlsub:importing a sub into the special namespace C<CORE::GLOBAL::>.
perlsub: my $where = ($sym =~ s/^GLOBAL_// ? 'CORE::GLOBAL' : caller(0));
perlvar:a bizarre substitute for overriding CORE::GLOBAL::die().
perlvar:and use an C<END{}> or CORE::GLOBAL::die override instead.
Or just the pod directive headers:
$ perltoc typeglob
perl5005delta: Undefined value assigned to typeglob
perldata: Typeglobs and Filehandles
perldiag: Undefined value assigned to typeglob
perlsub: Passing Symbol Table Entries (typeglobs)
Section search goes through pod2text by default, but the rest
doesn't. I guess you could do it for paragraph search, too, but
the line and header and code searches don't make sense to pod2text.
Here is the longer explanation I posted.
--tom
Things are starting to come together nicely, and I think I'll be
able to give you stuff to play with and test out soon enough. Here's
my general working description. This all pretty much works save
for messy edges I intend to smooth out in the near future.
This all fits together, but you may need to read the whole thing
if you want to see the underlying componentry. That is, how low-level
the access that you can get actually is.
Note that these are all the same
perlman (normal mode)
podgrep (same, but non Perl-installation aware mode)
perldoc (for legacy operation; may have a few differing
CLI flags, but these are deprecated.)
But see below. In reality, perlman is just something of a front-end
for a bunch of little semi-related programs and/or function calls.
Passing a full path to perlman is the same as calling podgrep,
although with podgrep the pager is not autocalled.
===================== NORMAL USAGE =================
$ perlman
Prints out a short usage message.
$ perlsub
$ perlman perlsub
Shows you the perlsub manpage, formatted and paged. (The program
will use its own name as the name of the manpage to display if
that name is not from a set of expected installation names.)
If the pre-converted version is available in Config's $man1dir,
the system man program will be invoked upon it; this confers
all the speed and caching (and security?) of your native man
system, because in fact it really uses your system, without
having to know too much about it. This in practice speeds up
simple displays dramaticaly.
If there is no converted version but if you appear to be on a
manly system, the page will be manually sent through pod2man
and nroff and your pager. If you are unmanly, you get it run
through pod2text and thence to your pager once again.
If you want to do things the slow way, you can ignore the nroff
translations using the "-t" flag, which means "pod2text" only.
These are all the same:
$ perlsub -t
$ perlman -t perlsub
$ pod2text `podpath perlsub` | $PAGER
$ pod2text /usr/local/lib/perl5/5.6.0/pod/perlsub.pod | $PAGER
==================== SEARCH MODES =======================
[ section, paragraph, line; should this be a --mode=line style
option? ]
Search modes are one of the following:
no flag => section search
-p flag => paragraph search
-a flag => line search
-C flag => code search (verbatim/indented podagraphs)
-L flag => outline search (pod directives)
These are all the same:
$ perlsub local
$ perlman perlsub local
$ podgrep `podpath perlsub` local | $PAGER
$ podgrep /usr/local/lib/perl5/5.6.0/pod/perlsub.pod local | $PAGER
This runs section-search mode against the raw perlsub podpage,
where we're looking for any pod sections whose *headers* match
the pattern "local". By default, this text is sent through
pod2text and, if stdout isatty, your pager.
What's a section? A section is defined to be an =foo pod
directive plus any undirected text following that up until
another pod directive of the same or higher level. For example,
a =head1 would include subordinate =head2s and =items, but be
terminated by another =head1. An =item is lower than any =headN,
and is terminated by any =headN, or any =item that did not occur
immediately following the matched one without intervening text;
this latter rule allows a paragraph with multiple, consecutive
=item tags to be matched, such as you find in perlfunc and
perlvar. That way you can say things like
$ perlfunc split
$ perlvar OFS
$ perldiag 'assigned to typeglob'
To get each of those =item entries.
$ perldata -p typeglob
This runs paragraph-search mode, displaying any paragraph that
matches "typeglob". Pod directive paragraphs matching the
pattern are not immediately catted out. The paragraphs are by
default tagged with the paragraph number from the pod source,
and, if multiple files are possible (see Metapages below), the
manpage name itself. These paragraphs are sent through your
pager (and pod2text?). Because paragraphs break across line
boundaries, in paragraph mode, all whitespace chunks are converted
into \s+ and the (?ms) flags are added to control ^, $, and .
$ perlmod -a typeglob
The -a flag runs in line-search mode, showing all lines matching
the pattern "typeglob". Lines are tagged with the number from
their source, and, with multiple files, the name of the file.
Your pager will be used for output, but not pod2text, as this
is line-based.
$ perldata -C code
$ perldata -Ca code
The -C flag runs in code-search mode, either on paragraphs (by
default, or with -p) or lines (with -a). Only verbatim pod
paragraphs are listed, usually code. By default, -p is assumed
if -C is used and -a is not.
$ perlxs -L Keyword
$ perlman -L perlxs Keyword
The -L flag (same as the ol(1) program below) will search only in
the outline. It's essentially the same as
$ ol perlxs | grep Keyword
===================== CONJUNCTIVE SEARCHES ======================
If you ask for more than one search string, these are by default
ANDed together. The -o flag makes them ORed together. For example:
$ perldata -pi typeglob variable
Prints only those paragraphs that case-insensitively contain both
"typeglob" AND "variable". With the -o flag, you get those
with either of them.
$ perldata -opi typeglob variable
GREP OPTIONS:
Definitely:
-i case-insensitive using (?i)
-w whole words only using \bPAT\b, presuming P and T are
word-chars.
-l list filenames matching, but not matches
Maybe: (but these tend to conflict)
-e EXPR for patterns beginning with -?
-c just show count of matches
-o always show filename (conflicts with -o above)
-h hide filenames
-n show recnos (but this is the default!)
-x exact matches only, so nothing else on line; eg,
perlsub -x BUGS to find just the BUGS section,
not any section with "BUGS" in the name.
For example
$ perldata -ai typeglob
This searches perldata for any lines (the -a flag) that match
"typeglob" case-insensitively (the -i flag).
=============== MULTIPLE PAGES AND METAPAGES ============
You can search multiple pages at once explicitly using a comma
separated pagelist:
$ perlman -i perlsub,perldata variables
That does a case-insensitive section-search against those
two manpages.
or by a "metapage" specification. For example, the "perlfaq" metapage
is really all the stanard perlfaq? manpages.
$ perlfaq -w round
is the same as
$ perlman -w perlfaq1,perlfaq2,perlfaq3,perlfaq4,perlfaq5,perlfaq6,perlfaq7,perlf
aq8,perlfaq9 round
But much easier to type.
Some metapages also set or clear specific flags, usually change the
default search mode (which is section search) into something else.
Metapage Meaning
perlhelp All standard Perl manpages, with -a (line mode).
perlfaq All perlfaq? manpages.
perltoc All standard manpages, with -L (outline mode).
stdmods All CORE module manpages, with -a flag.
modpods All module manpages, with -a flag.
sitemods All non-CORE (site) module manpages, with -a flag.
These can be used with non-searches also. If no search is provided
with a metabase, the -l is assumed to list out what files they are
consulting, as in:
$ sitepods
(Lists all the modules in your sitelib directories)
The module-related metapages all have to run a find (well, its perl equivalent)
on the relevant directories. There is no central database, nor is it all
in one place.
+--------------------------------------------------------------------------+
| =============== HOOKS FROM perlman INTO OTHER PROGRAMS ================= |
+--------------------------------------------------------------------------+
+-------------------------+
| podgrep - grep the pods |
+-------------------------+
This is a regular search (pod-section search as described below
be default, but with the other search modes enabled by flags.)
$ podgrep `podpath manpage` pattern
$ podgrep /full/path pattern
$ perlman manpage pattern
$ manpage pattern
+----------------------------------+
| docpath - show paths to docpages |
+----------------------------------+
The "docpath" program can be invoked as "perlman -l" if no search
is given. The "podpath" program, which doesn't include manpages,
is the same as "perlman -lt", where the -t flag makes it only think
about pod2textual bits.
On manpages:
$ docpath perlfunc
$ perlfunc -l
$ perlman -l perlfunc
/usr/local/man/man1/perlfunc.1
/usr/local/lib/perl5/5.6.0/pod/perlfunc.pod
$ podpath perlfunc
$ perlfunc -lt
$ perlman -lt perlfunc
/usr/local/lib/perl5/5.6.0/pod/perlfunc.pod
On modules:
$ docpath LWP
$ perlman -l LWP
/usr/local/man/man3/LWP.3
/usr/local/lib/perl5/site_perl/5.6.0/LWP.pm
/usr/local/lib/perl5/site_perl/5.00554/LWP.pm
On programs:
$ docpath perlbug
$ perlman -l perlbug
/usr/local/man/man1/perlbug.1
/usr/local/bin/perlbug
/usr/bin/perlbug
Alternative invocations work as follows (this is really all the
same program). These are also all available as functions from the
PM::Tools::podpath module. If called as functions, then all paths
are returned in list context, but just the first found in scalar
context, which short-circuits the first. The program versions show
all paths; see pmpath(1) below for more details.
The docpath program means pod2manpath + podpath (that is, paths
to the manpages plus the podpages)
The podpath program means stdpodpath + pmpodpath + progpodpath
(that is, just podpages)
use PM::Tools qw/podpath/; # imports podpath only
use PM::Tools::podpath; # imports podpath only
use PM::Tools::podpath /:ALL/; # imports all podpath tools
stdpodpath("perlfunc") => /usr/local/perl/lib/pod/perlfunc.pod
pmpodpath("CGI") => /usr/local/perl/lib/CGI.pm
pmpodpath("POSIX") => /usr/local/lib/perl5/5.6.0/OpenBSD.i386-openbsd/POSIX.pod
progpodpath("perlbug") => /usr/local/perl/bin/perlbug
pod2manpath("perlfunc") => /usr/local/man/man1/perlfunc.1
pod2manpath("CGI") => /usr/local/perl/man/man3/CGI.3
+------------------------------------+
| pmpath - find path to perl modules |
+------------------------------------+
If you just want the path to the module, not its documentation,
use "pmpath". The podpath functions/programs will prefer a ".pod"
over a ".pm", and they will open up programs to search for pods.
This only cares about modules.
As the pmpath(1) program
$ pmpath POSIX
/usr/local/lib/perl5/5.6.0/OpenBSD.i386-openbsd/POSIX.pm
$ pmpath IO::Socket
/usr/local/lib/perl5/5.6.0/OpenBSD.i386-openbsd/IO/Socket.pm
$ pmpath LWP
/usr/local/lib/perl5/site_perl/5.6.0/LWP.pm
/usr/local/lib/perl5/site_perl/5.00554/LWP.pm
$ pmpath CGI LWP
CGI: /usr/local/lib/perl5/5.6.0/CGI.pm
LWP: /usr/local/lib/perl5/site_perl/5.6.0/LWP.pm /usr/local/lib/perl5/site_perl/5
.00554/LWP.
pm
$ pmpath -I/some/dir MyMod
/some/Dir/MyMod.pm
Or, as a module; first load module:
use PM::Tools qw(pmpath);
use PM::Tools::pmpath; # this form imports pmpath
Then in scalar context:
my $path = pmpath("CGI");
Or in list context:
my @paths = pmpath("LWP");
+--------------------------------+
| catpod - cat out just the pods |
+--------------------------------+
This program produces just the unformatted pods, but not the
non-pod which will be filtered out, from a file. If an absolute
path is given, that will be the literal filename. Otherwise,
a podpath() search will be run to find the real path.
Thus,
$ catpod CGI
is really
$ catpod `podpath CGI`
is really
$ catpod /usr/local/lib/perl5/5.6.0/CGI.pm
And, since this is the "perlman -u" unformatted flag, the same as:
$ perlman -u CGI
+--------------------------+
| ol - display pod outline |
+--------------------------+
(Should this be called olpod or podol instead?)
These are all (presumably) equivalent:
$ ol /usr/local/lib/perl5/5.6.0/pod/perlsub.pod
$ ol `podpath perlsub`
$ ol perlsub
$ perlsub -O
$ perlman -O perlsub
The "ol" program prints the pod outline for the given file.
If the file is not absolute, podpath() will be used to find
it, as shown above.
$ ol -2 perlsub
You may specify a max level to display, so -1 would be only
=head1, -2 would be no lower than =head2, etc. =items are
considered to be of the ninth level.
The ol program can also be invoked as "perlman -L" or
eg "perlman -L2":
$ perlsub -L
$ perlman -L perlsub
$ perlsub -L2
$ perlman -L2 perlsub
Note that if you provide a search in conjunction with -L, you are
in "outline search" mode described above.
+------------------------------------------+
| pmcat - cat out complete module contents |
+------------------------------------------+
The pmcat locates the path to the named module and cats out the
complete contents (through your pager, probably, though). This is
different from catpod in that it doesn't select only pod, or in
fact, prefer pod if both .pod and .pm versions are available, as
with POSIX. The -U flag (for *really* unformatted) to perlman does
the same thing.
$ pmcat CGI
$ pmcat `pmpath CGI`
$ $PAGER /usr/local/lib/perl5/5.6.0/CGI.pm
$ perlman -U /usr/local/lib/perl5/5.6.0/CGI.pm
+-------------------------+
| other podpath funcprogs |
+-------------------------+
The PM::Tools::podpath module also supports the following
simple functions, which may be called as programs, too.
$ podlibdir
/usr/local/lib/perl5/5.6.0/pod
$ mandirs
/usr/local/man/man1
/usr/local/man/man3
$ pmanpath
/usr/local/man
========================================================
What about apropos and whatis (that is, perlman -k or perlman -f)?
Those are either easy or hard. If there's a whatis database in the
perl mandirs, then you just call native man. If not, it's rough,
and you really would need to run pretty slowly to do a manual apropos
on the pods. I suppose that "perlman -k foo" could be "perlhelp
-x NAME foo" or some such if you don't have a podful makewhatis to
build and install a podtree-specific database. But if you did,
then you should think hard about what else the database should hold.
------------------------------
Date: Mon, 30 Oct 2000 18:50:40 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Comparing two files
Message-Id: <39fdc2ff.1061$240@news.op.net>
Keywords: America, Slovakia, Stella, embryonic
In article <39fcf834.71fc$1ce@news.op.net>,
Mark-Jason Dominus <mjd@plover.com> wrote:
>This sort of thing comes up in the newsgroups too. A lot of people
>have a funny blind spot about doing everything in Perl and not calling
>any expternal programs. Like everything else, what is approrpiate
>depends on the circumstances.
Today I saw one of the best examples of this ever, on the front page
of perlmonks.org:
In the spirit of Perl, instead of doing something like
system ("<friendly neighborhood shutdown.exe with args here>");
is there a relatively straightforward Perl/Perlish way of
rebooting a local (i.e. the one I'm sitting at) NT workstation?
That is, use Perl modules, or Perl commands to accomplish the
same thing (without, of course, calling an external shutdown.exe
program)? Thanks in advance!
Isn't that amazing?
There was a time when calling
system ("<friendly neighborhood shutdown.exe with args here>");
would have been the 'relatively straightforward Perl/Perlist way of rebooting'.
Now I guess it is not considered 'Perlish' to use Perl to call an
external program. So much for 'glue language'!
------------------------------
Date: Mon, 30 Oct 2000 12:58:05 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Comparing two files
Message-Id: <39FDC4BD.FB905EFC@mail.uca.edu>
Tom Christiansen wrote:
>
> In article <slrn8vqfca.ac5.mgjv@martien.heliotrope.home>,
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> >Oh, come on, Tom. perldoc is perfectly useable for most beginning users
> >and many cursory uses of the documentation.
>
> It is not *merely* that we're talking about surpassingly nasty code
> that is slow to execute, a terror to read, and virtually impossible
> to extend, code that is replete with countless hacks and grave
> security bugs. ... If you have a version of perldoc on your system
> from a release prior to 5.6, you should immediately remove it.
Okay, Tom, this last sentence and the rest of your note imply (to me,
anyway) that you have rewritten (or at least have had a hand in
rewriting) perldoc in 5.6 to be, if not good, at least better. Since the
"supercited posting" you refer to later has not made it to the
newsserver I use, I can't be sure. If that _is_ the case, would you
please answer two questions:
1. Can one use this *new* perldoc with 5.005? and, if, so,
2. Where can I get it from, without having to grab all of 5.6 in the
process? (actually, this second part is optional)
Cameron
--
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu
------------------------------
Date: Mon, 30 Oct 2000 16:30:24 GMT
From: charlie.bursell@healthcare.com
Subject: Drawing a blank
Message-Id: <8tk7n0$no4$1@nnrp1.deja.com>
I must have gotten up on the wrong side today. I know I have done this
before, but I can't get it to work.
Given the string:
"foo boo~p~\n\n\n\nfoo boo~p~\n\n\n\nfoo\n"
I want to change it to:
"foo boo\nfoo boo\nfoo"
In other words, change ~p~ folowed by multiple newlines to a single
newline.
I would think this works:
perl -pi -e 's/~p~\n+/\n/g' <file>
But it doesn't. It removes the "~p~" but leaves the multple newlines.
I know I am doing something stupid. Can you help?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 30 Oct 2000 18:05:07 +0000
From: nobull@mail.com
Subject: Re: Drawing a blank
Message-Id: <u9snpenr1o.fsf@wcl-l.bham.ac.uk>
charlie.bursell@healthcare.com writes.
> Subject: Drawing a blank
> I must have gotten up on the wrong side today.
Does that explain your lazy/selfish subject line?
What about your ability to notice that this question has already been
asked and answered in the last week?
> I know I have done this
> before, but I can't get it to work.
>
> Given the string:
> "foo boo~p~\n\n\n\nfoo boo~p~\n\n\n\nfoo\n"
>
> I want to change it to:
> "foo boo\nfoo boo\nfoo"
>
> In other words, change ~p~ folowed by multiple newlines to a single
> newline.
>
> I would think this works:
> perl -pi -e 's/~p~\n+/\n/g' <file>
>
> But it doesn't. It removes the "~p~" but leaves the multple
> newlines.
perl -p processes a file a line at a time. There's no such thing as a
line containing multple newlines. One alternative is to process the
file as a single string:
perl -pi -e 'BEGIN { undef $/ }; s/~p~\n+/\n/sg' <file>
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 30 Oct 2000 14:46:27 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Encrypting cookies?
Message-Id: <39FD7BB4.3E801224@schaffhausen.de>
Steve schrieb:
>
> Hey folks,
> on some web pages I see them sending back cookies as follows:
>
> ASPSESSIONIDQQQQQQPD=ABGKBJFYJCLBAGMJHGACGAGH
>
> What do you need to use to achive such encryption. I know it is simple
> but that's all I need rather than making it too obvious.
That one doesnt look like its encrypted. Look at the key it includes:
asp sessionid. So the value is a session id which should be unique.
malte
--
$me = Person->new("Malte Ubl");
$me->comp ("Schaffhausen | Interactive");
$me->job ("Developer for web-based Applications");
$me->phone("+49 4121 472964");
$me->fax ("+49 4121 472938");
exit; # reference count = 0 -> $me->DESTROY
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 4762
**************************************