installing from CPAN without root
Saturday 14 August 2010 @ 7:20 pm

I found this nice site, that takes you step by step through installing perl modules without root access, using local::lib

Enjoy 🙂

Comments (0) - Posted in cpan by  

Masons and mason
Wednesday 31 March 2010 @ 6:57 am

I’m reading now a book by Dan Brown, author of “DaVinci code”, titled “Lost symbol”. It is mostly about masons. And it quite resemble the previous books by this author. Anyway, it is riveting.

This seemingly off-topic introduction leads to the on-topic perl thing: the mason. It is a “High-performance, dynamic web site authoring system” and “solves the common problems of site development: caching, debugging, templating, maintaining development and production sites, and more.” and “you can embed Perl code in your HTML and construct pages from shared, reusable components.”. Well, sound nice. How it looks? Like this:

(there was something wrong here. I removed it 🙂 )

Sadly, the FAQ on the official page seems to be neglected and is spammed by merchants of medications made to make your weenie harder. On the other hand, newest version is 1.44 form Jan 4, 2010 – so it is still developed.

Assuming that I would like to learn something new, like “something big, modern, to easy make web applications – with templates, cache, scalability, quick development” should I dive into mason, or better look for something else?

So, I have question, asking YOU for an insight about this like:
mason is cool, and at least better to do the same by your own from scratch
– forget it, it is so 1990’s, learn catalyst instead
– forget mason and catalyst, learn PHP symphony (- no problem for me, I know PHP – more or less 🙂 )
– ruby on rails is the real thing (no, I will not learn ruby – at least now 🙂 )
– the best is framework …. (something not mentioned above)

Please write your opinion below. Thank you.

Comments (4) - Posted in work by  

How to easily resige images in Perl
Wednesday 17 March 2010 @ 6:46 am

How to easily resize images (jpg) in perl? Use Image::resize

use Image::Resize;
use autodie;

$src = "bigimage.jpg";
my $old = Image::Resize->new($src);
my $new = $old->resize(200, 300); # max dimensions

$jpegdata = $new->jpeg(95); # jpeg quality

open OUT, ">./smaller/$src";
print OUT $jpegdata;
close OUT;
Comments (0) - Posted in work by  

Microsoft bots made DDoS on CPAN
Wednesday 17 February 2010 @ 7:49 am

Bing’s (a Microsoft search engine 🙂 ) bots made something DDoS-like on CPAN site. Why? It may be either error (“Never attribute to malice what can be easily explained by stupidity.”) or something made on purpose (for conspiracy theories fans).

Quote form CPAN Testers blog (more details):

If you’ve suffered any problems accessing any of the sites, the databases, the CPAN mirror, etc. from the CPAN Testers server last night, please direct your wrath at Microsoft. Last night the msnbot took out the CPAN Testers server with a dedicated denial of service attack. As a consequence measures are now being put in place to completely ban the msnbot from accessing at least the Reports site, and probably all the sites on the server.

Perl testers  pointed out that msnbot does not obey robots.txt file.

Comments (1) - Posted in cpan by  

Website authorization – my solution
Wednesday 11 November 2009 @ 6:37 am

I wrote about wondering how to make “login” to a dynamic website in Perl. The best solution advised by was to make a temporary token: “cookie with an authorization token. Store the token in the database along with an expiration time separate of the cookie. The token should be random generated and completely seperate from the password but handed out when the password is validated. This is the best case;”, but it was overshot for now, so I settled up for this scheme:

Whan user registers, his password is stored as md5 digest in database. Salt is generated – string of eight random letters, numbers etc.I use Crypt::PasswdMD5 qw(unix_md5_crypt);

When user logs in, password is checked-  crypted using crypted pass from database as salt:

if ( $cryptedpassword eq unix_md5_crypt($password, $cryptedpassword)) {

and if it is ok, cookie is stored with user ID and crypted password.

The cookie is then checked on every page, whether it contains the crypted password from database.

Well, this is my idea of doing it for now, already implemented, I feel a bit unease about that – what is the point of crypting password and storing it crypted, as it really matters whether the pass from cookie is equal to pass in database – it could be not crypted and it would work the same way.

The only advantage is that the password is not stored in cookie – but it is not needed, as just the digest is needed to pretend to be logged in.

What do you think?

Comments (4) - Posted in cpan,work by  

Website login with Perl
Tuesday 27 October 2009 @ 6:55 am

Lately I was thinking about implementing logging (as in login/password) into a website with Perl. I mean, that I want to have a dynamic website, where users can login using login and password and do some stuff.

After googling for “how to make login site” mostly PHP session solutions came up. When I added “perl” to that google query, half of results was about logging into someone’s website (wget, LWP, WWW::Mechanize etc) and not making a login feature in existing dynamic website. Search for “perl authentication” found more relevant stuff.

Some pages suggested using .htaccess. Bleh. Beside, I want to have user in a SQL database.

One result pointed to CGI::Session on cpan. Nice. CGI::Session::Auth – nice too 🙂 There is also Apache::Session to be found on cpan.

There was also a hint, to find a perl web forum script and see how it is done there. We’ll, I did it with one forum script, and found that user login and crypted password is stored in a cookie. Nice.

There also books that talk about how to do web authentication: Perl for Web Site Management or CGI programming with Perl

Here we have some design patterns: and also: and . Even nicer 🙂

But I still look for ultimate “how to” with examples about authorizing users (register, login, remind password etc.)  into some kind of dynamic website with Perl. Any hints?

Comments (1) - Posted in work by  

Having nice background colors in Spreadsheet::WriteExcel
Wednesday 7 October 2009 @ 10:03 am

If you want to make Excel spreadsheet using perl module Spreadsheet::WriteExcel with, for example, orange or yellow backgorund in some cells, you can use the built-in palette, but the colours there may burn your eyes 🙂

How to have nice colours in spreadsheets: use set_custom_color($index, $red, $green, $blue)

For example:

my $light_orange = $workbook->set_custom_color(43, 255, 226, 171);
my $ligth_yellow = $workbook->set_custom_color(42, 255, 255, 204);
my $light_purple = $workbook->set_custom_color(40, 225, 204, 255);

Comments (0) - Posted in work by  

My stuff on CPAN
Sunday 15 June 2008 @ 12:12 pm

Well, whis is very small input, but now I am proud to have something on CPAN:

( you may see there: Thanks to Lech Baczynski for dump_fortunes. )

The code I sent to Luke was somewhat different that the code he included, but anyway, I am proud 😉

Comments (0) - Posted in cpan by