> Programming Languages > Perl
Various Topics Home

Perl



Perl Programming Languages perldoc problem on linux


Default Re: perldoc problem on linux

Zhiliang Hu wrote:
> All those 3 works:
>
> perldoc -t GD | less
> perldoc -t GD | more
> perldoc -t GD | nroff
>
> but not this one (seen as I described earlier):
>
> perldoc -t GD


That's because perldoc does something different when output goes
to a tty versus being piped to a program.
When being piped to a program, the text is sent to STDOUT as is.
When -t STDOUT is true, it checks the environment variables
PERLDOC_PAGER and PAGER (in that order) before trying 'more' or 'less'.

echo "PAGER=$PAGER PERLDOC_PAGER=$PERLDOC_PAGER"
ls -l $PAGER; ls -l $PERLDOC_PAGER

setenv PAGER less # csh, tcsh
export PAGER=less # bash
perldoc perldoc
Default Re: perldoc problem on linux

Zhiliang Hu wrote:
> All those 3 works:
>
> perldoc -t GD | less
> perldoc -t GD | more
> perldoc -t GD | nroff
>
> but not this one (seen as I described earlier):
>
> perldoc -t GD
>
> I wonder which file/folder I should look at to "check permissions" as
> Anno suggested? (I found all perl related man pages are in
> /usr/share/man/man1 or man3, to which permissions are allowed for all
> users, i.e. 755 or 644 for folders or files respectively).


Maybe try setting your PERLDOCDEBUG environment variable, and then
running perldoc.

My version of perldoc contains:

BEGIN { $^W = 1 if $ENV{'PERLDOCDEBUG'} }

which might give more verbose output.
Default Re: perldoc problem on linux

James Willmore <> wrote in message news:<>. ..
> (Please DON'T top-post - it's considered rude)
> On Wed, 17 Nov 2004 06:21:50 -0800, Zhiliang Hu wrote:
> <snip>
> > James Willmore's suggestion works: "perldoc -t WWW::Search | less"

> --
> > Returns normal duentation. However, without "less" it still returns
> > nothing except login prompt (i.e. "perldoc -t WWW::Search").
> >
> > I don't seem to comprehend where the problem is (is "pager" a utility to
> > dispaly text like "less"/"more"?), could you suggest further?

>
> If you're on a *nix system, there is an environment setting for which
> pager (more, less, some other paging application) to use for viewing
> doents.
>
> To find out if this variable is set, type:
> echo $PAGER
>
> If you get just the command line back, this setting is missing and *may*
> cause a problem with viewing Perl doentation. To set the variable to
> something "sane", type:
> (for BASH)
> export PAGER=`which less`
> (for CSH - I think ... I always seem to mess up the syntax because I try
> to avoid using C-Shell)
> setenv PAGER `which less`
>
> This sets the environment variable to use `less` as your pager.
>
> If this environment setting *is* set, then I'm not real sure what's going
> on :-( My thinking is to check your permissions again - just to be sure.
> On my system, they are set to ...
>
> -r-xr-xr-x 1 root root 203 Oct 17 00:15 /usr/bin/perldoc
>
> Past these directions, I'm not sure what else might be going on.
>
> HTH
>
> Jim


I am sorry I didn't know the difference posting on top or bottom -
I learn some custom here. Thanks Jim.

Here is what I did:

1.
UNIX> echo $PAGER
PAGER: Undefined variable. (1st glitch seems to be here)

2.
Put in my .cshrc: "setenv PAGER less" and sourced it.
=> "perldoc WWW::Search" still produced nothing but login prompt.
Same with full path "setenv PAGER /usr/bin/less", while I see
-rwxr-xr-x 1 root root 131724 Sep 1 2003 /usr/bin/less

3.
I then tried to use "less" to see a file:
UNIX> less my_txt_file
=> it shows nothing but login prompt :0 (2nd glitch seems to be here)

But why "perldoc WWW:Search -t | less" works? Hmm.. Interesting.

4.
Put in my .cshrc: "setenv PAGER more"
=> Now it works fine.

Thanks everyone for great helps and I appreciate this learning curve.
Something more to learn...

Zhiliang

« the antichomp | - »
Thread Tools
Display Modes





Powered by vBulletin®
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0