News::Search - Usenet news searching toolkit
use News::Search; my $ns = News::Search->new(); $ns->search_for(\@ARGV); my %newsarticles = $ns->SearchNewsgroups;
News::Search searches Usenet news postings.
It can be used to search local news groups that google doesn't cover. Or, even for news groups that are covered by google, it can give you all the hits in one file, in the format that you prescribed.
You can also use the provided news-search in cron to watch specific news groups for specific criteria and mail you reports according to the interval you set.
Initialize the object.
my $searcher = News::Search->new();
or,
my $searcher = News::Search->new( {} );
which are the same as:
my $searcher = News::Search->new( { nntp_server => 'news', msg_headers => 'Date|From', # + Subject, which is always printed msg_limit => 200, verbose => 0, on_group => \&default_group_handler, on_message => \&default_message_handler, } );
What shown above are default settings. Any of the %config_param attribute can be omitted when calling the new method.
%config_param
The new is the only class method. All the rest methods are object methods.
new
The following object attributes are accessible.
nntp_server([set_val])
The nntp server to search.
msg_headers([set_val])
Message headers to print.
msg_limit([set_val])
Maximum number of posts to search (not return).
verbose([set_val])
Be verbose.
on_group([set_val])
Handler for group starts. Refer to news-search for the example.
on_message([set_val])
Handler for news message. Refer to news-search for the example.
Provide the set_val to change the attribute, omitting it to retrieve the attribute value. E.g.,
set_val
$searcher->nntp_server("news.easysw.com");
$searcher->search_for(\@ARGV);
Command line parameter handling. Refer to news-search section "command line arguments" for details.
Search the given newsgroups with the given criteria:
my %newsarticles = $ns->SearchNewsgroups; foreach my $article (values %newsarticles) { # deal with $article->{"SUBJECT"}, @{$article->{"HEADER"}}) # and $article->{"BODY"} }
Refer to news-search for usage example.
Net::NNTP.
Please report any bugs or feature requests to bug-news-search at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=News-Search. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-news-search at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc News::Search
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=News-Search
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/News-Search
CPAN Ratings
http://cpanratings.perl.org/d/News-Search
Search CPAN
http://search.cpan.org/dist/News-Search/
SUN, Tong <suntong at cpan.org> http://xpt.sourceforge.net/
<suntong at cpan.org>
Copyright 2003-2008 Tong Sun, all rights reserved.
This program is released under the BSD license.
To install News::Search, copy and paste the appropriate command in to your terminal.
cpanm
cpanm News::Search
CPAN shell
perl -MCPAN -e shell install News::Search
For more information on module installation, please visit the detailed CPAN module installation guide.