Stuff…

I know I will forget.

Stuff… header image 1

MySQL GROUP BY useful article

December 15th, 2010 · No Comments

Being a bit rusty on database queries I found myself needing to use a MySQL GROUP BY statement and wanted to understand it a little better.  This article was excellent:

→ No CommentsTags: Coding

MIME::Lite::TT instead of Email::Sender::Simple / Email::Simple

December 5th, 2010 · No Comments

For some reason I was having troubles with Email::Sender::Simple / Email::Simple which were being very fussy about the syntax of the from address and continually gave me “no sender” and other errors.  I didn’t have time to look into this so decided to try something else.

Stumbled across:

Which was discussing using MIME::Lite::TT::HTML to send emails which was ideal as I’m using TT for the interface side of things.  Had this working with templates within a couple of minutes, so, could get on with other things.

# Wanted TEXT only version in this case..
my $msg = MIME::Lite::TT->new(
To        =>  ‘admin@domain>’,
From          =>  $contents{‘from’},
Subject     =>  $contents{‘subject’},
Template    =>  “/template/dir/, #{
# text    =>  ‘test.txt.tt’,
# html    =>  ‘test.html.tt’,
#},
TmplOptions =>  \%options,
TmplParams  =>  \%contents,
);
$msg->send();

→ No CommentsTags: Coding

Perl Template Toolkit 2 Dumper

December 2nd, 2010 · No Comments

I generally don’t use it enough, so, keep forgetting how to dump the contents of a variable with template toolkit.

[% USE Dumper %]
[% Dumper.dump(variable) %]

This is a Template Toolkit plugin to Data::Dumper.  Very useful.

→ No CommentsTags: Coding

Perl Advent Calendar

December 1st, 2010 · No Comments

Learn something every day this month with the Perl Advent Calendar 2010:

→ No CommentsTags: Coding

CGI::Application::Session keeps on creating new sessions

November 30th, 2010 · 1 Comment

Was using CGI::Application::Sesion in a CGI::Application Perl application.  For some reason CGI::Application::Sesion kept on creating new sessions in the database when going to the site.  Really it should have only created and used one session for my client.

The same code worked fine prior to upgrading from Ubuntu 8.04 to Ubuntu 10.04.1 LTS.  Some modules obviously changed and affected the session handling.

Decided to check CPAN to see what modules needed updating.  Ran:

bash# cpan

cpan[1]> upgrade

I had never ran upgrade before and thought it would prompt “are you sure Y/N” before starting. It has started updating older modules now.  Probably should have ran:

r        WORDs or /REGEXP/ or NONE    report updates for some/matching/all modules

first to check for the most appropriate modules for update.

Great news is that CGI::Application::Session is now working properly with one session per visitor, but, crossing fingers that nothing breaks.

→ 1 CommentTags: Coding