LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 11-02-2006, 05:03 AM   #1
cyb0rg777
Member
 
Registered: Dec 2004
Location: ~
Distribution: Debian
Posts: 143
Blog Entries: 8

Rep: Reputation: 15
RTFM ? Where is TFM?


Simple question.I was trying to learn some perl and I need to know what library to use so I searched the web and found which libraries to use.Now I download the libraries and more man page documentation.I have the manuals somewhere on my system so I look all over for filenames similar to what I want.I spent almost an hour trying to find the manual that I could have spent RTFM .OK ,since I needed two modules I now need to find the second man page.Same problem,I learned nothing about how to find TFM.

What is the easiest way to find TFM?
 
Old 11-02-2006, 06:32 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 62
perl comes with it's own documentation tool, perldoc, although it's usual for regular manual pages to be generated and installed as well.

perldoc can be used to search for perl-specific documentation on your system. For example, to see the docs for HTML::Parser, you can just enter
Code:
perldoc HTML::Parser
You can also search for specific perl built-in functions, like this:
Code:
perldoc -f stat
Or you can search for keywords from the perl FAQ like this:
Code:
perldoc -q JAPH
If all that fails, look at the .pm module files themselves or .pod files in the same directory as the .pm files - they may contain pod tags which you can turn into a nice readable form using perldoc on the file, like this:
Code:
perldoc /usr/lib/perl5/HTML/Parser.pm
 
Old 11-02-2006, 07:15 AM   #3
cyb0rg777
Member
 
Registered: Dec 2004
Location: ~
Distribution: Debian
Posts: 143
Blog Entries: 8

Original Poster
Rep: Reputation: 15
Very helpful stuff there .I was looking for the ncurses perl module info .I don't even know what function are inside it.I used locate command because thats what I always us eto find files.I tried a bunch of searches.
locate perl-curses
locate perl-ncurse
locate curses
locate ncurses-perl
I finally found the man page named Curses ,with a capital C.How could I have saved all that time.I'm still looking for a network module www-perl or something like that.What is the quickest way to find it ,Please.

If there is a way to do it for man pages that would be very helpful because I use c sometimes too and I need to look up libraries and functions for c.

Last edited by cyb0rg777; 11-02-2006 at 07:25 AM.
 
Old 11-02-2006, 08:13 AM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 62
The short answer is that you have to know about the perl module naming scheme, which isn't very helpful.

Once you know that case comes into it, it's helpful to know that locate has an option -i, which makes it search in case-insensitive mode.

perldoc also has an option to turn off case sensitivity, also -i, and so does man.

The problem with all these methods is that you might not have the required module installed, in which case you won't find anything on your machine.

I would use two ways to search for modules which I don't have installed:
  1. My Linux distro's package management system. I use Ubuntu, so I can search the package system using a command like this:
    Code:
    apt-cache search perl |grep -i curses
    Distros with other package managers will have some similar search method.
  2. The CPAN website is probably the definitive site for finding out about perl modules. The modules search feature is very helpful. Once you know the module name, finding the documentation should be pretty straight forward.
 
Old 11-02-2006, 08:19 PM   #5
cyb0rg777
Member
 
Registered: Dec 2004
Location: ~
Distribution: Debian
Posts: 143
Blog Entries: 8

Original Poster
Rep: Reputation: 15
I found this perl script in the faq to find your .pm files.

Code:
#! /usr/bin/perl
use File::Find;
my @files;
find sub { push @files, $File::Find::name if -f _ && /\.pm$/ },
@INC;
print join "\n", @files;
print "\n";
It finds all my files but i still can't tell what they are.The library I was looking for was libwww-perl ,but the module file was named LWP.pm .So it was on the list but I didn't know what it was.I think I have just found a project I can work on to help me learn perl.To build an index of all man pages and search though them.Too bad they are in gz format it will make them harder to search.
 
Old 11-02-2006, 09:05 PM   #6
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 62
That perl script does more or less the same as this command from the shell:

Code:
find / -name \*.pm
...which is a little easier, but like we say in perl land, TMTOWTDI (there's more than one way to do it).

Opening .gz files is easy in perl - no need to unzip the files and re-zip them when you're done. You can open them like this:

Code:
open(MYGZFILE, "gunzip -c $filename|") || die "can't open $filename with gunzip: $!";
while (<MYGZFILE>) {
    print "Line from compressed file: $_";
}
close(MYGZFILE);
Perl is the best
 
  


Reply

Tags
perl


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TRENDnet TFM-560U (56K USB Modem) win32sux Linux - Hardware 1 04-13-2011 05:54 PM
tfm-560x external modem tsunami_imcool Linux - Hardware 3 02-18-2007 01:00 AM
ati problems (again), installing fglrx (and I've read TFM) rutgerw Ubuntu 3 06-17-2006 05:24 AM
TFM-PCIV92A 56k modem on Ubuntu. dr_zayus69 Linux - Hardware 1 03-12-2006 10:29 AM
Rtfm!!! acid_kewpie General 6 06-06-2002 08:47 PM


All times are GMT -5. The time now is 08:54 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration