develooper Front page | perl.perl5.porters | Postings from September 2000

Simple demos of search the perl docset

From:
Tom Christiansen
Date:
September 5, 2000 08:56
Subject:
Simple demos of search the perl docset
Message ID:
18049.968169351@chthon
I wrote:

>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.  

And if you *haven't* read it, 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.

--tom



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About