APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

02/23/2003 10:14 AM Blogger

I've given up on Blogger (yes I did upgrade to Blogger Pro). It's just too buggy and inflexible for my needs. So, I've started writing my own code. I'll expand on this later and add all the automatic stuff I need, but for now it's just a sequentially numbered bunch of .dat files and a very simple program to create them.


#!/usr/bin/perl
chdir "/usr/home/pcunix/www/data/blog";
 #print "Content-TYPE: text/html\n\n<head>";
 run("header.pl /Blog/index.html");
 print "</head> <body bgcolor=\"#ffffff\">";
 run("body.pl");
 run("newad.pl");
 print "<h2>APLAWRENCE.COM BLOG</h2>";
$x=0; 
while(<?.dat>) { $x++; };
while ($x) {
$file="$x.dat";
open(X,"<$file") or $x=0;
next if not $x;
$date=<X>;
@lines=<X>;
print "<h4>$date</h4>\n";
print "<p><blockquote>@lines</blockquote>";
print "<hr>\n";
$x--;
}
print "</body></html>\n";

$now=time;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime($now);
@month=("January","February","March","April","May","June","July","August","September","October","November","December");
$year += 1900;
$AM="AM";
$AM="PM" if $hour > 12;
$hour -= 12 if $AM eq "PM";
$hms=sprintf("%.2d:%.2d:%.2d",$hour,$min,$sec);

$update="$month[$mon] $mday, $year $hms $AM";
open(OUT,">/usr/home/pcunix/apl/Blog/blogger_rss.xml") or die $!;
print OUT <<EOF;
<?xml version="1.0"?>
<rss version="0.91">
        <channel>
                <title>APLawrence's Unix/Linux and Mac OS X BLOG</title>
                <link>http://aplawrence.com/Blog/index.html</link>
                <description>Unix, Linux and Mac OS X information</description>
                <lastBuildDate>$update</lastBuildDate>
                <language>en-us</language>
        </channel>
</rss>
EOF
sub run {
@lines=`/usr/home/pcunix/www/cgi-bin/$_[0]`;
$lines[0]="";
print @lines;
}
 

I need to do a lot more, but this gets me started and away from Blogger's difficulties and limitations.



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> I've given up on Blogger




Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Tony Lawrence



Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





Doing linear scans over an associative array is like trying to club someone to death with a loaded Uzi. (Larry Wall)

Any sufficiently advanced technology is indistinguishable from magic. (Arthur C Clarke)







This post tagged: