Blog-Simple-HTMLOnly
view release on metacpan or search on metacpan
=head1 USE
blog.cgi - display the current blog
blog.cgi?x - where 'x' is anything: add a blog
blog.cgi?all=1&author=y - display all the blogs of author 'y'
blog.cgi?date=x&author=y - where 'x' and 'y' are a timestamp
and an author name: shows that blog
...&template=false - do not use the template
If the template is used, it should be HTML with a comment <!-- insert ---> where
the calendar is to go.
Copyright (C) 2003, Lee Goddard (lgoddard -at- cpan -dot- org)
All Rights Reserved. Available under the same terms as Perl.
=cut
my $VERSION = 0.3;
use CGI::Carp qw(fatalsToBrowser);
use strict;
blogcal.cgi view on Meta::CPAN
#! /usr/bin/perl
#
# Use:
# blogcal.cgi?author=x - print blog calendar for author x
#
# Copyright (C) 2003, Lee Goddard (lgoddard -at- cpan -dot- org)
# All Rights Reserved. Available under the same terms as Perl.
#
my $VERSION = 0.2;
use strict;
use CGI::Carp qw(fatalsToBrowser);
use Blog::Simple::HTMLOnly;
blogcal.cgi view on Meta::CPAN
$TITLE = 'Moaning and Groaing at the Edge of ...';
}
if ($cgi->param('template') and $cgi->param('template') eq 'false'){
print $cgi->header;
$ENV{QUERY_STRING} = "";
} else {
&print_header
}
&print_calendar;
&print_footer unless $cgi->param('template') and $cgi->param('template') eq 'false';
exit;
sub print_header {
local (*IN,$_);
open IN,$TEMPLATE_PATH or die "Could not open $TEMPLATE_PATH from ".cwd;
read IN,$_,-s IN;
close IN;
($TEMPLATE_TOP,$TEMPLATE_BOTTOM) = /^(.*)<!--\sinsert.*?-->(.*)$/sig;
$TEMPLATE_TOP =~ s/<\s*title\s*>.*?<\/\s*title\s*>/<title>Moaning and Groaing at the Edge of ...<\/title>/si;
print $cgi->header, $TEMPLATE_TOP;
}
sub print_footer { print $TEMPLATE_BOTTOM }
sub print_calendar {
local (*DIR, @_, $_);
my $done;
my $author = $cgi->param('author') || "Lee";
my $cal = HTML::Calendar::Simple->new;
$_ = scalar localtime;
my @date = split/\s+/,$_;
chdir $blogger->{blog_base};
opendir DIR, "." or die "No blog base dir";
@_ = grep { -d && /^\w{3}_+$date[1].*?$date[4]_\Q$author\E$/ } readdir DIR;
blogcal.cgi view on Meta::CPAN
font-size:8px;
font-family: Verdana, Arial, Helvetica, sans
}
.cal td, .cal h3 { font-size: 8px; padding:0; margin:0;}
.cal h3 { font-size: 10px; }
.cal td { padding: 2px; text-align:right}
.cal th { font-size: 8px; border:none; padding: 1px}
</style>
<div class='cal'>
";
print $cal->calendar_month;
print "
</div>
"
}
( run in 0.524 second using v1.01-cache-2.11-cpan-39bf76dae61 )