http://qs1969.pair.com?node_id=418199


Some interesing links / nodes
Perl Wiki Book

Creating a windows EXE from Perl script
Re: Turning foreach into map?
Useful homenodes
Re: Basic voting statistics for Node Reputation
Re: CgiProxy And Heavy Visitors
How You (Yes You!) Can Get Involved
Perl/Ruby comparison
Finding the name of a code ref
Rules for JAPH in the Obfuscation section?
A warning about overloading assignment methods
What shortcuts can I use for linking to other information?
Structured obfuscation
Perl 6 books
monitoring CPU usage
Doubt about fly-weight objects.
AJAX and Perl-based web applications
perl5 "prototyping": why?
Bit operations for beginners
What is "Schwarzian Transform" (aka Schwartzian)
HOP, flip, and swap
Java is from Mars, Perl is from Venus
Why GUI perl programs on Windows?
GUI and standalone Perl - can we build a new FAQ please?

References in Perl
References quick reference
The Concept of References
how do $x = \12 differ from $$y = 12 ?

Catalyst
Catalyst and the stash
Catalyst movies
Catalyst usage in the wild...
Testing TT and CDBI under Catalyst

Others homenodes
monkfan
Solo (about SDL)
DigitalKitty tutorials / chatterbox history



Some small scripts i've written (for the fun and learning purposes)
Obfuscation helper
#!/usr/bin/perl -w use strict; my $chars = {}; for (my $i=33; $i<=127; $i++) { my $oct = sprintf("\\%o", $i); $chars->{chr($i)} = $oct; } foreach my $word (@ARGV) { my(@str) = split(//,$word); foreach my $letter (@str) { print $chars->{$letter}; } print " "; } # ./obus.pl just another Perl hacker, # returns # \152\165\163\164 \141\156\157\164\150\145\162 \120\145\162\154 \150\ +141\143\153\145\162\54 # \40 gives character 32, the space.


Web / online Thumbnail creator
#!/usr/bin/perl -w use strict; use Image::Magick; use File::Glob qw(:globally :nocase); use File::Basename; use CGI; my $realdir = qw( /var/www/html/thumbnailer/images/ ); # The dir tha +t holds the origional images my @ext = qw( jpg png gif); # Image exten +tions to look for my $savedir = qw( /var/www/html/thumbnailer/thumbs/ ); # Dir to save + thumbnails my $serverdir = qw( /thumbnailer/ ); # Relative se +rver-path my $thumbdir = qw( thumbs/ ); # Holds the t +humbnails for the webpage my $imagedir = qw( images/ ); # Holds the r +eal images for the webpage my $x_size = 150; # Size in pix +els. my $y_size = 150; # Size in pix +els. my $resize = 1; # Resize befo +re crop. my $aspect_S = 0.5; # Only reseze + if aspect-ratio is above this value, else thumbnail becomes to blurr +ed. my $aspect_H = 2; # Only resize + if aspect-ratio is below this value, else thumbnaik becomes to blurr +ed. my $overwrite = 0; # Allways rem +ake (overwrite) the thumbnails. my $cols = 5; # Max horizon +tal thumbs. my $rows = 10; # Max vertica +l thumbs. my $cgi = new CGI; main(); cleanUp(); sub main { my $content = "<tr>"; my $files = readDir(); my $thumbs_per_page = $rows * $cols; my $total = scalar(@$files) ? scalar(@$files) : 0; my $pages = $total / $thumbs_per_page; my $currentPage = $cgi->param('p') ? $cgi->param('p') : 1; my $hasPrevious = $currentPage-1 ? 1 : 0; my $hasNext = ($currentPage < $pages) ? 1 : 0 ; my $startImage = (($currentPage-1) * $thumbs_per_page) ; my $nav = ""; my $c = 1; my $i = 0; foreach my $file (@$files) { $i++; if ($i >= $total) { $nav .= "<tr><td align=\"center\" nowrap=\"now +rap\" colspan=\"$cols\">"; if ($hasPrevious) { $nav .= "<a href=\"?p=" . +($currentPage - 1) . "\">Previous<\/a>\&nbsp;\&nbsp;"; } if ($hasNext) { $nav .= "<a href=\"?p=" . +($currentPage + 1) . "\">Next<\/a>"; } $nav .= "<\/td><\/tr>"; } next if ($i <= $startImage || $i > ($startImage + $thu +mbs_per_page)); if ($c > $cols) { $content .= "<\/tr><tr>\n"; $c = 1; } # Check if the file alreaddy exists: my $filename = "thumb_" . fileparse($file); if (!-e $savedir . $filename || $overwrite) { # Make new thumbnails... my $image = Image::Magick->new; $image->Read($file); my ($x,$y) = $image->Get('width', 'height'); # Enlarge image if thumbnail > origional, or r +esize before crop is enabled... if ($x < $x_size || $resize) { my $aspectratio = $y / $x; # Only resize if aspect-ratio is betwe +en given apect ratio-borders if ($aspectratio > $aspect_S && $aspec +tratio < $aspect_H || $x < $x_size) { $x = $x_size; $y=$x * $aspectratio; $image->Resize(width => $x, he +ight => $y, filter => 'Cubic', blur => 1); } } if ($y < $y_size) { my $aspectratio = $x / $y; $y = $y_size; $x=$y * $aspectratio; $image->Resize(width => $x, height => +$y, filter => 'Cubic', blur => 1); } # Get center (offset) of image, and crop to $x +_size * $y_size. my $ox = ($x - $x_size) / 2; my $oy = ($y - $y_size) / 2; $image->Crop("${x_size}x${y_size}+$ox+$oy"); $image->Write($savedir.$filename); $content .= " <td> <a href=\"" . $serverdir . +$imagedir . fileparse($file) . "\" > <img src=" . $serverdir . $thumb +dir . $filename. " alt=\"\" border=\"1\"> <\/a><\/td> "; } else { # Skip writing... $content .= " <td> <a href=\"" . $serverdir . +$imagedir . fileparse($file) . "\" > <img src=" . $serverdir . $thumb +dir . $filename. " alt=\"\" border=\"2\"> <\/a><\/td> "; } $c++; } $content .= "<\/tr>\n" . $nav; printHtml($content); } sub printHtml { my ($content) = @_; # my $cgi = new CGI; print $cgi->header(-type => 'text/html', ); print $cgi->start_html( -title => 'Testpage', -BGCOLOR => '#ffffff',); print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"3\" +>\n"; print $content; print "\n<\/table>\n"; print $cgi->end_html; } sub readDir { my $files="*.{" . join(",",@ext) . "}"; my @files= glob($realdir.$files); return \@files; } sub cleanUp { undef $cgi, $realdir, @ext, $serverdir, $savedir, $x_size, $co +ls; undef $y_size, $resize, $aspect_S , $aspect_H, $overwrite, $ro +ws; undef $thumbdir, $imagedir; }