perldoc under Mac OS 10.6.1

Hello, Guys

I am trying to use perldoc to read some doc of perl function on my mac. However no matter which function name I put after perldoc on Terminal, I got No documentation found for "perlfunc".

Should I install the perl docs by myself or I am missing something here?

Thanks

13 Inch Macbook Pro

Posted on Sep 19, 2009 8:19 PM

Reply
14 replies

Sep 19, 2009 8:41 PM in response to YeaSt2u

Do you get this much?


PERLDOC(1) Perl Programmers Reference Guide PERLDOC(1)
NAME
perldoc - Look up Perl documentation in Pod format.
SYNOPSIS
perldoc [-h] [-v] [-t] [-u] [-m] [-l] [-F] [-i] [-V] [-T] [-r] [-ddestination_file] [-oformatname]
[-MFormatterClassName] [-wformatteroption:value] [-nnroff-replacement] [-X] [-L language_code]
PageName|ModuleName|ProgramName
perldoc -f BuiltinFunction
perldoc -L it -f BuiltinFunction
perldoc -q FAQ Keyword
perldoc -L fr -q FAQ Keyword
See below for more description of the switches.
DESCRIPTION
perldoc looks up a piece of documentation in .pod format that is embedded in the perl installation
tree or in a perl script, and displays it via "pod2man | nroff -man | $PAGER". (In addition, if
running under HP-UX, "col -x" will be used.) This is primarily used for the documentation for the
perl library modules.
Your system may also have man pages installed for those modules, in which case you can probably just
use the man(1) command.
If you are looking for a table of contents to the Perl library modules documentation, see the perltoc
page.

Sep 19, 2009 9:35 PM in response to YeaSt2u

sprintf FORMAT, LIST
Returns a string formatted by the usual "printf" conventions of
the C library function "sprintf". See below for more details
and see sprintf(3) or printf(3) on your system for an
explanation of the general principles.

For example:

# Format number with up to 8 leading zeroes
$result = sprintf("%08d", $number);

# Round number to 3 digits after decimal point
$rounded = sprintf("%.3f", $number);

Perl does its own "sprintf" formatting‐‐it emulates the C
function "sprintf", but it doesn’t use it (except for floating‐
point numbers, and even then only the standard modifiers are
allowed). As a result, any non‐standard extensions in your
local "sprintf" are not available from Perl.

Unlike "printf", "sprintf" does not do what you probably mean
when you pass it an array as your first argument. The array is
given scalar context, and instead of using the 0th element of
the array as the format, Perl will use the count of elements in
the array as the format, which is almost never useful.

Perl’s "sprintf" permits the following universally‐known
conversions:

%% a percent sign
%c a character with the given number
%s a string
%d a signed integer, in decimal
%u an unsigned integer, in decimal
%o an unsigned integer, in octal
%x an unsigned integer, in hexadecimal
%e a floating−point number, in scientific notation
%f a floating−point number, in fixed decimal notation
%g a floating−point number, in %e or %f notation

In addition, Perl permits the following widely‐supported
conversions:

%X like %x, but using upper−case letters
%E like %e, but using an upper−case "E"
%G like %g, but with an upper−case "E" (if applicable)

-=-=-=-

Check your version and confirm your install is typical.

Sep 19, 2009 9:47 PM in response to K T

Thanks for the info on sprintf. However that is only one example. I even got "No documentation found for "perl"." for perldoc perl.


I checked perl -v and here is the output:

This is perl, v5.10.0 built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)

Copyright 1987-2007, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

Sep 19, 2009 9:56 PM in response to YeaSt2u

Well, you look spanky current version wise, I think. man should be working it seems, sorry. I'm assuming it works normally for other topics.

Again, I'd look to any non-default perl related installs/moves/paths/permissions etc. - routine stuff like repairing permissions, checking with a new test user account, dropping another quarter in the slot, perhaps. Can you SSH into that box and check from a remote account by any chance...

Sep 19, 2009 10:43 PM in response to YeaSt2u

YeaSt2u wrote:
I checked perl -v and here is the output:

...

This is perl, v5.10.0 built for darwin-thread-multi-2level
*Complete documentation for Perl, including FAQ lists, should be found on*
*this system using "man perl" or "perldoc perl"*. If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.



Did you try typing in *+perldoc perl+* ? If that comes up, it will give you the names of the different perl docs that are available. If you want the documentation for sprintf, you look in the perlfunc doc, by typing *+perldoc perlfunc+* and search for sprintf.

Oct 7, 2009 10:40 AM in response to YeaSt2u

The problem seems to be that the necessary pod files were not installed.

I happened to have the perl 5.8.9 source distribution on my machine, so I tried

sudo mkdir /System/Library/Perl/5.8.9/pods
sudo cp <perl-src-dir>/pod/*.pod /System/Library/Perl/5.8.9/pods

And now "perldoc perl", "perldoc -f xyz", etc., are back to working.

But it would be better to use the 5.10. distribution; I'll fetch that, and
try it next ...

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

perldoc under Mac OS 10.6.1

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.