perldoc problem on linux

Z

Zhiliang Hu

I have a strange problem - recently I newly setup a linux server and
installed perl 5.8, and when I tried to use "perldoc" (such as
"perldoc DBI"), nothing happens except as if I issued "source .cshrc"
(some personalized login message passes), then it's ready to take next
command. However "perldoc" works normal for ~root (both accounts are
on "tcsh" shell). Where should I check to solve it?

PS:
My linux: version 2.4.21-20.ELsmp (gcc version 3.2.3 20030502)
(Red Hat Linux 3.2.3-42))

My perl: version: v5.8.5 built for i686-linux

Thanks in advance!

Zhiliang
 
J

Joe Smith

Zhiliang said:
I have a strange problem - recently I newly setup a linux server and
installed perl 5.8, and when I tried to use "perldoc" (such as
"perldoc DBI"), nothing happens except as if I issued "source .cshrc"
(some personalized login message passes), then it's ready to take next
command. However "perldoc" works normal for ~root (both accounts are
on "tcsh" shell). Where should I check to solve it?

Have you looked at the obvious?

linux% which perldoc
linux% echo $PATH

linux# which perldoc
linux# echo $PATH

-Joe
 
Z

Zhiliang Hu

Joe Smith said:
Have you looked at the obvious?

linux% which perldoc
linux% echo $PATH

linux# which perldoc
linux# echo $PATH

-Joe

Yes, I did - 'perldoc' is in /usr/local/bin/ and it is in both my and
~root's path. (I double checked them and I still got the same as
before).

Following commands work fine:
perloc -V
perldoc -h
perldoc NONEexist (this returns "No documentation found")
perldoc -l WWW::Search

but "perldoc WWW::Search" will show nothing but login prompts.

Zhiliang
 
J

James Willmore

On Wed, 10 Nov 2004 13:30:34 -0800, Zhiliang Hu wrote:

Yes, I did - 'perldoc' is in /usr/local/bin/ and it is in both my and
~root's path. (I double checked them and I still got the same as
before).

Following commands work fine:

but "perldoc WWW::Search" will show nothing but login prompts.

As a "quick fix", you could (since you're on a *nix box) try:
perldoc -t WWW::Search | less

If this works, then you can at least use perldoc until you hunt down the
cause of the problem.

HTH

Jim
 
A

Anno Siegel

James Willmore said:
On Wed, 10 Nov 2004 13:30:34 -0800, Zhiliang Hu wrote:



As a "quick fix", you could (since you're on a *nix box) try:
perldoc -t WWW::Search | less

If this works, then you can at least use perldoc until you hunt down the
cause of the problem.

What makes you think "perldoc -t" would work? My guess is it's a
permission problem that doesn't exist for root.

Anno
 
J

James Willmore

What makes you think "perldoc -t" would work? My guess is it's a
permission problem that doesn't exist for root.

I took it the poster at his word that the only thing he couldn't do was
view the documentation. I was under the impression that if you try to run
perldoc as root, then it would always issue an error message about it
being unsafe to run as root - regardless of what option. The error
mentioned in the OP was he tried to run perldoc to view documentation and
got nothing.

I agree that it might be a permission problem ... OTOH, if it's working
for an unprivileged user, it might be the pager setting for root. Trying
to run perldoc with the -t option might (dis)prove this. Besides, as I
mentioned, this was a temporary fix ... what does it hurt to try it and
find it doesn't work. :)

Jim
 
A

Anno Siegel

James Willmore said:
I took it the poster at his word that the only thing he couldn't do was
view the documentation. I was under the impression that if you try to run
perldoc as root, then it would always issue an error message about it
being unsafe to run as root - regardless of what option. The error
mentioned in the OP was he tried to run perldoc to view documentation and
got nothing.

I see. However, OP said it works for him(?) as root, but not as an
ordinary user. In such a case, I tend to check permissions first.

Otherwise I believe perldoc is root-safe now and the warning is gone.
(Yup, v3.13 is fine with root)

In any case, someone (Sean Burke, to give credit where credit is due)
has done a tremendous job of cleaning up the code. Perldoc used to be
a horror of a script -- I remember I tried to fix something minor once,
but had to give up because I couldn't make sure in reasonable time
that the fix wouldn't break something else. When I looked at it last
night I found a well-organized program, neatly divided up in modules.
It would be a joy to fix if I knew of anything that needed fixing.
I agree that it might be a permission problem ... OTOH, if it's working
for an unprivileged user, it might be the pager setting for root. Trying
to run perldoc with the -t option might (dis)prove this. Besides, as I
mentioned, this was a temporary fix ... what does it hurt to try it and
find it doesn't work. :)

There's certainly nothing wrong with trying it, I was just curious
what gave you the idea, given the symptoms.

Anno
 
Z

Zhiliang Hu

James Willmore's suggestion works: "perldoc -t WWW::Search | less" --
Returns normal ducumentation. 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?

Thanks and with best regards,

Zhiliang
 
J

James Willmore

(Please DON'T top-post - it's considered rude)
On Wed, 17 Nov 2004 06:21:50 -0800, Zhiliang Hu wrote:
James Willmore's suggestion works: "perldoc -t WWW::Search | less" --
Returns normal ducumentation. 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
documents.

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

Zhiliang Hu

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

Zhiliang
 
J

Joe Smith

Zhiliang said:
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
 
J

J. Gleixner

Zhiliang said:
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.
 
Z

Zhiliang Hu

James Willmore said:
(Please DON'T top-post - it's considered rude)
On Wed, 17 Nov 2004 06:21:50 -0800, Zhiliang Hu wrote:


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

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

Tad McClellan

Zhiliang Hu said:
I am sorry I didn't know the difference posting on top or bottom -


That is Part One of composing a followup.

Part Two is trimming the quoted text to just enough to provide
the context for the comments you are about to add.


See also:

http://web.presby.edu/~nnqadmin/nnq/nquote.html

I learn some custom here.


Trimming quoted material and interleaving comments following
the quoted text that the comment applies to is widely expected
in nearly all of Usenet, it is not particular to "here" in
this newsgroup.

Thanks Jim.


Thank *you* for simply changing how you post instead of the more
usual whining about it. Very refreshing!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top