Blog::Simple::HTMLOnly - Very simple weblog (blogger) with just Core modules.
my $blog = Blog::Simple::HTMLOnly->new(); $blog->create_index(); # generally only needs to be called once # # ... # my $content="<p>blah blah blah in XHTM</p><p><b>Better</b> when done in HTML!</p>"; my $title = 'some title'; my $author = 'a.n. author'; my $email = 'anaouthor@somedomain.net'; my $smmry = 'blah blah'; my $ctent = '<blockquote>Twas in the month of Liverpool and the city of July...</blockquote>', $blog->add($title,$author,$email,$smmry,$ctent); # # ... # my $format = { simple_blog_wrap => '<table width='100%'><tr><td>', simple_blog => '<div class="box">', title => '<div class="title"><b>', author => '<div class="author">', email => '<div class="email">', ts => '<div class="ts">', summary => '<div class="summary">', content => '<div class="content">', }; $blog->render_current($format,3); $blog->render_all($format); $blog->remove('08'); exit;
Please see the *.cgi files included in the tar distribution for examples of simple use.
Nothing outside of the core perl distribution.
Nothing.
This is a backwards-compatible modification of Blog::Simple by JA Robson <gilad@arbingersys.com>, indentical in all but the need for XML::XSLT and Perl 5.6.1. It also includes an additional method to render a specific blog, and the latest n blogs.
Blog::Simple
XML::XSLT
n
Instead of XML::XSLT, this module uses HTML::TokeParser, of the core distribution. Naturally formatting is rather restricted, but it can produce some useful results if you know your way around CSS (http://www.zvon.org), and is better than a poke in the eye with a sharp stick.
HTML::TokeParser
Please read the documentation for Blog::Simple before continuing, but ignore the documentation for the rendering methods.
The rendering methods render_current and render_all no longer take a paramter of an XSLT file, but instead a reference to a hash, the keys of which are the names of the nodes in a Blog::Simple XML file, values being HTML to wrap around the named node.
render_current
render_all
Only the opening tags need be supplied: the correct end-tags will supplied in lower-case by this module.
For an example, please see the SYNOPSIS.
As METHOD render_current but accepts a format hash, number of entries to display, an optional author ID, and optional output file.
METHOD render_current
Identical to render_all but takes an additional argument, that is the author ID.
Alias for render_this_blog.
render_this_blog
Renders to STDOUT the nominated blog(s).
STDOUT
In addition to the method's object reference, accepts a date and an author, and a format hash (see above). The date should be in a localtime output with spaces turned to underscores (_).
localtime
_
On success, returns a reference to the Blog in HTML. On failure returns undef, sending a warning to STDERR if you have warnings on (-w).
undef
STDERR
warnings
-w
The only other things I've changed are:
All files flock if not running on Win32 (cygwin is ignored as I don't know if it needs it; presumably it does, though).
flock
The render routines return a reference to a scalar, which is the formatted HTML.
-item *
for loops simplified.
for
See Blog::Simple, HTML::TokeParser.
Lee Goddard (lgoddard -at- cpan -dot- org), Most of the work already done by J. A. Robson, <gilad@arbingersys.com>
This module: Copyright (C) Lee Goddard, 2003, and J. A. Robson. All Rights Reserved. Made available under the same terms as Perl itself.
To install Blog::Simple::HTMLOnly, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Blog::Simple::HTMLOnly
CPAN shell
perl -MCPAN -e shell install Blog::Simple::HTMLOnly
For more information on module installation, please visit the detailed CPAN module installation guide.