Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

mojotoad's scratchpad

by mojotoad (Monsignor)
on Jun 01, 2004 at 13:14 UTC ( #358028=scratchpad: print w/ replies, xml ) Need Help??

use strict; use warnings; use Path::Class; my $rootdir = ... # however it happens my $relative_path = file($0)->relative($root_dir); # btw, this does the same if all you want is # the script name: use FindBin; my $name = $FindBin::Script; # there's also $FindBin::Dir, ::RealDir and ::RealScript, # the last two are only relevant for resolving soft links. # Here's Yet Another Way, using Path::Class again: my $script = file(__FILE__)->basename; # If you want to be thorough... $script = file(__FILE__)->absolute; $dir = $script->dir; $script = $script->basename;

A HTML::ElementTable example of chessboard generation...

use strict; use warnings; use HTML::ElementTable; my @back_row = qw(rook knight marshal bishop cardinal queen king cardinal bishop marshal knight rook); my @middle_row = qw(pawn squire squire novice priest princess prince priest novice squire squire pawn); my @front_row = (undef, ('pawn') x 10, undef); my $t = HTML::ElementTable->new(maxrow => 11, maxcol => 11); for my $c (0 .. $#back_row) { $t->cell($_, $c)->push_content($back_row[$c]) for (0, 11); } for my $c (0 .. $#middle_row) { $t->cell($_, $c)->push_content($middle_row[$c]) for (1, 10); } for my $c (0 .. $#front_row) { next unless $front_row[$c]; $t->cell($_, $c)->push_content($front_row[$c]) for (2, 9); } for my $r (0 .. $t->maxrow) { for my $c (0 .. $t->maxcol) { $t->cell($r, $c)->attr(class => $r % 2 ^ $c % 2 ? 'odd' : 'even'); } } print $t->as_HTML;
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2014-08-30 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls