CMSms Hacking

Perl module to allow you to import content into CMSms

Script to import an rss xml file into the CMSms news module

Home » Projects » CMSms Hacking

CMSms Perl Module

I've finally migrated away from my template driven website (which explains why a lot of links are broken), but it has the added benefit of allowing me to edit content more easily. I didn't want to do any copy and paste (which wouldn't have taken me that long), so I spent the better part of a day writing code to import content from my old template system to CMSms. My import system consists of two parts - a generic perl module (or set of modules) which do the import, and another application which reads my templates. Anyone should be able to use the module with some glue code to import content and links. Here's an example of how you would use the module

use CMSms;
my $c = new CMSms( username => 'user', password => 'pass', database => 'db');
$c->parent(15); #some parent_id
$c->title("some title");
$c->body("html stuff goes here");
$c->add(); # this will add the above to the database. MUST be called before addLink<
$c->addLink( "", "Google", "You can search for stuff here");
$c->addLink("", "Yahoo", "More search stuff", '_parent');

RSS import into News

This is by no ways meant to be an easy to install module or anything, it's just a small hack to import rss feeds (from wordpress at least) into the news module. It's also got some html specific to my template which needs to be modified. I do hope it helps as a starting point if someone else wants to do the same.

To run, edit USERNAME,PASSWORD,DATABASE in the file, change the use lib('.'); line to point to the directory the file has been installed into, and add something similar to the following to your crontab

0,30 * * * * /usr/bin/wget  -q -O /home/reza/.rss '' > /dev/null
3,33 * * * * /usr/local/bin/perl /home/reza/bin/ > /dev/null