Thursday, January 28, 2010

Posting to Blogger from Perl

Here is a little snippet that allows you to post to your Blogger blog from Perl:

use Net::SMTP::TLS;
my $mailer = new Net::SMTP::TLS(
    'smtp.gmail.com',    # dont change
    Hello    => 'smtp.gmail.com',         # dont change
    Port     => 587,                      # dont change
    User     => 'your.address@gmail.com', # change to your username
    Password => 'password'                # change to your password
);

# you email address associated with the blog
$mailer->mail('your.address@gmail.com');

# the address to send the post to
$mailer->to('blogid.secretword@blogger.com');
$mailer->data;

# blog post body
$mailer->datasend("Subject: Title of my blog post\n\n")
  ;                                       # keep the trailing \n\n!
$mailer->datasend("The text of my post here\n");

# end blog post
$mailer->dataend;
$mailer->quit;

Let me know how this works for you!

Thursday, January 14, 2010

Mapping OWL ontologies into PERL

Unlike in JAVA, there doesn't exist a way in PERL to generate modules from Web Ontologies (OWL). Well, not until recently!

As part of a bigger effort, the CPAN module, SADI, contains a script for generating fully functional PERL modules from Web Ontologies. The script is called sadi-generate-datatypes.pl and is automatically installed along side the SADI module. Under the hood it is using RDF/OWL parsing code from PLUTO (a module built on from a project from IBM).

 I wont go into the details for how to use this module here (there is ample documentation available on CPAN for this module). I would like to point the interested reader to the documentation for generating the Perl modules. Go to http://search.cpan.org/dist/SADI/ and at the very bottom you will see under the "Other Files" header a link called doc/working_with_datatypes.html. That file should get you going.

Thursday, November 26, 2009

Earning rebates when shopping online in Canada

As someone that enjoys shopping for things online, I thought that I would share a way for Canadian shoppers to earn rebates while shopping for items online.

Great Canadian Rebates is a site that lists various online retailers and offers coupons/rebates (ranging from a flat amount of cash back, to 12%) on items that you buy from retailers that they list. The require you to sign up for an account and then to click through their site to shop the online retailer. With my account, I have received just under $70 back in under a year. They even give you a toonie ($2) for just signing up!

I figure that since I buy stuff online, why not get a little something back!