|
From: <ik...@us...> - 2009-09-07 01:56:14
|
Revision: 53
http://webfetch.svn.sourceforge.net/webfetch/?rev=53&view=rev
Author: ikluft
Date: 2009-09-07 01:55:58 +0000 (Mon, 07 Sep 2009)
Log Message:
-----------
docs update
Modified Paths:
--------------
branches/v0.13/lib/WebFetch/Input/Atom.pm
branches/v0.13/lib/WebFetch/Input/RSS.pm
branches/v0.13/lib/WebFetch/Output/Dump.pm
branches/v0.13/lib/WebFetch/Output/TWiki.pm
branches/v0.13/lib/WebFetch.pm
Modified: branches/v0.13/lib/WebFetch/Input/Atom.pm
===================================================================
--- branches/v0.13/lib/WebFetch/Input/Atom.pm 2009-09-07 01:55:06 UTC (rev 52)
+++ branches/v0.13/lib/WebFetch/Input/Atom.pm 2009-09-07 01:55:58 UTC (rev 53)
@@ -19,12 +19,56 @@
use Exception::Class (
);
+=head1 NAME
+
+WebFetch::Input::Atom - WebFetch input from Atom feeds
+
+=head1 SYNOPSIS
+
+This is an input module for WebFetch which accesses an Atom feed.
+The --source parameter contains the URL of the feed.
+
+From the command line:
+
+C<perl -w -MWebFetch::Input::Atom -e "&fetch_main" -- --dir directory
+ --source atom-feed-url [...WebFetch output options...]>
+
+In perl scripts:
+
+ use WebFetch::Input::Atom;
+
+ my $obj = WebFetch->new(
+ "dir" => "/path/to/fetch/workspace",
+ "source" => "http://search.twitter.com/search.atom?q=%23twiki",
+ "source_format" => "atom",
+ "dest" => "dump",
+ "dest_format" = "/path/to/dump/file",
+ );
+ $obj->do_actions; # process output
+ $obj->save; # save results
+
+
+=head1 DESCRIPTION
+
+This module gets the current headlines from a site-local file.
+
+The I<--input> parameter specifies a file name which contains news to be
+posted. See L<"FILE FORMAT"> below for details on contents to put in the
+file. I<--input> may be specified more than once, allowing a single news
+output to come from more than one input. For example, one file could be
+manually maintained in CVS or RCS and another could be entered from a
+web form.
+
+After this runs, the file C<site_news.html> will be created or replaced.
+If there already was a C<site_news.html> file, it will be moved to
+C<Osite_news.html>.
+
+=cut
+
+
our @Options = ();
our $Usage = "";
-# configuration parameters
-our $num_links = 5;
-
# no user-servicable parts beyond this point
# register capabilities with WebFetch
@@ -35,15 +79,6 @@
{
my ( $self ) = @_;
- # set parameters for WebFetch routines
- if ( !defined $self->{num_links}) {
- $self->{num_links} = $WebFetch::Input::Atom::num_links;
- }
- if ( !defined $self->{style}) {
- $self->{style} = {};
- $self->{style}{para} = 1;
- }
-
# set up Webfetch Embedding API data
$self->{data} = {};
$self->{data}{fields} = [ "id", "updated", "title", "author", "link",
@@ -118,36 +153,6 @@
__END__
# POD docs follow
-=head1 NAME
-
-WebFetch::Input::Atom - download and save an Atom feed
-
-=head1 SYNOPSIS
-
-In perl scripts:
-
-C<use WebFetch::Input::Atom;>
-
-From the command line:
-
-C<perl -w -MWebFetch::Input::Atom -e "&fetch_main" -- --dir directory
- --source atom-feed-url [...WebFetch output options...]>
-
-=head1 DESCRIPTION
-
-This module gets the current headlines from a site-local file.
-
-The I<--input> parameter specifies a file name which contains news to be
-posted. See L<"FILE FORMAT"> below for details on contents to put in the
-file. I<--input> may be specified more than once, allowing a single news
-output to come from more than one input. For example, one file could be
-manually maintained in CVS or RCS and another could be entered from a
-web form.
-
-After this runs, the file C<site_news.html> will be created or replaced.
-If there already was a C<site_news.html> file, it will be moved to
-C<Osite_news.html>.
-
=head1 Atom FORMAT
Atom is an XML format defined at http://atompub.org/rfc4287.html
Modified: branches/v0.13/lib/WebFetch/Input/RSS.pm
===================================================================
--- branches/v0.13/lib/WebFetch/Input/RSS.pm 2009-09-07 01:55:06 UTC (rev 52)
+++ branches/v0.13/lib/WebFetch/Input/RSS.pm 2009-09-07 01:55:58 UTC (rev 53)
@@ -19,6 +19,12 @@
use Exception::Class (
);
+=head1 NAME
+
+WebFetch::Input::RSS - download and save an RSS feed
+
+=cut
+
our @Options = ();
our $Usage = "";
@@ -29,6 +35,19 @@
# register capabilities with WebFetch
__PACKAGE__->module_register( "input:rss" );
+=head1 SYNOPSIS
+
+In perl scripts:
+
+C<use WebFetch::Input::RSS;>
+
+From the command line:
+
+C<perl -w -MWebFetch::Input::RSS -e "&fetch_main" -- --dir directory
+ --source rss-feed-url [...WebFetch output options...]>
+
+=cut
+
# called from WebFetch main routine
sub fetch
{
@@ -150,42 +169,10 @@
}
}
-#---------------------------------------------------------------------------
-
-#
-# utility functions
-#
-
-# generate a printable version of the datestamp
-sub printstamp
-{
- my ( $stamp ) = @_;
- my ( $year, $mon, $day ) = ( $stamp =~ /^(....)(..)(..)/ );
-
- return Month_to_Text(int($mon))." ".int($day).", $year";
-}
-
-#---------------------------------------------------------------------------
-
1;
__END__
# POD docs follow
-=head1 NAME
-
-WebFetch::Input::RSS - download and save an RSS feed
-
-=head1 SYNOPSIS
-
-In perl scripts:
-
-C<use WebFetch::Input::RSS;>
-
-From the command line:
-
-C<perl -w -MWebFetch::Input::RSS -e "&fetch_main" -- --dir directory
- --source rss-feed-url [...WebFetch output options...]>
-
=head1 DESCRIPTION
This module gets the current headlines from a site-local file.
Modified: branches/v0.13/lib/WebFetch/Output/Dump.pm
===================================================================
--- branches/v0.13/lib/WebFetch/Output/Dump.pm 2009-09-07 01:55:06 UTC (rev 52)
+++ branches/v0.13/lib/WebFetch/Output/Dump.pm 2009-09-07 01:55:58 UTC (rev 53)
@@ -20,7 +20,12 @@
use Exception::Class (
);
+=head1 NAME
+WebFetch::Output::Dump - save data in a Perl structure dump
+
+=cut
+
# set defaults
our ( @url, $cat_priorities, $now, $nowstamp );
@@ -35,23 +40,6 @@
# register capabilities with WebFetch
__PACKAGE__->module_register( "output:dump" );
-# Perl structure dump format handler
-sub fmt_handler_dump
-{
- my ( $self, $filename ) = @_;
-
- $self->raw_savable( $filename, Dumper( $self->{data}));
- 1;
-}
-
-1;
-__END__
-# POD docs follow
-
-=head1 NAME
-
-WebFetch::Output::Dump - save data in a Perl structure dump
-
=head1 SYNOPSIS
In perl scripts:
@@ -65,10 +53,30 @@
=head1 DESCRIPTION
-This module gets the current news headlines from a site-local file.
+This is an output module for WebFetch which simply outputs a Perl
+structure dump from C<Data::Dumper>. It can be read again by a Perl
+script using C<eval>.
-TODO: add description
+=item $obj->fmt_handler_dump( $filename )
+This function dumps the data into a string for saving by the WebFetch::save()
+function.
+
+=cut
+
+# Perl structure dump format handler
+sub fmt_handler_dump
+{
+ my ( $self, $filename ) = @_;
+
+ $self->raw_savable( $filename, Dumper( $self->{data}));
+ 1;
+}
+
+1;
+__END__
+# POD docs follow
+
=head1 AUTHOR
WebFetch was written by Ian Kluft
Modified: branches/v0.13/lib/WebFetch/Output/TWiki.pm
===================================================================
--- branches/v0.13/lib/WebFetch/Output/TWiki.pm 2009-09-07 01:55:06 UTC (rev 52)
+++ branches/v0.13/lib/WebFetch/Output/TWiki.pm 2009-09-07 01:55:58 UTC (rev 53)
@@ -54,7 +54,7 @@
=head1 NAME
-WebFetch::Output::TWiki - The great new WebFetch::Output::TWiki!
+WebFetch::Output::TWiki - WebFetch output to TWiki web site
=cut
@@ -72,19 +72,32 @@
=head1 SYNOPSIS
-Quick summary of what the module does.
+This is an output module for WebFetch which places the data in pages
+on a TWiki web site. Some of its configuration information is read from
+a TWiki page. Calling or command-line parameters point to the TWiki page
+which has the configuration and a search key to locate the correct line
+in a table.
-Perhaps a little code snippet.
+From the command line...
- use WebFetch::Output::TWiki;
+ perl -w -I$libdir -MWebFetch::Input::Atom -MWebFetch::Output::TWiki -e "&fetch_main" -- --dir "/path/to/fetch/worskspace" --source "http://search.twitter.com/search.atom?q=%23twiki" --dest=twiki --twiki_root=/var/www/twiki --config_topic=Feeds.WebFetchConfig --config_key=twiki
- my $foo = WebFetch::Output::TWiki->new();
- ...
+From Perl code...
-=head1 EXPORT
+ use WebFetch;
-A list of functions that can be exported. You can delete this section
-if you don't export anything, such as for a purely object-oriented module.
+ my $obj = WebFetch->new(
+ "dir" => "/path/to/fetch/workspace",
+ "source" => "http://search.twitter.com/search.atom?q=%23twiki",
+ "source_format" => "atom",
+ "dest" => "twiki",
+ "dest_format" = "twiki",
+ "twiki_root" => "/var/www/twiki",
+ "config_topic" => "Feeds.WebFetchConfig",
+ "config_key" => "twiki",
+ );
+ $obj->do_actions; # process output
+ $obj->save; # save results
=head1 FUNCTIONS
@@ -348,10 +361,24 @@
1;
}
+=head1 TWiki software
+TWiki is a wiki (user-editable web site) with features enabling
+collaboration in an enterprise environment.
+It implements the concept of a "structured wiki", allowing structure
+and automation as needed and retaining the informality of a wiki.
+Automated input/updates such as from WebFetch::Output::TWiki is one example.
+
+See http://twiki.org/ for the Open Source community-maintained software
+or http://twiki.net/ for enterprise support.
+
+WebFetch::Output::TWiki was developed for TWiki Inc (formerly TWiki.Net).
+
=head1 AUTHOR
-Ian Kluft, C<< <ikluft at cpan.org> >>
+WebFetch was written by Ian Kluft
+Send patches, bug reports, suggestions and questions to
+C<ma...@we...>.
=head1 BUGS
@@ -359,50 +386,17 @@
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WebFetch-Output-TWiki>. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
+=head1 SEE ALSO
+=for html
+<a href="WebFetch.html">WebFetch</a>
+=for text
+WebFetch
-=head1 SUPPORT
+=for man
+WebFetch
-You can find documentation for this module with the perldoc command.
-
- perldoc WebFetch::Output::TWiki
-
-
-You can also look for information at:
-
-=over 4
-
-=item * RT: CPAN's request tracker
-
-L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=WebFetch-Output-TWiki>
-
-=item * AnnoCPAN: Annotated CPAN documentation
-
-L<http://annocpan.org/dist/WebFetch-Output-TWiki>
-
-=item * CPAN Ratings
-
-L<http://cpanratings.perl.org/d/WebFetch-Output-TWiki>
-
-=item * Search CPAN
-
-L<http://search.cpan.org/dist/WebFetch-Output-TWiki/>
-
-=back
-
-
-=head1 ACKNOWLEDGEMENTS
-
-
-=head1 COPYRIGHT & LICENSE
-
-Copyright 2009 Ian Kluft, all rights reserved.
-
-This program is free software; you can redistribute it and/or modify it
-under the same terms as Perl itself.
-
-
=cut
1; # End of WebFetch::Output::TWiki
Modified: branches/v0.13/lib/WebFetch.pm
===================================================================
--- branches/v0.13/lib/WebFetch.pm 2009-09-07 01:55:06 UTC (rev 52)
+++ branches/v0.13/lib/WebFetch.pm 2009-09-07 01:55:58 UTC (rev 53)
@@ -375,10 +375,7 @@
# This eliminates the need for the sub-packages to export their own
# fetch_main(), which users found conflicted with each other when
# loading more than one WebFetch-derived module.
-=head2 eval_wrapper ( $code, $throw_func, [ name => value, ...] )
-=cut
-
# fetch_main - eval wrapper for fetch_main2 to catch and display errors
sub main::fetch_main
{
@@ -534,12 +531,18 @@
}
}
-=item Do not use the new() function directly from WebFetch.
+=item $obj = WebFetch::new( param => "value", [...] )
-I<Use the C<new> function from a derived class>, not directly from WebFetch.
-The WebFetch module itself is just infrastructure for the other modules,
-and contains none of the details needed to complete any specific fetches.
+Generally, the new function should be inherited and used from a derived
+class. However, WebFetch provides an AUTOLOAD function which will catch
+wayward function calls from a subclass, and redirect it to the appropriate
+function in the calling class, if it exists.
+The AUTOLOAD feature is needed because, for example, when an object is
+instantiated in a WebFetch::Input::* class, it will later be passed to
+a WebFetch::Output::* class, whose data method functions can be accessed
+this way as if the WebFetch object had become a member of that class.
+
=cut
# allocate a new object
@@ -564,7 +567,8 @@
=item $obj->init( ... )
-This is called from the C<new> function of all WebFetch modules.
+This is called from the C<new> function that modules inherit from WebFetch.
+If subclasses override it, they should still call it before completion.
It takes "name" => "value" pairs which are all placed verbatim as
attributes in C<$obj>.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|