<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>perl &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://wordpress.com/tag/perl/</link>
	<description>Feed of posts on WordPress.com tagged "perl"</description>
	<pubDate>Tue, 07 Oct 2008 21:27:53 +0000</pubDate>

	<generator>http://wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Programmer: new to the area... seeks support]]></title>
<link>http://lispy.wordpress.com/?p=312</link>
<pubDate>Mon, 06 Oct 2008 21:04:03 +0000</pubDate>
<dc:creator>lispy</dc:creator>
<guid>http://lispy.wordpress.com/2008/10/06/programmer-new-to-the-area-seeks-support/</guid>
<description><![CDATA[Back in the day, I took a writing course in a special fine arts program.  The advise that the profes]]></description>
<content:encoded><![CDATA[<p>Back in the day, I took a writing course in a special fine arts program.  The advise that the professional writer gave us aspiring novelists and poets was to put an ad in the paper when you move to a new place.  "Writer; new to the area... seeks support."  Something like that.  His point was that we weren't going to get any better without having some good feedback from our fellow craftsmen.  We need to form little groups where we share what we're working on-- not just for tips about style and technique, but also just to get the encouragement we need to persevere.  (Also, he told us to watch out for the pompous guys in the turtle necks with pipes: these guys are expert at looking like "writers" without actually ever writing anything!)</p>
<p>Fast forward to today.  I'm a professional "programmer"... but most of my colleagues have no interest in sharing code and discussing it.  (At the last place I worked, the other guys would roll their eyes at any request I would make for design meetings or brief "show and tell" type exchanges.)  Maybe it's different in your area of expertise, but the general attitude appears to be that folks want to just be left alone to do things their own way.  In some cases, I doubt that we even a common framework or language from which to discuss good design principles....  (I'm sure Alan Kay has noticed something like this and maybe even cited it as evidence that we're still in the dark ages of programming....)</p>
<p>Similarly, I remember an art teacher I had.  I asked him how to get good at drawing.  He said everyone has a million bad drawings in them and that the sooner you get those out of the way, the more likely you are to get good.  Learning a new programming language is like that, except... I guess it's more like you have to get 100 bad short programs out of the way... and then you have to get at least 10 medium sized programs out of the way.</p>
<p>So here I am learning Perl in general and Moose in particular.  Definitely "new to the area" in that department!  Also, I have below my second "bad" medium sized program for this platform.  There are a lot of directions I can go with this stuff, but I'd like to tune things up some more before I get too deep into anything else.  Please feel free to jump in with your comments if you're into it.  Here are a few random notes:</p>
<p>* Installing Moose on cygwin didn't work for me.  I tried a few different ways, but always got hung up on the dependencies.</p>
<p>* Installing Moose on Windows was pretty painless.  Whatever the package manager was that I used, it worked great.</p>
<p>* The default shell for Emacs on Windows is pretty retarded.  The whole concept of STDIN seems gone there....  Argh....</p>
<p>* You can't seem to cut and paste text from a standard Windows console window.  Argh.</p>
<p>* In the code below, I haven't completely refactored the Parser to be completely "Moose-ish".  I did factor out a Table object, though.</p>
<p>* There are a few instances of cut &#38; paste code repetition below.</p>
<p>* The program attempts to implement a strict by-the-book character generation sequence for Classic Traveller.  I used the revised rules from The Traveller Book.  (All classic Traveller materials are available on CD-Rom from <a href="http://www.farfuture.net/">FFE</a>.  <a href="http://www.mongoosepublishing.com/rpg/series.php?qsSeries=51">Mongoose</a> has recently released a new version of the game.  <a href="http://e23.sjgames.com/search.html?gsys=Traveller">e23</a> and<a href="http://www.comstar-games.com/index.php?option=com_content&#38;view=category&#38;layout=blog&#38;id=59&#38;Itemid=63"> Comstar</a> both have pdf products available.  I'm partial to the original stuff, myself.)  There are other character generation programs floating around, but I'm not sure how well they tend to follow the rules as written.</p>
<p>* The current design is mostly data-driven.  Someone that knows Traveller should be able to customize the program to some extent without knowing Perl.  I would like to extend the capabilities of the configuration language so that ordinary joes can hack things into whatever houserules they've cooked up.  My concept for this would be something halfway between 8-bit BASIC and a spreadsheet... but slightly OOPish, maybe.  Maybe I should write a compiler to convert the script file into standard Perl?  I dunno....  We'll see where this goes....</p>
<p>* After cleaning up the program as it stands, I should be in a position to code up other chargen schemes (as my spare time allows)... and I should have an opportunity to use more of Moose's features then.  Going forward (assuming I go forward) I would want to strike some sort of balance between improving the generic parser tool and adding more scope and comprehensiveness to the generator.  I wouldn't want to have a perfect parser that isn't implementing anything... and I wouldn't want my code to turn to sludge and then collapse under the weight of its own scope, either.  At some point, I do want the hypothetical "power user" to be able to make this work however they want, though.</p>
<p>[sourcecode language='ruby']<br />
#!\usr\bin\perl<br />
package Routines;</p>
<p># get random number from 0 to n-1 using rand function<br />
sub get_rand { int (rand $_[0]); }</p>
<p>sub d_six { return get_rand(6) + 1; }</p>
<p>sub two_d_six { return d_six() + d_six(); }</p>
<p># TODO: This routine should omit I and O results to be real 'Traveller extended-hex' values<br />
sub tr_hex {<br />
    my $num = shift;<br />
    return 0 if $num <= 0;<br />
    return $num if $num <= 9;<br />
    die "$num is greater than 36-- too big for 'hex' conversion" if $num > 36;<br />
    return chr($num + 64 - 9);<br />
}</p>
<p>###################################################################################################</p>
<p>package Callback;<br />
use Moose;</p>
<p>sub process {<br />
    print "Hello World!\n";<br />
}</p>
<p>sub choose {<br />
    my ($self, $text) = @_;<br />
    my @options = split /;/, $text;<br />
    #print "the text is $text\n";<br />
    my $i = 0;<br />
    print "\n";<br />
    foreach(@options){<br />
        $i++;<br />
        print "$i: $_\n";<br />
    }</p>
<p>    my $answer;<br />
    until ($answer) {<br />
        print ">> ";<br />
        chomp(my $line = <STDIN>);<br />
        if ($line =~ /^\d+$/) {<br />
            $answer = $options[$line - 1];<br />
        } else {<br />
            foreach(@options){<br />
                if(/^$line/i){<br />
                    $answer = $_;<br />
                    last;<br />
                }<br />
            }<br />
        }<br />
    }<br />
    return $answer;<br />
}</p>
<p>###################################################################################################</p>
<p>package Table;<br />
use Moose;</p>
<p>my $show_debug2 = 0;</p>
<p>has Name => (is => 'rw', isa => 'Str', default => 'Bob');<br />
has 'Rows' => (isa => 'HashRef', is => 'rw', default => sub { my %hash; return \%hash; } );<br />
has 'Columns' => (isa => 'ArrayRef[Str]', is => 'rw', default => sub { my @a; return \@a; } );<br />
has 'ColumnRegexes' => (isa => 'ArrayRef[Str]', is => 'rw', default => sub { my @a; return \@a; } );</p>
<p>sub initialize {<br />
    my ($self, $table, $text) = @_;<br />
    $self->Name($table);<br />
    my ($columns, $column_regexes) = parse_column_header($text);<br />
    $self->Columns($columns);<br />
    $self->ColumnRegexes($column_regexes);<br />
    my %rows;<br />
    $self->Rows(\%rows);<br />
}</p>
<p>sub load_line {<br />
    my ($self, $text) = @_;<br />
    my ($rowkey, $row) = parse_row_detail($self->Name(), $text, $self->Columns());<br />
    $self->Rows->{$rowkey} = $row;<br />
}</p>
<p>sub cell {<br />
    my ($self, $row, $column) = @_;<br />
    return $self->Rows->{$row}->{$column};<br />
}</p>
<p>### pass a comma delimited header line from a table definition<br />
### and get two array references describing the table structure<br />
sub parse_column_header {<br />
    my ($line) = @_;<br />
    my @fields = split /,/, $line;<br />
    my $column_number = 0;<br />
    my @columns;<br />
    my @regexes;<br />
    print "reading columns to table: $line\n" if $show_debug2;<br />
    foreach(@fields){<br />
        my $field = $_;<br />
        $field =~ s/^\s+&#124;\s+$//g; # trim field<br />
        if($field =~ /^([^\/]*)\/([^\/]*)\//){<br />
            $field = $1;<br />
            $regexes[$column_number] = $2;<br />
        }<br />
        $columns[$column_number] = $field;<br />
        $column_number++;<br />
    }<br />
    return (\@columns, \@regexes);<br />
}</p>
<p>### pass a table name and a comma delimited header line from a table definition<br />
### and also pass a reference to an array of column names...<br />
### and get the row's key and a hash of detail data<br />
sub parse_row_detail {<br />
    my ($table, $line, $columns) = @_;<br />
    my @fields = split /,/, $line;<br />
    print "reading rows to table $table: $line\n" if $show_debug2;<br />
    my %row;<br />
    my $column_number = 0;<br />
    my $rowkey;<br />
    my $didit;<br />
    foreach(@fields){<br />
        my $field = $_;<br />
        $field =~ s/^\s+&#124;\s+$//g; # trim field<br />
        # Need to allow some keys to be '0'!<br />
        if ($didit){<br />
            $row{$columns->[$column_number]} = $field;<br />
        } else {<br />
            $rowkey = $field;<br />
        }<br />
        $column_number++;<br />
        $didit = 1;<br />
    }<br />
    return ($rowkey, \%row);<br />
}</p>
<p>sub show_keys {<br />
    my ($self) = @_;<br />
    my $key;<br />
    my $table = $self->Name();<br />
    my $rs = $self->Rows();<br />
    foreach $key (sort keys %{$rs}){<br />
        print "$table row    : $key\n";<br />
    }<br />
    my $cs = $self->Columns();<br />
    foreach (@{$cs}){<br />
        print "$table column : $_\n";<br />
    }<br />
}</p>
<p>###################################################################################################</p>
<p>package Parser;<br />
use Moose;</p>
<p>has 'Tables' => (isa => 'HashRef[Table]', is => 'rw', default => sub { my %hash; return \%hash; } );<br />
has ReadAsTable => (isa => 'HashRef[Table]', is => 'rw', default => sub { my %hash; return \%hash; } );</p>
<p>my $read_type = 0;<br />
my $current_table = "None";<br />
my %widgets;<br />
my $current_widget = "None";<br />
my $widget_parser_sub = \&reading_widget_fields;<br />
my $show_debug = 0;</p>
<p>my $lame_hack;</p>
<p>sub lameness {<br />
    my $self = shift;<br />
    $lame_hack = $self;<br />
}</p>
<p>sub cell {<br />
    my ($self, $table, $key, $column) = @_;<br />
    return $self->Tables->{$table}->cell($key, $column);<br />
}</p>
<p>sub show_keys {<br />
    my ($self, $table) = @_;<br />
    if ($table){<br />
        $self->Tables()->{$table}->show_keys();<br />
    } else {<br />
        foreach my $key (sort keys %{$self->Tables()}){<br />
            print "Table: $key\n";<br />
        }<br />
    }<br />
}</p>
<p>### why can't I call my properties without $self?<br />
sub reading_table_header {<br />
    my ($line) = @_;<br />
    my $T = new Table();<br />
    $T->initialize($current_table, $line);<br />
    $lame_hack->Tables()->{$current_table} = $T;<br />
    $read_type = 2;<br />
}</p>
<p>sub reading_table_detail {<br />
    my ($line) = @_;<br />
    my $T = $lame_hack->Tables()->{$current_table};<br />
    $T->load_line($line);<br />
}</p>
<p>my %dispatch_data = (</p>
<p>    '^Table ([A-Za-z]+):'  => {<br />
        code    => sub { $current_table = $1; $read_type = 1 },<br />
        debug   => sub { print "(reading table $1)\n" },<br />
    },</p>
<p>    '^\#(.*)' => {<br />
        code  => {},<br />
        debug   => sub { print "found a comment: $1\n" },<br />
    },</p>
<p>    '^[\w]*$' => {<br />
        code    => sub { $read_type = 0 },<br />
        debug   => sub { print "(Whitespace line)\n" },<br />
    },</p>
<p>    '^ReadCell "([^"]+)" As "([^"]+)"' => {<br />
        code    => sub { $lame_hack->ReadAsTable->{$1} = $2; },<br />
        debug   => sub { print "(Whitespace line)\n" },<br />
    },</p>
<p>    );</p>
<p># build the dispatch table-- but only for regex's with code or debug routines<br />
### (thanks to draegtun again)<br />
my $dispatch_table = {};<br />
while ( my ( $regex, $dispatch ) = each %dispatch_data ) {<br />
    $dispatch_table->{ $regex } = sub {<br />
        $dispatch->{ code  }->()  if exists $dispatch->{ code };<br />
        $dispatch->{ debug }->()  if $show_debug;<br />
    } if exists $dispatch->{ code } or ($show_debug and exists $dispatch->{ debug });<br />
}</p>
<p>my $alternate_dispatch_table =<br />
    { 1 => \&reading_table_header,<br />
      2 => \&reading_table_detail,<br />
    };</p>
<p>sub parse {<br />
    my $self = shift;<br />
    my ($file) = @_;<br />
    #print "You are trying to open $file.\n";<br />
    open SCRIPT, "< $file";<br />
    while (<SCRIPT>) {<br />
        my $line = $_;<br />
        my $success = 0;<br />
        my $key;<br />
        foreach $key (sort keys %{$dispatch_table}) {<br />
            if ($line =~ /$key/){<br />
                $dispatch_table->{$key}->();<br />
                $success = 1;<br />
                last;<br />
            }<br />
        }<br />
        if ($success == 0 and $read_type > 0) {<br />
            chomp($line);<br />
            my $altcode = $alternate_dispatch_table->{$read_type};<br />
            $altcode->($line);<br />
        }<br />
    }<br />
    close SCRIPT;</p>
<p>}</p>
<p>###################################################################################################</p>
<p>package Character;<br />
use Moose;<br />
#use Parser;</p>
<p>has 'Callback' => (isa => 'Callback', is => 'rw', default => sub { Callback->new(); } );<br />
has 'Environment' => (isa => 'Parser', is => 'rw', default => sub { my $P = Parser->new();<br />
                                                                    $P->lameness();<br />
                                                                    $P->parse('BookOne.dat');<br />
                                                                    return $P;} );</p>
<p>has 'AttributeNames' => (isa => 'ArrayRef[Str]', is => 'rw');<br />
has 'AttributeValues' => (isa => 'ArrayRef[Int]', is => 'rw', default => sub { my @a; return \@a; });<br />
has 'Commissioned' => (isa => 'Bool', is => 'rw');<br />
has 'Terms' => (isa => 'Int', is => 'rw');<br />
has 'Rank' => (isa => 'Int', is => 'rw');<br />
has 'Cash' => (isa => 'Int', is => 'rw');<br />
has 'UnspentBenefits' => (isa => 'Int', is => 'rw');<br />
has 'CashRollsTaken' => (isa => 'Int', is => 'rw');<br />
has 'Alive' => (isa => 'Bool', is => 'rw');<br />
has 'Skills' => (isa => 'HashRef[Int]', is => 'rw');<br />
has 'Benefits' => (isa => 'HashRef[Int]', is => 'rw');<br />
has 'ServiceName' => (isa => 'Str', is => 'rw');<br />
has 'Service' => (isa => 'Int', is => 'rw');<br />
has 'Drafted' => (isa => 'Bool', is => 'rw');<br />
has 'Reenlisted' => (isa => 'Bool', is => 'rw');<br />
has 'SkillsToPick' => (isa => 'Int', is => 'rw');<br />
has 'BenefitsToPick' => (isa => 'Int', is => 'rw');</p>
<p>sub set_attributes {<br />
    my $self = shift;<br />
    for(0..5){<br />
        $self->AttributeValues->[$_] = Routines::two_d_six();<br />
    }<br />
}</p>
<p>sub initialize {<br />
     my $self = shift;<br />
     my @Attributes = qw/Strength Dexterity Endurance Intelligence Education Social/;<br />
     $self->AttributeNames(\@Attributes);<br />
     $self->Commissioned(0);<br />
     $self->Terms(0);<br />
     $self->Rank(0);<br />
     $self->Cash(0);<br />
     $self->UnspentBenefits(0);<br />
     $self->CashRollsTaken(0);<br />
     $self->Alive(1);<br />
     $self->ServiceName("");<br />
     $self->Service(0);<br />
     $self->Drafted(0);<br />
     my %skills;<br />
     my %benefits;<br />
     $self->Skills(\%skills);<br />
     $self->Benefits(\%benefits);<br />
     set_attributes($self);<br />
}</p>
<p>sub display {<br />
    my $self = shift;<br />
    my $rankname = '';<br />
    $rankname = $self->cell('Titles', $self->{Rank}, $self->{Service}) if $self->{Rank};<br />
    my $age = 18 + $self->{Terms} * 4;<br />
    $age += 2 unless $self->{Alive};<br />
    my $t = "Terms";<br />
    $t = "Term" if $self->{Terms} == 1;<br />
    print "$self->{ServiceName} $rankname ($self->{Terms} $t)\t\t";<br />
    for(0..5){<br />
        print Routines::tr_hex($self->AttributeValues->[$_]);<br />
    }<br />
    print "  Age: $age  Cash: $self->{Cash}";<br />
    print "  (DECEASED)" unless $self->Alive;<br />
    print "\n";<br />
    $self->display_skills();<br />
    $self->display_benefits();<br />
}</p>
<p>sub display_attributes {<br />
    my ($self, $message) = @_;<br />
    for(0..5){<br />
        print Routines::tr_hex($self->AttributeValues->[$_]);<br />
    }</p>
<p>    $message = '' unless defined($message);<br />
    print "$message\n";<br />
}</p>
<p>sub enlist {<br />
    my ($self) = @_;<br />
    my $choice = $self->Callback->choose("Navy;Marines;Army;Scouts;Merchants;Other");<br />
    my $num = $self->cell('Services', $choice, 'ServiceNum');<br />
    print "You are attempting to enter service #$num $choice.\n";<br />
    my $target = $self->cell('PriorService', 'Enlistment', $num);<br />
    print "Your base enlistment target is $target.\n";</p>
<p>    unless ($self->cell('PriorService', 'EOneVal', $num) eq '-'){<br />
        my $attone = $self->cell('PriorService', 'EOneAtt', $num);<br />
        my $valone = $self->cell('PriorService', 'EOneVal', $num);<br />
        my $atttwo = $self->cell('PriorService', 'ETwoAtt', $num);<br />
        my $valtwo = $self->cell('PriorService', 'ETwoVal', $num);</p>
<p>        if ($self->attribute($attone) >= $valone){<br />
            print "Enlistment DM of +1 due to $attone.\n";<br />
            $target--;<br />
        }<br />
        if ($self->attribute($atttwo) >= $valtwo){<br />
            print "Enlistment DM of +2 due to $atttwo.\n";<br />
            $target -= 2;<br />
        }<br />
        print "Your net Enlistment Target is $target.\n"<br />
    }</p>
<p>    my $roll = $self->get_two_d_six();</p>
<p>    if ($roll >= $target){<br />
        print "You're in!!\n";<br />
        $self->Drafted(0);<br />
        $self->Service($num);<br />
        $self->ServiceName($choice);<br />
    } else {<br />
        print "You failed to enlist into the $choice.\n";<br />
        $self->Drafted(1);<br />
        $roll = Routines::d_six();<br />
        my $draft = $self->cell('PriorService', 'ServiceName', $roll);<br />
        $self->Service($roll);<br />
        $self->ServiceName($draft);<br />
        print "You have been drafted into $draft.\n";<br />
    }</p>
<p>    $self->check_rank_skills();<br />
}</p>
<p>sub get_d_six(){<br />
    my $roll = Routines::d_six();<br />
    print "You rolled a $roll.\n";<br />
    return $roll;<br />
}</p>
<p>sub get_two_d_six(){<br />
    my $roll = Routines::two_d_six();<br />
    print "You rolled a $roll.\n";<br />
    return $roll;<br />
}</p>
<p>sub check_rank_skills {<br />
    my ($self) = @_;<br />
    if ($self->Rank() < 7) {<br />
        my $skill = $self->cell("RankAndServiceSkills", $self->{Rank}, $self->{Service});<br />
        unless ($skill eq '-'){<br />
            print "You gain a rank/service skill level in $skill.\n";<br />
            if ($skill eq 'Social'){<br />
                $self->AttributeValues->[5] += 1; #TODO: add attributes to raise routine<br />
            } else {<br />
                $self->raise($skill);<br />
            }<br />
        } else {<br />
            print "No rank/service skill for you this time...\n";<br />
        }<br />
    }<br />
}</p>
<p>sub survival {<br />
    my ($self) = @_;<br />
    my $target = $self->cell("PriorService", "Survival", $self->{Service});<br />
    unless ($target eq '-'){<br />
        print "Your base survival target is $target.\n";<br />
        my $att = $self->cell("PriorService", "STwoAtt", $self->{Service});<br />
        my $val = $self->cell("PriorService", "STwoVal", $self->{Service});        if ($self->attribute($att) >= $val){<br />
            $target -= 2;<br />
            print "Survival DM of +2 due to $att.\n";<br />
            print "Your net survival target is $target.\n";<br />
        }</p>
<p>        $self->check_survival($target);<br />
    }<br />
}</p>
<p>sub check_survival {<br />
    my ($self, $target) = @_;<br />
    my $roll = $self->get_two_d_six();<br />
    if ($roll >= $target){<br />
        print "You survived!\n";<br />
        $self->Alive(1);<br />
    } else {<br />
        print "You have died!\n";<br />
        $self->Alive(0);<br />
    }<br />
}</p>
<p>sub commission {<br />
    my $self = shift;<br />
    my $target = $self->cell("PriorService", "Commission", $self->{Service});<br />
    unless ($target eq '-'){<br />
        print "Your base commission target is $target.\n";<br />
        my $att = $self->cell("PriorService", "COneAtt", $self->{Service});<br />
        my $val = $self->cell("PriorService", "COneVal", $self->{Service});<br />
        if ($self->attribute($att) >= $val){<br />
            $target--;<br />
            print "Commission DM of +1 due $att.\n";<br />
            print "Your net commission target is $target.\n";<br />
        }<br />
        my $roll = $self->get_two_d_six();<br />
        if ($roll >= $target){<br />
            print "You gained a commission!\n";<br />
            $self->Commissioned(1);<br />
            $self->{'SkillsToPick'}++;<br />
            $self->{'Rank'}++;<br />
            $self->check_rank_skills();<br />
        } else {<br />
            print "You did not get a commission.\n";<br />
            $self->Commissioned(0); # Just to be sure<br />
        }<br />
    }<br />
}</p>
<p>sub promotion {<br />
    my $self = shift;<br />
    my $target = $self->cell("PriorService", "Promotion", $self->{Service});<br />
    unless ($target eq '-'){<br />
        print "Your base promotion target is $target.\n";<br />
        my $att = $self->cell("PriorService", "POneAtt", $self->{Service});<br />
        my $val = $self->cell("PriorService", "POneVal", $self->{Service});<br />
        if ($self->attribute($att) >= $val){<br />
            $target--;<br />
            print "Promotion DM of +1 due $att.\n";<br />
            print "Your net commission target is $target.\n";<br />
        }<br />
        my $roll = $self->get_two_d_six();<br />
        if ($roll >= $target){<br />
            print "You gained a promotion!\n";<br />
            $self->{'SkillsToPick'}++;<br />
            $self->{'Rank'}++;<br />
            $self->check_rank_skills();<br />
        } else {<br />
            print "You did not gain a promotion.\n";<br />
        }<br />
    }<br />
}</p>
<p>sub reenlist {<br />
    my $self = shift;<br />
    my $target = $self->cell("PriorService", "Reenlist", $self->{Service});<br />
    my $try;</p>
<p>    if ($self->Terms() >= 7){<br />
        print "After your seventh term, you must roll an exact 12 to reenlist.\n";<br />
        $try = 'Muster Out';<br />
    } else {<br />
        print "Your reenlistment target is $target.\n";<br />
        $try = $self->Callback->choose("Reenlist;Muster Out");<br />
    }<br />
    my $roll = $self->get_two_d_six();</p>
<p>    if ($try eq 'Reenlist'){<br />
        if ($roll >= $target){<br />
            print "You successfully reenlisted!\n";<br />
            $self->Reenlisted(1);<br />
        } else {<br />
            print "You have been forced to muster out.\n";<br />
            $self->Reenlisted(0);<br />
        }<br />
    } else {<br />
        # Even if you want to muster out, you're back in on a 12.<br />
        if ($roll == 12){<br />
            print "You have been forced to reenlist!!\n";<br />
            $self->Reenlisted(1);<br />
        } else {<br />
            print "You have mustered out.\n";<br />
            $self->Reenlisted(0);<br />
        }<br />
    }<br />
}</p>
<p>sub skills {<br />
    my $self = shift;<br />
    my $table;<br />
    if ($self->attribute("Education") >= 8){<br />
        $table = $self->Callback->choose("PersonalDevelopmentSkills;ServiceSkills;AdvancedSkills;HighlyAdvancedSkills");<br />
    } else {<br />
        $table = $self->Callback->choose("PersonalDevelopmentSkills;ServiceSkills;AdvancedSkills");<br />
    }<br />
    my $roll = $self->get_d_six();<br />
    my $skill = $self->cell($table, $roll, $self->{Service});<br />
    $self->raise($skill);<br />
    $self->{'SkillsToPick'}--;<br />
    $self->skills() if $self->SkillsToPick() > 0;<br />
}</p>
<p>sub raise {<br />
    my ($self, $thing) = @_;</p>
<p>    if (defined($self->attribute($thing))){<br />
        my $value = $self->attribute($thing);<br />
        $value++;<br />
        $self->attribute($thing, $value);<br />
        $self->display_attributes(" ($thing raised)");<br />
    } else {<br />
        $self->Skills->{$thing}++;<br />
        $self->display_skills($thing);<br />
    }<br />
}</p>
<p>sub display_skills {<br />
    my ($self, $skill) = @_;<br />
    $skill = 'Nothing' unless $skill; # silly hack<br />
    my $comma;<br />
    my $star = '';<br />
    foreach my $key (sort keys %{$self->Skills}){<br />
        my $value = $self->Skills->{$key};<br />
        my $star = '*' if $key eq $skill;<br />
        print ", " if $comma;<br />
        print $star if $star; # can't print this in concatenation for some reason (?)<br />
        print "$key";<br />
        print $star if $star;<br />
        print "-$value";<br />
        $comma = 1;<br />
        $star = '';<br />
    }<br />
    print "\n";<br />
}</p>
<p>sub display_benefits {<br />
    my ($self, $benefit) = @_;<br />
    $benefit = 'Nothing' unless $benefit; # silly hack<br />
    my $comma;<br />
    my $star = '';<br />
    foreach my $key (sort keys %{$self->Benefits}){<br />
        my $value = $self->Benefits->{$key};<br />
        my $star = '*' if $key eq $benefit;<br />
        print ", " if $comma;<br />
        print "$value " if $value > 1;<br />
        print $star if $star; # can't print this in concatenation for some reason (?)<br />
        print "$key";<br />
        print $star if $star;<br />
        $comma = 1;<br />
        $star = '';<br />
    }<br />
    print "\n";<br />
}</p>
<p># TODO: Can't set attribute to zero.  (Doesn't matter technically, though!)<br />
sub attribute {<br />
    my ($self, $att, $val) = @_;<br />
    for(0..5){<br />
        my $num = $_;<br />
        if ($self->AttributeNames->[$num] =~ /^$att/i){<br />
            my $silly = $self->AttributeValues->[$num];<br />
            $self->AttributeValues->[$num] = $val if $val;<br />
            return $self->AttributeValues->[$num];<br />
        }<br />
    }<br />
    #returns undef if attribute not found.<br />
    return undef();<br />
}</p>
<p>sub process {<br />
    my ($self) = @_;<br />
    $self->Callback->process();<br />
}</p>
<p># The Environment should take care of this...<br />
# But the Environment doesn't know about the CallBack object...<br />
sub cell {<br />
    my $self = shift;<br />
    my $value = $self->Environment->cell(@_);<br />
    #Check ReadAsTable for any required translation/interpretation<br />
    $value = $self->Environment->ReadAsTable()->{$value} if $self->Environment->ReadAsTable()->{$value};<br />
    #Check Callback to resolve any required user input if we have semi-colons...<br />
    if ($value =~ /;/){<br />
        $value = $self->Callback->choose($value);<br />
    }<br />
    return $value;<br />
}</p>
<p>sub generate {<br />
    my $self = shift;</p>
<p>    $self->initialize();<br />
    $self->display_attributes();<br />
    $self->enlist();<br />
    $self->mainloop();</p>
<p>    my $terms = $self->Terms();<br />
    print "You completed $terms terms.\n";</p>
<p>    if ($self->Alive()){<br />
        $self->BenefitsToPick($self->Terms());<br />
        $self->{BenefitsToPick}++ if $self->Rank() >= 1;<br />
        $self->{BenefitsToPick}++ if $self->Rank() >= 3;<br />
        $self->{BenefitsToPick}++ if $self->Rank() >= 5;<br />
        print "You get $self->{BenefitsToPick} at rank $self->{Rank}.\n";<br />
        $self->benefits() if $self->BenefitsToPick() > 0;<br />
    } else {<br />
        print "You are dead.\n";<br />
    }</p>
<p>    print "\nFinal Results:\n";<br />
    $self->display();<br />
}</p>
<p>sub mainloop {<br />
    my $self = shift;<br />
    print "\n";<br />
    $self->survival();</p>
<p>    if ($self->Alive()){<br />
        $self->{Terms}++;</p>
<p>        if ($self->Terms() == 1){<br />
            $self->SkillsToPick(2);<br />
        } else {<br />
            $self->SkillsToPick($self->cell('PriorService', 'Skills', $self->{Service}));<br />
        }</p>
<p>        # only check for commission if it hasn't been received<br />
        unless ($self->Commissioned()){<br />
            if ($self->Drafted() and $self->Terms() == 1){<br />
                print "No commission possible on first term if drafted.\n";<br />
            } else {<br />
                $self->commission();<br />
            }<br />
        }</p>
<p>        $self->promotion() if $self->Commissioned();<br />
        print "You get to roll for $self->{SkillsToPick} skills this term.\n";<br />
        $self->skills();<br />
        $self->aging if $self->Terms() >= 4;</p>
<p>        if ($self->Alive()){<br />
            $self->reenlist();<br />
            $self->mainloop if ($self->Reenlisted());<br />
        }<br />
    }<br />
}</p>
<p>sub benefits {<br />
    my $self = shift;<br />
    my $choice;<br />
    if ($self->{CashRollsTaken} < 3){ # Up to three rolls<br />
        $choice = $self->Callback->choose("Benefits;Cash");<br />
    } else {<br />
        $choice = "Benefits";<br />
    }</p>
<p>    if ($choice eq "Cash"){<br />
        my $roll = $self->get_d_six();<br />
        my $bonus = $self->cell("CashTable", $roll, $self->{Service});<br />
        print "You gained $bonus cash.\n";<br />
        $self->{Cash} += $bonus;<br />
        $self->{CashRollsTaken}++;<br />
    } else {<br />
        my $dm = 0;<br />
        if ($self->{Rank} >= 5){<br />
            $dm++ if $self->Callback->choose("Add One to Roll;Standard Die Roll") eq 'Add One to Roll';<br />
        }<br />
        my $roll = $self->get_d_six() + $dm;<br />
        my $benefit = $self->cell("BenefitsTable", $roll, $self->{Service});<br />
        my $amount = 1;<br />
        if ($benefit =~ /\+(\d)(\w+)/){<br />
            $benefit = $2;<br />
            $amount = +2;<br />
        }</p>
<p>        if (defined($self->attribute($benefit))){<br />
            my $value = $self->attribute($benefit);<br />
            $value += $amount;<br />
            print "Your $benefit was raised by $amount.\n";<br />
            $self->attribute($benefit, $value);<br />
        } elsif ($benefit eq 'Blade' or $benefit eq 'Gun') {<br />
            print "You receive a weapon benefit!\n";<br />
            my $choice = $self->Callback->choose($self->Environment->ReadAsTable->{"$benefit Cbt"});<br />
            if ($self->Benefits->{$choice}) {<br />
                print "You're raising $choice skill by one level.\n";<br />
                $self->raise($choice);<br />
            } else {<br />
                $self->Benefits->{$choice}++;<br />
            }<br />
        } else {<br />
            print "You gained a $benefit.\n";<br />
            $self->Benefits->{$benefit}++;<br />
        }<br />
    }<br />
    $self->{BenefitsToPick}--;<br />
    $self->benefits() if $self->BenefitsToPick() > 0;<br />
}</p>
<p>sub aging {<br />
    my $self = shift;<br />
    my $column = 4;<br />
    $column = 8 if $self->Terms() >= 8;<br />
    $column = 12 if $self->Terms() >= 12;<br />
    print "Checking for aging effects...\n";</p>
<p>    my $roll = $self->get_two_d_six();<br />
    if ($roll < $self->cell('AgingTable', 'StrenSave', $column)){<br />
        my $loss = $self->cell('AgingTable', 'StrenPenalty', $column);<br />
        print "Stength dropped by $loss.\n";<br />
        $self->AttributeValues->[0] += $loss; #TODO: add attributes to raise routine<br />
        if ($self->AttributeValues->[0] <= 0){<br />
            $roll = $self->get_two_d_six();<br />
            if ($roll >= 8){<br />
                print "You survived your aging crisis.\n";<br />
                $self->AttributeValues->[0] = 1;<br />
            } else {<br />
                $self->Alive(0);<br />
            }<br />
        }<br />
    }</p>
<p>    $roll = $self->get_two_d_six();<br />
    if ($roll < $self->cell('AgingTable', 'DextSave', $column)){<br />
        my $loss = $self->cell('AgingTable', 'DextPenalty', $column);<br />
        print "Dexterity dropped by $loss.\n";<br />
        $self->AttributeValues->[1] += $loss; #TODO: add attributes to raise routine<br />
        if ($self->AttributeValues->[1] <= 0){<br />
            $roll = $self->get_two_d_six();<br />
            if ($roll >= 8){<br />
                print "You survived your aging crisis.\n";<br />
                $self->AttributeValues->[1] = 1;<br />
            } else {<br />
                $self->Alive(0);<br />
            }<br />
        }<br />
    }</p>
<p>    $roll = $self->get_two_d_six();<br />
    if ($roll < $self->cell('AgingTable', 'EndurSave', $column)){<br />
        my $loss = $self->cell('AgingTable', 'EndurPenalty', $column);<br />
        print "Endurance dropped by $loss.\n";<br />
        $self->AttributeValues->[2] += $loss; #TODO: add attributes to raise routine<br />
        if ($self->AttributeValues->[2] <= 0){<br />
            $roll = $self->get_two_d_six();<br />
            if ($roll >= 8){<br />
                print "You survived your aging crisis.\n";<br />
                $self->AttributeValues->[2] = 1;<br />
            } else {<br />
                $self->Alive(0);<br />
            }<br />
        }<br />
    }</p>
<p>    $self->display();<br />
}</p>
<p>###################################################################################################</p>
<p>package TestMe;<br />
use strict;<br />
use warnings;</p>
<p>my $C = new Character::();<br />
$C->generate();<br />
print "--------------------------------------------------------------------------------";<br />
my $line = <STDIN>;<br />
[/sourcecode]</p>
<p>This is the data file for the program.  Save it as "BookOne.dat":</p>
<p>[sourcecode language='ruby']<br />
ReadCell "Blade Cbt" As "Dagger;Blade;Foil;Sword;Cutlass;Broadsword;Bayonet;Spear;Halberd;Pike;Cudgal"<br />
ReadCell "Gun Cbt" As "Body Pistol;Auto Pistol;Revolver;Carbine;Rifle;Auto Rifle;Shotgun;SMG;Laser Carbine;Laser Rifle"<br />
ReadCell "Vehicle" As "Grav Vehicle;Tracked Vehicle;Wheeled Vehicle;Prop-driven Fixed Wing;Jet-driven Fixed Wing;Jet-driven Fixed Wing;Helicopter;Large Watercraft;Small Watercraft;Hovercraft;Submersible"</p>
<p>Table Services:<br />
	ServiceName,	ServiceNum<br />
	Navy,		1<br />
	Marines,	2<br />
	Army,		3<br />
	Scouts,		4<br />
	Merchants,	5<br />
	Other,		6</p>
<p>Table PriorService:<br />
	Property,	1,		2,		3,		4,		5,		6<br />
	ServiceName,	Navy,		Marines,	Army,		Scouts,		Merchants,	Other<br />
	Enlistment, 	8,		9,		5,		7,		7,		3<br />
	EOneAtt,	Intel,		Intel,		Dext,		Intel,		Stren,		-<br />
	EOneVal,	8,		8,		6,		6,		7,		-<br />
	ETwoAtt,	Educ,		Stren,		Endur,		Stren,		Intel,		-<br />
	ETwoVal,	9,		8,		5,		8,		6,		-<br />
	Survival,	5,		6,		5,		7,		5,		5<br />
	STwoAtt,	Intel,		Endur,		Educ,		Endur,		Intel,		Intel<br />
	STwoVal,	7,		8,		6,		9,		7,		9<br />
	Commission,	10,		9,		5,		-,		4,		-<br />
	COneAtt,	Social,		Educ,		Endur,		-,		Intel,		-<br />
	COneVal,	9,		7,		7,		-,		6,		-<br />
	Promotion,	8,		9,		6,		-,		10,		-<br />
	POneAtt,	Educ,		Social,		Educ,		-,		Intel,		-<br />
	POneVal,	8,		8,		7,		-,		9,		-<br />
	Reenlist,	6,		6,		7,		3,		4,		5<br />
	Skills,		1,		1,		1,		2,		1,		1</p>
<p>Table Titles:<br />
	Rank,   	1,		2,		3,		4,		5,		6<br />
        1,              Ensign,         Lieutenant,     Lieutenant,     -,              4th Officer,    -<br />
        2,              Lieutenant,     Captain,        Captain,        -,              3rd Officer,    -<br />
        3,              Lt Cmdr,        Force Cmdr,     Major,          -,              2nd Officer,    -<br />
        4,              Commander,      Lt Colonel,     Lt Colonel,     -,              1st Officer,    -<br />
        5,              Captain,        Colonel,        Colonel,        -,              Captain,        -<br />
        6,              Admiral,        Brigadier,      General,        -,              Captain,        -</p>
<p>Table BenefitsTable:<br />
	Roll,		1,		2,		3,		4,		5,		6<br />
	1,		Low Psg,	Low Psg,	Low Psg,	Low Psg,	Low Psg,	Low Psg<br />
	2,		+1Intel,	+2Intel,	+1Intel,	+2Intel,	+1Intel,	+1Intel<br />
	3,		+2Educ,		+1Educ,		+2Educ,		+2Educ,		+1Educ,		+1Educ<br />
	4,		Blade,		Blade,		Gun,		Blade,		Gun,		Gun<br />
	5,		Travellers,	Travellers,	High Psg,	Gun,		Blade,		High Psg<br />
	6,		High Psg,	High Psg,	Mid Psg,	Scout Ship,	Low Psg,	-<br />
	7,		+2Social,	+2Social,	+1Social,	-,		Free Trader,	-</p>
<p>Table CashTable:<br />
	Roll,		1,		2,		3,		4,		5,		6<br />
	1,		1000,		2000,		2000,		20000,		1000,		1000<br />
	2,		5000,		5000,		5000,		20000,		5000,		5000<br />
	3,		5000,		5000,		10000,		30000,		10000,		10000<br />
	4,		10000,		10000,		10000,		30000,		20000,		10000<br />
	5,		20000,		20000,		10000,		50000,		20000,		10000<br />
	6,		50000,		30000,		20000,		50000,		40000,		50000<br />
	7,		50000,		40000,		30000,		50000,		40000,		100000</p>
<p>Table RankAndServiceSkills:<br />
	Rank,		1,		2,		3,		4,		5,		6<br />
	0,		-,		Cutlass,	Rifle,		Pilot,		-,		-<br />
	1,		-,		Revolver,	SMG,		-,		-,		-<br />
	2,		-,		-,		-,		-,		-,		-<br />
	3,		-,		-,		-,		-,		-,		-<br />
	4,		-,		-,		-,		-,		-,		-<br />
	5,		Social,		-,		-,		-,		Pilot,		-<br />
	6,		Social,		-,		-,		-,		-,		-</p>
<p>Table PersonalDevelopmentSkills:<br />
	Roll,		1,		2,		3,		4,		5,		6<br />
	1,		Stren,		Stren,		Stren,		Stren,		Stren,		Stren<br />
	2,		Dext,		Dext,		Dext,		Dext,		Dext,		Dext<br />
	3,		Endur,		Endur,		Endur,		Endur,		Endur,		Endur<br />
	4,		Intel,		Gambling,	Gambling,	Intel,		Stren,		Blade Cbt<br />
	5,		Educ,		Brawling,	Educ,		Educ,		Blade Cbt,	Brawling<br />
	6,		Social,		Blade Cbt,	Brawling,	Gun Cbt,	Bribery,	Social</p>
<p>Table ServiceSkills:<br />
	Roll,		1,		2,		3,		4,		5,		6<br />
	1,		Ships Boat, 	ATV,		ATV,		Air/Raft,	Vehicle,	Vehicle<br />
	2,		Vacc Suit,	Vacc Suit,	Air/Raft,	Vacc Suit,	Vacc Suit,	Gambling<br />
	3,		Fwd Obsvr,	Blade Cbt,	Gun Cbt,	Mechanical,	Jack-o-T,	Brawling<br />
	4,		Gunnery,	Gun Cbt,	Fwd Obsvr,	Navigation,	Steward,	Bribery<br />
	5,		Blade Cbt,	Blade Cbt,	Blade Cbt,	Electronics,	Electronics,	Blade Cbt<br />
	6,		Gun Cbt,	Gun Cbt,	Gun Cbt,	Jack-o-T,	Gun Cbt,	Gun Cbt</p>
<p>Table AdvancedSkills:<br />
	Roll,		1,		2,		3,		4,		5,		6<br />
	1,		Vacc Suit,	Vehicle,	Vehicle,	Vehicle,	Streetwise,	Streetwise<br />
	2,		Mechanical,	Mechanical,	Mechanical,	Mechanical,	Mechanical,	Mechanical<br />
	3,		Electronics,	Electronics,	Electronics,	Electronics,	Electronics,	Electronics<br />
	4,		Engineering,	Tactics,	Tactics,	Jack-o-T,	Navigation,	Gambling<br />
	5,		Gunnery,	Blade Cbt,	Blade Cbt,	Gunnery,	Gunnery,	Brawling<br />
	6,		Jack-o-T,	Gun Cbt,	Gun Cbt,	Medical,	Medical,	Forgery</p>
<p>Table HighlyAdvancedSkills:<br />
	Roll,		1,		2,		3,		4,		5,		6<br />
	1,		Medical,	Medical,	Medical,	Medical,	Medical,	Medical<br />
	2,		Navigation,	Tactics,	Tactics,	Navigation,	Navigation,	Forgery<br />
	3,		Engineering,	Tactics,	Tactics,	Engineering,	Engineering,	Electronics<br />
	4,		Computer,	Computer,	Computer,	Computer,	Computer,	Computer<br />
	5,		Pilot,		Leader,		Leader,		Pilot,		Pilot,		Streetwise<br />
	6,		Admin,		Admin,		Admin,		Jack-o-T,	Admin,		Jack-o-T</p>
<p>Table AgingTable:<br />
	Attribute,	4,		8,		12<br />
	StrenPenalty,	-1,		-1,		-2<br />
	StrenSave,	8,		9,		9<br />
	DextPenalty,	-1,		-1,		-2<br />
	DextSave,	7,		8,		9<br />
	EndurPenalty,	-1,		-1,		-2<br />
	EndurSave,	8,		9,		9<br />
	IntelPenalty,	0,		0,		-1<br />
	IntelSave,	2,		2,		9<br />
[/sourcecode]</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Perl Membaca File Excel]]></title>
<link>http://akhdaniel.wordpress.com/?p=81</link>
<pubDate>Mon, 06 Oct 2008 10:04:13 +0000</pubDate>
<dc:creator>akhdaniel</dc:creator>
<guid>http://akhdaniel.wordpress.com/2008/10/06/perl-membaca-file-excel/</guid>
<description><![CDATA[Modul yang diperlukan
Agar script perl bisa membaca file XLS, maka diperlukan modul tambahan sbb:

M]]></description>
<content:encoded><![CDATA[<h3>Modul yang diperlukan</h3>
<p>Agar script perl bisa membaca file XLS, maka diperlukan modul tambahan sbb:</p>
<ol>
<li>Module-Build (jika belum diinstall secara default, diperlukan untuk meng-compile dan install modul-modul lainnya dibawah ini)</li>
<li>Spreadsheet::ParseExcel;</li>
<li>OLE-Storage</li>
<li>IO-stringy</li>
</ol>
<h3>Installasi Modul</h3>
<p>Agak rumit tapi bisa. Rumitnya karena modul-modul tersebut belum ada package nya sehingga tidak bisa diinstall menggunakan Yum dan kawan-kawan.</p>
<p>Jadi masing-masing modul harus diinstall secara manual menggunakan Makefile yang terdapat di masing-masing source code module tersebut.</p>
<p>Langkah pertama adalah download modul ybs. Misalnya Spreadsheet::ParseExcel. Lokasi downloadnya dapat dicari dari <a href="http://search.cpan.org">search.cpan.org.</a> Cari nama modul di kolom search. Kemudian lihat di bagian Download link (di sebelah kanan halaman).</p>
<p><a href="http://akhdaniel.files.wordpress.com/2008/10/download-modul.jpg"><img class="alignnone size-full wp-image-83" title="download-modul" src="http://akhdaniel.wordpress.com/files/2008/10/download-modul.jpg" alt="" width="450" height="297" /></a></p>
<p>Copy link tersebut lalu download menggunakan program download yang anda sukai, misalnya wget.</p>
<pre># wget http://search.cpan.org/CPAN/authors/id/S/SZ/SZABGAB/Spreadsheet-ParseExcel-0.33.tar.gz</pre>
<p>Jika sudah berhasil download, maka extract file tersebut ke sembarang direktori.</p>
<pre># tar xvfpz Spreadsheet-ParseExcel-0.33.tar.gz</pre>
<p>Lalu masuk ke direktori hasil extract:</p>
<pre># cd Spreadsheet-ParseExcel-0.33</pre>
<p>Baca cara installnya pada file README (atau INSTALL).  Menurut file tersebut, cara installnya ada beberapa model:</p>
<pre>INSTALLATION
    The module can be installed using the standard Perl procedure:

        perl Build.PL
        ./Build
        ./Build test
        ./Build install

      or

        perl Makefile.PL
        make
        make test
        make install    # You may need to be root
        make clean      # or make realclean

      or using CPAN.pm or CPANPLUS.pm

        cpan Spreadsheet::ParseExcel</pre>
<p>Misalnya kita ambil cara pertama, maka langkah yang dilakukan adalah menjalankan perintah:</p>
<pre># perl Build.PL</pre>
<p>Setelah sukses, lanjutkan ke perintah:</p>
<pre># ./Build</pre>
<p>Kemudian perintah:</p>
<pre># ./Build test</pre>
<p>Diakhiri dengan perintah (untuk yang ini anda harus login sebagai root):</p>
<pre># ./Build install</pre>
<p>Setelah sukses install, maka modul ini sudah siap digunakan. Lakukan installasi modul yang lainnya (OLE-Storage dan IO-stringly)  dengan cara yang sama seperti di atas.</p>
<h3>Contoh Script untuk Membaca Excel</h3>
<ol>
<li>
<pre>use Spreadsheet::ParseExcel;</pre>
</li>
<li>
<pre>my $oExcel = new Spreadsheet::ParseExcel;</pre>
</li>
<li>
<pre>my $oBook = $oExcel-&#62;Parse($file);</pre>
</li>
<li>
<pre>my($iR, $iC, $oWkS, $oWkC);</pre>
</li>
<li>
<pre>for(my $iSheet=0; $iSheet &#60; $oBook-&#62;{SheetCount} ; $iSheet++) {</pre>
</li>
<li>
<pre>    $oWkS = $oBook-&#62;{Worksheet}[$iSheet];</pre>
</li>
<li>
<pre>    for(my $iR = $oWkS-&#62;{MinRow};</pre>
</li>
<li>
<pre>        defined $oWkS-&#62;{MaxRow} &#38;&#38; $iR &#60;= $oWkS-&#62;{MaxRow};</pre>
</li>
<li>
<pre>        $iR++)    {</pre>
</li>
<li>
<pre>            my $a = $oWkS-&#62;{Cells}[$iR][0];</pre>
</li>
<li>
<pre>            my $b = $oWkS-&#62;{Cells}[$iR][1];</pre>
</li>
<li>
<pre>            print $a-&#62;Value, " ", $b-&#62;Value;</pre>
</li>
<li>
<pre>        }</pre>
</li>
<li>
<pre>}</pre>
</li>
</ol>
<p>Baris 1, adalah pemanggilan modul Spreadsheet::Excel. Baris 2 adalah pendefinisian object variabel yang merepresentasikan pemroses file Excel. Baris 3 mendefinisikan Workbook Excel yang hendak dibaca yang nama filenya ditentukan diparameter.</p>
<p>Baris 4 adalah definisi variabel lokal yang akan digunakan selama proses pembacaan file yaitu: $iR indeks baris, $iC indeks kolom, $oWkS suatu worksheet, dan $oWkC suatu cell.</p>
<p>Baris 5 adalah looping untuk setiap worksheet yang ada pada file Excel yang dibaca. Baris 6 untuk setiap worksheet yang terbaca, simpan referensinya ke variabel $oWkS.</p>
<p>Baris 7 looping untuk setiap baris yang terdapat pada worksheet yang sedang dibaca dimulai dari baris yang paling kecil ($oWkS-&#62;{MinRow}) sampai dengan baris terakhir ( $oWkS-&#62;{MaxRow} ). Yang dilakukan setiap looping baris adalah membaca isi cell pada baris tersebut, yaitu dengan cara  $oWkS-&#62;{Cells}[$iR][0] seperti pada baris 10 dan 11, dimana array yang kedua (dalam hal ini 0) adalah indeks kolom pada baris tersebut, dimulai dari 0.</p>
<p>Terakhir adalah mengambil nilai pada cell tersebut dengan cara memanggil properti Value object cell seperti pada baris 12.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Perl konek ke PostgreSQL]]></title>
<link>http://akhdaniel.wordpress.com/?p=79</link>
<pubDate>Mon, 06 Oct 2008 09:26:09 +0000</pubDate>
<dc:creator>akhdaniel</dc:creator>
<guid>http://akhdaniel.wordpress.com/2008/10/06/perl-konek-ke-postgresql/</guid>
<description><![CDATA[Modul Perl yang diperlukan
Agar program Perl bisa konek ke Posgres diperlukan modul tambahan Perl se]]></description>
<content:encoded><![CDATA[<h2>Modul Perl yang diperlukan</h2>
<p>Agar program Perl bisa konek ke Posgres diperlukan modul tambahan Perl sebagai berikut:</p>
<ol>
<li>DBI</li>
<li>DBD::Pg</li>
</ol>
<h2>Instalasi Modul di Linux</h2>
<p>Untuk sistem operasi Linux, installasi modul sangat mudah dilakukan, yaitu dengan menggunakan program RPM, Yum, dan sebagainya.</p>
<p>Sebagai contoh untuk menginstall modul DBD::Pg, lakukan langkah-langkah sbb:</p>
<p>Cari nama package modul jika belum diketaui secara pasti.</p>
<pre># yum search perl-dbd</pre>
<p>hasilnya misalnya (bisa beda-beda setiap komputer):</p>
<pre>Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
 * base: centosq2.centos.org
 * updates: centosw.centos.org
 * addons: centosk2.centos.org
 * extras: centosw.centos.org
perl-DBD-Pg.x86_64 : A PostgresSQL interface for perl
perl-DBD-MySQL.x86_64 : A MySQL interface for perl</pre>
<p>Dari hasil pencarian tersebut dapat diketahui nama file modul yang perlu diinstal secara pasti, yaitu <strong>perl-DBD-Pg.x86_64</strong>.</p>
<p>Jalankan perintah install sebagai berikut:</p>
<pre># yum install perl-DBD-Pg.x86_64</pre>
<p>Pastikan tidak ada pesan error. Jika sudah sukses, maka modul DBD::Pg siap digunakan. Modul DBI umumnya sudah diinstall secara default. Namun jika belum (diketahui dari pesan error saat install DBD::Pg) maka lakukan langkah yang sama seperti di atas untuk modul DBI.</p>
<h2>Instalasi Modul di Windows</h2>
<p>Untuk Sistem operasi Windows gunakan ActiveState Perl. Pada program tersebut terdapat program utiliti ppm (perl package manager) yang dapat digunakan untuk mengelola modul.</p>
<h2>Script Koneksi Postgres</h2>
<p>Langkah pemanggilan fungsi yang perlu dilakukan oleh script Perl untuk konek dan query ke Postgres adalah:</p>
<ol>
<li>function $dbh = DBI-&#62;connect()</li>
<li>function $sth = dbh-&#62;prepare($sql)</li>
<li>function $sth-&#62;execute;</li>
<li>jika diperlukan untuk mengambil data: function $sth-&#62;fetchrow()</li>
</ol>
<p>Langkah pertama adalah memanggil modul DBI untukmelakukan koneksi ke database.  Seacara lengkap sintaksnya adalah :</p>
<pre>$dbh = DBI-&#62;connect("dbi:Pg:dbname=namadatabase", 'namauser', 'password', {AutoCommit =&#62; 1});</pre>
<p>Dimana paramenter pertama "dbi:Pg:dbname=namadatabase" adalah parameter koneksi ke server. Dapat ditambahkan dengan string hostname dan port yang jika tidak dicantumkan maka diasumsikan localhost port 5432.</p>
<p>Parameter kedua dan ketiga adalah nama user database dan password nya yang digunakan untuk melakukan koneksi.</p>
<p>Parameter ke empat {AutoCommit =&#62; 1} adalah option yang menentukan apakah setiap query akan otomatis di commit atau tidak. Jika Tidak maka perlu dijalanlan function $dbh-&#62;commit().</p>
<p>Setelah berhasil konek, langkah selanjutnya adalah mempersiapkan SQL statement yang akan dikirimkan ke server. Perintah selengkapnya misalnya sbb:</p>
<pre>$sql = "select * from namatable";
$sth = $dbh-&#62;prepare($sql);</pre>
<p>Setelah dipersiapkan, maka panggil function execute untuk mengeksekusi SQL:</p>
<pre>$sth-&#62;execute;</pre>
<p>Jika SQL yang dijalankan mengeluarkan hasil (misalnya SQL SELECT), maka data yang dihasilkan ditangkap dengan menggunakan function $sth-&#62;fetchrow() yang dilooping sampai dengan data tersebut habis, sebagai berikut:</p>
<pre>while ( my @row = $sth-&#62;fetchrow() )
{
     print $row[0] , $row[0];
}</pre>
<p>Untuk SQL yang tidak mengeluarkan hasil (misalnya SQL INSERT, UPDATE), maka tidak perlu dilakukan pemanggilan function fetchrow().</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Why Open Source will be hot now?]]></title>
<link>http://aghreni.wordpress.com/?p=21</link>
<pubDate>Sun, 05 Oct 2008 10:33:55 +0000</pubDate>
<dc:creator>aghreni</dc:creator>
<guid>http://aghreni.wordpress.com/2008/10/05/why-open-source-will-be-hot-now/</guid>
<description><![CDATA[With the deepening of the credit crisis, melt down in the financial industry, the IT budgets in the ]]></description>
<content:encoded><![CDATA[<p>With the deepening of the credit crisis, melt down in the financial industry, the IT budgets in the big companies is under squeeze.</p>
<p>Companies are looking at optimising their IT budgets and seriously looking at Return on their investments. The commercial software license costs; be in hardware, operating system, infrastructure, database, commercial applications and consulting &#38; support, is being reviewed and seriously considered for optimising and cost cutting.</p>
<p>Open source software and solutions have a great opportunity to survive and benefit in this economy as they provide better returns for the companies that are looking to save huge licensing costs and greater availability of solutions and software that can be easily adopted.</p>
<p>Open source software and solutions have matured over years and a bigger community to support them. There are several solutions from multiple vendors for business problems and substantially less expensive compared to commercial software from the proprietary software companies.</p>
<p>According to statistics, open source solutions did really well during the last economic downturn in the year 2000 and 2001.</p>
<p>Aghreni technologies started at Banglore, India realising the potential of open-source technologies and solutions and its impact on society and enterprises, is focussing on providing open source technology services and solutions.</p>
<p>Aghreni's business solutions practices provides consulting and implementation services major open source ERP, BI, Content Management and Email Marketing applications.</p>
<p>Aghreni provides product incubation and services on open source technologies like Java, perl and php. It has an interesting mix of services on open source technologies and trying to promote them in a big way. It has also embarked in creating the talent pool locally through their education services targetted at college students who would like to build their career on open source technologies early in their college.</p>
<p>For more information on the company, you can visit their website <a href="http://www.aghreni.com">http://www.aghreni.com</a> or drop an email at <a href="mailto:info@aghreni.com">info@aghreni.com</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Perlメモ：関数呼び出しを調べる時]]></title>
<link>http://tonecolor.wordpress.com/?p=63</link>
<pubDate>Sun, 05 Oct 2008 07:26:56 +0000</pubDate>
<dc:creator>tara123</dc:creator>
<guid>http://tonecolor.wordpress.com/2008/10/05/perl%e3%83%a1%e3%83%a2%ef%bc%9a%e9%96%a2%e6%95%b0%e5%91%bc%e3%81%b3%e5%87%ba%e3%81%97%e3%82%92%e8%aa%bf%e3%81%b9%e3%82%8b%e6%99%82/</guid>
<description><![CDATA[Perlで簡単なStackTraceを出す。滅多に使わないが、どこから呼び出されたの]]></description>
<content:encoded><![CDATA[<p>Perlで簡単なStackTraceを出す。滅多に使わないが、どこから呼び出されたのかを知りたい時とかcaller関数を使えばいい。</p>
<blockquote>
<pre>$data = 1;

$data = &#38;funcA($data);
print $data,"\n";

sub funcA {
    my $data = shift;
    $data++;

    return &#38;funcB($data);
}

sub funcB {
    my $data = shift;
    $data = $data + 10;
    return &#38;funcC($data);
}

sub funcC {
    my $data = shift;
    $data = $data + 100;

    &#38;trace_print();
    return $data;

}

sub trace_print {

    #caller(0)はtrace_print関数になってしまうから入れない。
    for ($i=5; $i&#62;0; $i--){
        my($line,$subr) = (caller($i))[2,3];
        print $subr,':',$line,"\n";
    }

}</pre>
</blockquote>
<p>結果はこうなる。</p>
<blockquote>
<pre>:
:
main::funcA:4　　　
main::funcB:11
main::funcC:17　　&#60;- 呼び出された順に表示する。
112      &#60;-最後のプリント文で結果表示</pre>
</blockquote>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Perlメモ：BCDとの変換]]></title>
<link>http://tonecolor.wordpress.com/?p=61</link>
<pubDate>Sun, 05 Oct 2008 02:42:51 +0000</pubDate>
<dc:creator>tara123</dc:creator>
<guid>http://tonecolor.wordpress.com/2008/10/05/perl%e3%83%a1%e3%83%a2%ef%bc%9abcd%e3%81%a8%e3%81%ae%e5%a4%89%e6%8f%9b/</guid>
<description><![CDATA[数字をBCDへ変換、また逆をする。符号なんかを意識しない場合は単純に1行]]></description>
<content:encoded><![CDATA[<p>数字をBCDへ変換、また逆をする。符号なんかを意識しない場合は単純に1行でできる。packとunpackは何故かすぐに忘れるなぁ。</p>
<blockquote>
<pre>sub num2bcd{
   my $num = shift;
   return pack("H*",$num);

}

sub bcd2num{
    my $bcd = shift;
    return unpack("H*",$bcd);

}</pre>
</blockquote>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Installing Perl's CPANPLUS Module for OS X 10.5+]]></title>
<link>http://repettas.wordpress.com/?p=531</link>
<pubDate>Sat, 04 Oct 2008 12:48:00 +0000</pubDate>
<dc:creator>repettas</dc:creator>
<guid>http://repettas.wordpress.com/2008/10/04/installing-perls-cpanplus-module-for-os-x-105/</guid>
<description><![CDATA[Install CPANPLUS for Apple&#8217;s OS X 10.5+ Operating System
The source for CPANPLUS is located at]]></description>
<content:encoded><![CDATA[<h2>Install CPANPLUS for Apple's OS X 10.5+ Operating System</h2>
<p>The source for CPANPLUS is located at: </p>
<p><a href="http://search.cpan.org/search?query=cpanplus&#38;mode=all">http://search.cpan.org/search?query=cpanplus&#38;mode=all</a></p>
<p>To begin you just need to download the API and CLI source which should be the first item in the list, the other entries are modules for CPANPLUS that you can elect to install after install CPANPLUS. I'm keeping this post very simple so I won't delve into the inner workings of CPAN/CPANPLUS and the many features available to you for configuration, etc. </p>
<p>If you haven't used Perl on your Apple yet, you have a fresh install of OS X, ... you will need to install several prerequisite packages before you can install CPANPLUS.</p>
<p>Without going into details I'll try to make an attempt to outline the steps to configure perl for the first time on your Apple machine with just enough details to get you started and to the point where you have CPANPLUS installed.</p>
<p>Beginning with Perl Version 5.004 and later CPAN comes with the Perl package and this is the module you use to install other mdoules. To Invoke CPAN and install the module IPC::Cmd type the following:</p>
<p>su - root - Log in as root or you can use sudo to execute the commands, I put my .cpan and .cpanplus directories in /Users/shared. If you intend on placing the new Perl Programs in the System Directory Structure you have to use sudo to make install, otherwise your account (even though it may be the administrator account) does not have access to overwrite files located in the System Directory Structure. You can compile and test Perl modules but you will not be able to install them.</p>
<p>su - root<br />
cd /Users/Shared</p>
<p>perl -MCPAN -e shell</p>
<p>/System/Library/Perl/5.8.8/CPAN/Config.pm initialized.</p>
<p>CPAN is the world-wide archive of perl resources. It consists of about<br />
100 sites that all replicate the same contents all around the globe.<br />
Many countries have at least one CPAN site already. The resources<br />
found on CPAN are easily accessible with the CPAN.pm module. If you<br />
want to use CPAN.pm, you have to configure it properly.</p>
<p>If you do not want to enter a dialog now, you can answer 'no' to this<br />
question and I'll try to autoconfigure. (Note: you can revisit this<br />
dialog anytime later by typing 'o conf init' at the cpan prompt.)</p>
<p>Are you ready for manual configuration? [yes]<br />
The following questions are intended to help you with the<br />
configuration. The CPAN module needs a directory of its own to cache<br />
important index files and maybe keep a temporary mirror of CPAN files.<br />
This may be a site-wide directory or a personal directory.</p>
<p>First of all, I'd like to create this directory. Where?</p>
<p>CPAN build and cache directory? [/var/root/.cpan] </p>
<p>If you want, I can keep the source files after a build in the cpan<br />
home directory. If you choose so then future builds will take the<br />
files from there. If you don't want to keep them, answer 0 to the<br />
next question.</p>
<p>How big should the disk cache be for keeping the build directories<br />
with all the intermediate files?</p>
<p>Cache size for build directory (in MB)? [10] 30</p>
<p>By default, each time the CPAN module is started, cache scanning<br />
is performed to keep the cache size in sync. To prevent from this,<br />
disable the cache scanning with 'never'.</p>
<p>Perform cache scanning (atstart or never)? [atstart]<br />
To considerably speed up the initial CPAN shell startup, it is<br />
possible to use Storable to create a cache of metadata. If Storable<br />
is not available, the normal index mechanism will be used.</p>
<p>Cache metadata (yes/no)? [yes]<br />
The next option deals with the charset your terminal supports. In<br />
general CPAN is English speaking territory, thus the charset does not<br />
matter much, but some of the aliens out there who upload their<br />
software to CPAN bear names that are outside the ASCII range. If your<br />
terminal supports UTF-8, you say no to the next question, if it<br />
supports ISO-8859-1 (also known as LATIN1) then you say yes, and if it<br />
supports neither nor, your answer does not matter, you will not be<br />
able to read the names of some authors anyway. If you answer no, names<br />
will be output in UTF-8.</p>
<p>Your terminal expects ISO-8859-1 (yes/no)? [yes]<br />
If you have one of the readline packages (Term::ReadLine::Perl,<br />
Term::ReadLine::Gnu, possibly others) installed, the interactive CPAN<br />
shell will have history support. The next two questions deal with the<br />
filename of the history file and with its size. If you do not want to<br />
set this variable, please hit SPACE RETURN to the following question.</p>
<p>File to save your history? [/var/root/.cpan/histfile]<br />
Number of lines to save? [100] 500<br />
The CPAN module can detect when a module that which you are trying to<br />
build depends on prerequisites. If this happens, it can build the<br />
prerequisites for you automatically ('follow'), ask you for<br />
confirmation ('ask'), or just ignore them ('ignore'). Please set your<br />
policy to one of the three values.</p>
<p>Policy on building prerequisites (follow, ask or ignore)? [ask] follow<br />
The CPAN module will need a few external programs to work properly.<br />
Please correct me, if I guess the wrong path for a program. Don't<br />
panic if you do not have some of them, just press ENTER for those. To<br />
disable the use of a download program, you can type a space followed<br />
by ENTER.</p>
<p>Where is your gzip program? [/usr/bin/gzip]<br />
Where is your tar program? [/usr/bin/tar]<br />
Where is your unzip program? [/usr/bin/unzip]<br />
Where is your make program? [/usr/bin/make]<br />
Warning: lynx not found in PATH<br />
Where is your lynx program? []<br />
Warning: wget not found in PATH<br />
Where is your wget program? []<br />
Warning: ncftpget not found in PATH<br />
Where is your ncftpget program? []<br />
Warning: ncftp not found in PATH<br />
Where is your ncftp program? []<br />
Where is your ftp program? [/usr/bin/ftp]<br />
Warning: gpg not found in PATH<br />
Where is your gpg program? []<br />
What is your favorite pager program? [col -b &#124; bbedit --clean --view-top]<br />
What is your favorite shell? [/bin/sh] </p>
<p>Every Makefile.PL is run by perl in a separate process. Likewise we<br />
run 'make' and 'make install' in processes. If you have any<br />
parameters (e.g. PREFIX, LIB, UNINST or the like) you want to pass<br />
to the calls, please specify them here.</p>
<p>If you don't understand this question, just press ENTER.</p>
<p>Parameters for the 'perl Makefile.PL' command?<br />
Typical frequently used settings:</p>
<p>    PREFIX=~/perl       non-root users (please see manual for more hints)</p>
<p>Your choice:  []<br />
Parameters for the 'make' command?<br />
Typical frequently used setting:</p>
<p>    -j3              dual processor system</p>
<p>Your choice:  []<br />
Parameters for the 'make install' command?<br />
Typical frequently used setting:</p>
<p>    UNINST=1         to always uninstall potentially conflicting files</p>
<p>Your choice:  [] </p>
<p>Sometimes you may wish to leave the processes run by CPAN alone<br />
without caring about them. As sometimes the Makefile.PL contains<br />
question you're expected to answer, you can set a timer that will<br />
kill a 'perl Makefile.PL' process after the specified time in seconds.</p>
<p>If you set this value to 0, these processes will wait forever. This is<br />
the default and recommended setting.</p>
<p>Timeout for inactivity during Makefile.PL? [0]<br />
If you're accessing the net via proxies, you can specify them in the<br />
CPAN configuration or via environment variables. The variable in<br />
the $CPAN::Config takes precedence.</p>
<p>Your ftp_proxy?<br />
Your http_proxy?<br />
Your no_proxy?<br />
You have no /var/root/.cpan/sources/MIRRORED.BY<br />
  I'm trying to fetch one<br />
CPAN: LWP::UserAgent loaded ok<br />
Fetching with LWP:<br />
  ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY</p>
<p>Now we need to know where your favorite CPAN sites are located. Push<br />
a few sites onto the array (just in case the first on the array won't<br />
work). If you are mirroring CPAN to your local workstation, specify a<br />
file: URL.</p>
<p>First, pick a nearby continent and country (you can pick several of<br />
each, separated by spaces, or none if you just want to keep your<br />
existing selections). Then, you will be presented with a list of URLs<br />
of CPAN mirrors in the countries you selected, along with previously<br />
selected URLs. Select some of those URLs, or just keep the old list.<br />
Finally, you will be prompted for any extra URLs -- file:, ftp:, or<br />
http: -- that host a CPAN mirror.</p>
<p>(1) Africa<br />
(2) Asia<br />
(3) Central America<br />
(4) Europe<br />
(5) North America<br />
(6) Oceania<br />
(7) South America<br />
Select your continent (or several nearby continents) [] 5<br />
Sorry! since you don't have any existing picks, you must make a<br />
geographic selection.</p>
<p>(1) Bahamas<br />
(2) Canada<br />
(3) Mexico<br />
(4) United States<br />
Select your country (or several nearby countries) [] 4<br />
Sorry! since you don't have any existing picks, you must make a<br />
geographic selection.</p>
<p>(1)<br />
(2) ftp://carroll.cac.psu.edu/pub/CPAN/<br />
(3) ftp://cpan-du.viaverio.com/pub/CPAN/<br />
(4) ftp://cpan-sj.viaverio.com/pub/CPAN/<br />
(5) ftp://cpan.calvin.edu/pub/CPAN<br />
(6) ftp://cpan.cs.utah.edu/pub/CPAN/<br />
(7) ftp://cpan.erlbaum.net/CPAN/<br />
(8) ftp://cpan.hexten.net/<br />
(9) ftp://cpan.hostrack.net/pub/CPAN<br />
(10) ftp://cpan.llarian.net/pub/CPAN/<br />
(11) ftp://cpan.mirrors.redwire.net/pub/CPAN/<br />
(12) ftp://cpan.mirrors.tds.net/pub/CPAN<br />
(13) ftp://cpan.netnitco.net/pub/mirrors/CPAN/<br />
(14) ftp://cpan.pair.com/pub/CPAN/<br />
(15) ftp://csociety-ftp.ecn.purdue.edu/pub/CPAN<br />
(16) ftp://ftp-mirror.internap.com/pub/CPAN/<br />
38 more items, hit SPACE RETURN to show them<br />
Select as many URLs as you like (by number),<br />
put them on one line, separated by blanks, e.g. '1 4 5' [] 16 6 13 8 2</p>
<p>Enter another URL or RETURN to quit: []<br />
New set of picks:<br />
  ftp://ftp-mirror.internap.com/pub/CPAN/<br />
  ftp://cpan.cs.utah.edu/pub/CPAN/<br />
  ftp://cpan.netnitco.net/pub/mirrors/CPAN/<br />
  ftp://cpan.hexten.net/<br />
  ftp://carroll.cac.psu.edu/pub/CPAN/</p>
<p>commit: wrote /System/Library/Perl/5.8.8/CPAN/Config.pm</p>
<p>cpan shell -- CPAN exploration and modules installation (v1.7602)<br />
ReadLine support enabled</p>
<p>cpan&#62; exit</p>
<p>My list of missing modules when I attempted to install CPANPLUS were;</p>
<p>Checking if your kit is complete...<br />
Looks good<br />
Warning: prerequisite Archive::Extract 0.16 not found.<br />
Warning: prerequisite File::Fetch 0.13_04 not found.<br />
Warning: prerequisite IPC::Cmd 0.36 not found.<br />
Warning: prerequisite Log::Message 0.01 not found.<br />
Warning: prerequisite Module::CoreList 2.09 not found.<br />
Warning: prerequisite Module::Load 0.10 not found.<br />
Warning: prerequisite Module::Load::Conditional 0.18 not found.<br />
Warning: prerequisite Module::Loaded 0.01 not found.<br />
Warning: prerequisite Object::Accessor 0.32 not found.<br />
Warning: prerequisite Package::Constants 0.01 not found.<br />
Warning: prerequisite Params::Check 0.22 not found.<br />
Warning: prerequisite Term::UI 0.18 not found.<br />
Warning: prerequisite Test::Harness 2.62 not found. We have 2.56.<br />
Warning: prerequisite version 0.73 not found. We have 0.700.<br />
Writing Makefile for CPANPLUS</p>
<p>perl -MCPAN -e shell (from /Users/Shared)</p>
<p>install Archive::Extract<br />
...<br />
install version<br />
exit</p>
<p>cd $HOME/Downloads; cd cpanplus-0.84 (location of the CPANPLUS source from earlier download):</p>
<p>perl Makefile.PL</p>
<p>imac:cpanplus-0.84 repettas$ perl Makefile.PL</p>
<p>### IMPORTANT! ######################################################</p>
<p>As of CPANPLUS 0.070, configuration during 'perl Makefile.PL'<br />
is no longer required. A default config is now shipped that<br />
should work out of the box on most machines, for priviliged<br />
and unprivileged users.</p>
<p>If you wish to configure CPANPLUS to your environment, you can<br />
either do that from the interactive shell after installation:</p>
<p>    $ cpanp<br />
    CPAN Terminal&#62; s reconfigure</p>
<p>Or you can invoke this program as follows, to do it now:</p>
<p>    $ perl Makefile.PL --setup      </p>
<p>This also means that any config created by any CPANPLUS older<br />
than 0.070 will no longer work, and you are required to<br />
reconfigure. See the ChangeLog file for details.</p>
<p>We appologize for the inconvenience.</p>
<p>### PLEASE NOTE ###################################################</p>
<p>Since CPANPLUS has a few prerequisites that are not included<br />
in versions of perl prior to 5.9.5, they are bundled with the<br />
distribution for boot-strapping purposes.</p>
<p>You should install these prerequisites before continuing to<br />
install CPANPLUS. You can do this from the build directory<br />
with the following commands:</p>
<p>    $ perl bin/cpanp-boxed -s selfupdate dependencies<br />
    $ perl bin/cpanp-boxed -s selfupdate enabled_features</p>
<p>Or you may install them using your system's package manager.</p>
<p>###################################################################</p>
<p>Writing Makefile for CPANPLUS</p>
<p>make<br />
make test</p>
<p>If everything builds and tests without errors you are ready to install CPANPLUS by issuing the following line;</p>
<p>make install</p>
<p>To update CPANPLUS do the following;</p>
<p>su - root<br />
cd /Users/Shared</p>
<p>cpanp<br />
s selfupdate all</p>
<p>You can get help by entering in help from the command prompt inside of cpanp. There are several options for the selfupdate which you can see by typing in: s selfupdate (return). You can execute the selfupdate and view what it will do without actually executing the command by using the flag --dryrun at the end of the command line.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Perlメモ：配列からハッシュを一度に生成]]></title>
<link>http://tonecolor.wordpress.com/?p=54</link>
<pubDate>Sat, 04 Oct 2008 03:34:10 +0000</pubDate>
<dc:creator>tara123</dc:creator>
<guid>http://tonecolor.wordpress.com/2008/10/04/perl%e3%83%a1%e3%83%a2%ef%bc%9a%e9%85%8d%e5%88%97%e3%81%8b%e3%82%89%e3%83%8f%e3%83%83%e3%82%b7%e3%83%a5%e3%82%92%e4%b8%80%e5%ba%a6%e3%81%ab%e7%94%9f%e6%88%90/</guid>
<description><![CDATA[perlでハッシュを生成するとき、キーと中身を配列から一気に作成する。

@]]></description>
<content:encoded><![CDATA[<p>perlでハッシュを生成するとき、キーと中身を配列から一気に作成する。</p>
<blockquote>
<pre>@key_array = ('a','b','c');
@val_array = (111,222,333);

@h{@key_array} = @val_array;

foreach $key ( sort keys %h ) {
    print $key,"-&#62;",$h{$key},"\n";

}</pre>
</blockquote>
<p>結果は以下となる。</p>
<blockquote><p>a-&#62;111<br />
b-&#62;222<br />
c-&#62;333</p></blockquote>
]]></content:encoded>
</item>
<item>
<title><![CDATA[What's <em>use strict;</em> in Perl?]]></title>
<link>http://usestrict.wordpress.com/?p=16</link>
<pubDate>Sat, 04 Oct 2008 00:51:32 +0000</pubDate>
<dc:creator>Vinny</dc:creator>
<guid>http://usestrict.wordpress.com/2008/10/03/whats-use-strict-in-perl/</guid>
<description><![CDATA[Many unseasoned Perl programmers or people who never really dove into the Practical Extraction and R]]></description>
<content:encoded><![CDATA[<p>Many unseasoned Perl programmers or people who never really dove into the Practical Extraction and Report Language think it's an ugly language, or at least a dangerous one. And it actually can be... but not all is lost!</p>
<p><em>use strict;</em> is a Perl <a href="http://www.cs.cf.ac.uk/Dave/PERL/node138.html" target='_blank'>pragma</a> which essentially keeps you from shooting yourself on the foot. It tells Perl to make you declare your variables, use lexicals, and basically make your program such that it won't eventually get you fired.</p>
<p>[sourcecode language='php']<br />
#!/usr/bin/perl -w<br />
use strict;</p>
<p>my $var = "Hello World\n";<br />
print $var;<br />
[/sourcecode]</p>
<p><strong>Hello World</strong></p>
<p>Note that in the snippet above we added <span style="color:blue;"><em>my</em></span> just before the variable. This tells Perl that <span style="color:blue;"><em>$var</em></span> will be valid in the outer-most block of code. Since there are no (explicit) blocks, it makes <span style="color:blue;"><em>$var</em></span> act like a global variable.  Now, suppose you need to reuse the variable name inside another block of code, this what you would get:</p>
<p>[sourcecode language='php']<br />
#!/usr/bin/perl -w<br />
use strict;</p>
<p>my $var = "Hello World\n";<br />
print $var;<br />
{<br />
        my $var = "A new value\n";<br />
        print $var;<br />
}<br />
print $var;<br />
[/sourcecode]<br />
<strong>Hello World<br />
A new value<br />
Hello World</strong></p>
<p>There are some scenarios where you might have trouble with <em><span style="color:#0000ff;">use strict;</span></em> and might want to cheat a bit... in that case, you can do it with <em><span style="color:#0000ff;">no strict;</span></em> or it's variance with what you don't want to be strict on: <span style="color:#0000ff;"><em>no strict 'vars';</em></span> or <em><span style="color:#0000ff;">no strict 'subs';</span></em></p>
<p>If you're interested, you can find more pragmas <a href="http://perldoc.perl.org/index-pragmas.html" target='_blank'>here</a>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[PERL y RSA]]></title>
<link>http://kalimansurf.wordpress.com/?p=508</link>
<pubDate>Fri, 03 Oct 2008 16:38:56 +0000</pubDate>
<dc:creator>kalimansurf</dc:creator>
<guid>http://kalimansurf.wordpress.com/2008/10/03/perl-y-rsa/</guid>
<description><![CDATA[&#8220;Perl - el único lenguaje de programación que tiene el mismo aspecto antes y después de un ]]></description>
<content:encoded><![CDATA[<blockquote><p>"Perl - el único lenguaje de programación que tiene el mismo aspecto antes y después de un cifrado RSA."</p>
<p style="text-align:right;">-- Keith Bostic</p>
</blockquote>
<p>Via: <a href="http://mundogeek.net/archivos/2008/09/07/perl-y-rsa">MundoGeek</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[If This Is It]]></title>
<link>http://re1000.wordpress.com/?p=305</link>
<pubDate>Fri, 03 Oct 2008 16:14:17 +0000</pubDate>
<dc:creator>re1000</dc:creator>
<guid>http://re1000.wordpress.com/2008/10/03/if-this-is-it/</guid>
<description><![CDATA[
If This Is It, Please let me know!
Looks like Landmark is done-zo for good, or is it?&#8230;]]></description>
<content:encoded><![CDATA[<p><img class="alignnone" title="landmake done" src="http://farm4.static.flickr.com/3188/2909246815_c4700af516.jpg?v=0" alt="" width="375" height="500" /></p>
<p><a href="http://blip.fm/profile/TheIncredibleRE1000/blip/570128" target="_blank">If This Is It</a>, Please let me know!</p>
<p>Looks like Landmark is done-zo for good, or is it?......</p>
<p> </p>
<p><img class="alignnone" title="ariel in boston" src="http://farm4.static.flickr.com/3236/2909246805_9bb7e69c67.jpg?v=0" alt="" width="500" height="333" /></p>
<p>Ariel Perl was in town a couple of weeks ago, we did some shredding with him.</p>
<p>He's back in PA now though.</p>
<p><!--more--></p>
<p> </p>
<p><img class="alignnone" title="Not Rob Hep" src="http://farm4.static.flickr.com/3175/2909246813_77e5cd7f70.jpg?v=0" alt="" width="500" height="333" /></p>
<p>This is Not <a href="http://iloveprison.com/" target="_blank">Rob Heppler</a></p>
<p> </p>
<p><img class="alignnone" title="Vin in Boston" src="http://farm4.static.flickr.com/3179/2909246799_aa2c53db60.jpg?v=0" alt="" width="500" height="333" /></p>
<p><a href="http://www.botonturbo.com/wp-content/uploads/2007/10/megaman.jpg" target="_blank">Vin Diesel</a> was in Boston.....in the sidewalks...</p>
<p> </p>
<p><img class="alignnone" title="jerry cut" src="http://farm4.static.flickr.com/3253/2909246807_b3d80ec821.jpg?v=0" alt="" width="375" height="500" /></p>
<p>You gotta pay to play. <a href="http://www.youtube.com/watch?v=E2rtLZamHXc" target="_blank">Jerry</a> got a cut, he's aight though.  He got a line earlier that day for the upcoming <a href="http://www.orchardshop.com/" target="_blank">Orchard</a> video.</p>
<p> </p>
<p><img class="alignnone" title="magee at orchard" src="http://www.orchardshop.com/uploads/2008/DSCF0116-thumb-400x533.jpg" alt="" width="399" height="533" /></p>
<p><a href="http://www.visitgrandmother.com/" target="_blank">Dan Magee</a> of <a href="http://www.blueprintskateboards.com/" target="_blank">Blueprint</a> fame has been in town for a couple of weeks. He's been <a href="http://photos.l3.facebook.com/photos-l3-snc1/v351/63/40/552689446/n552689446_1369573_4980.jpg" target="_blank">Top Gun'ing</a> it in the friendly U.S. air space. Also been getting some good stuff of Coaks. Can't wait to see the upcoming Blueprint video!</p>
<p> </p>
<p><img class="alignnone" title="WE Celtics" src="http://farm4.static.flickr.com/3050/2909246801_1a737ec379.jpg?v=0" alt="" width="500" height="333" /></p>
<p>I thought of <a href="http://www.westernedition.tv/" target="_blank">Western Edition</a> when I saw this Celtics poster/ad.</p>
<p> </p>
<p>That is all folks!</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[NYTProf 2.04 gives you 90% smaller data files]]></title>
<link>http://timbunce.wordpress.com/?p=166</link>
<pubDate>Fri, 03 Oct 2008 11:15:27 +0000</pubDate>
<dc:creator>TimBunce</dc:creator>
<guid>http://blog.timbunce.org/2008/10/03/nytprof-204-gives-you-90-smaller-data-files/</guid>
<description><![CDATA[At OSCON this year I gave a talk on my new pet project Devel::NYTProf v2 to a packed room. Turned ou]]></description>
<content:encoded><![CDATA[<p>At OSCON this year I gave a talk on my new pet project Devel::NYTProf v2 to a packed room. Turned out to be a lot of fun. </p>
<blockquote><p>"The first thing I need to do is talk about Devel::DProf because it needs to be <a href="http://blog.timbunce.org/2008/07/12/devel-dprof-broken-by-the-passage-of-time/">taken out and shot</a>."</p></blockquote>
<p>I made a screencast of the 40 minute talk which you can watch on blip.tv <a href="http://blip.tv/file/1130150">here</a>. Worth watching for the background on profilers, the demo of NYTProf, and the questions, not to mention the teasing I get along the way.</p>
<p>One of the final questions was about the size of the profile data file that NYTProf produces. One of the major drawbacks of statement-level profiling is the volume of data it generates while profiling your code. For every statement executed the profiler streams out the file id, the line number, and the time spent. For every statement! When trying to profile a full application doing real work the volume of data generated quickly becomes impractical to deal with. Multi-gigabyte files are common.</p>
<p>This was the major problem with <a href="http://search.cpan.org/perldoc?Devel::SmallProf">Devel::SmallProf</a>, which generated text files while profiling. Salvador Fandiño García addressed that in <a href="http://search.cpan.org/perldoc?Devel::FastProf">Devel::FastProf</a> by writing the data in a compact binary form. A <em>vast</em> improvement that contributed to Devel::FastProf (on which Devel::NYTProf is based) being the first statement-level profiler worth using on large applications. Even so, the volume of data generated was still a problem when profiling all but short running applications.</p>
<p>NYTProf 2.03 was producing profile data at the rate of about 13MB per million statements executed. That might not sound too bad until you realise that on modern systems with cpu intensive code, perl can execute millions of statements every few seconds.</p>
<p>I could see a way to approximately halve the data volume by changing the format to optimize of the common case of consecutive statements being in the same file, but that wasn't going to be enough. The best way forward would be to add zip compression. It would be easy enough to pipe the output stream through a separate zip process, but that approach has a problem: the zip process will be soaking up cpu time asynchronously from the app being profiled. That would affect the realtime measurements in an unpredictable way.</p>
<p>I realized back <a href="http://code.google.com/p/perl-devel-nytprof/source/detail?r=333#">in June</a> that a better approach would be to embed zip compression into NYTProf itself. Around the end of July Nicholas Clark, current Perl Pumpkin, <a href="http://groups.google.com/group/develnytprof-dev/tree/browse_frm/thread/5caf1b8e598639be/8d86aa83b7ba45f0?rnum=1&#38;_done=%2Fgroup%2Fdevelnytprof-dev%2Fbrowse_frm%2Fthread%2F5caf1b8e598639be%2F9a4a6a76ca2ae013%3F#doc_55c101d6c8499465">got involved</a> and was motivated to implement the internal zipping because he was "<em>generating over 4Gb of profile data trying to profile the harness in the Perl 5 core running tests in parallel</em>".</p>
<p>He did a great job. The zlib library is automatically detected at build time and, if available, the code to dynamically route i/o through the zip library gets compiled in. The output stream starts in normal mode, so you can easily see and read the plain text headers in the data file, then switches to zip compression for the profile data. How well did it work out? This graph tells the story:</p>
<div style="text-align:center;"><img src="http://timbunce.files.wordpress.com/2008/10/nytprof-204-compression.png" alt="NYTProf 2.04 compression.png" border="0" width="845" height="641" /></div>
<p><em>(The data relates to profiling perlcritic running on a portion of its own source code on my MacBook Pre 2GHz laptop. I only took one sample at each compression level so there may be some noise in the results.)</em></p>
<p>The data file size (red) plummets even at the lowest compression level. Also note the corresponding drop in system time (yellow) due to the reduction in context switches and file i/o. </p>
<p>I've set the default compression level to 6. I doubt you'll want to change it, but you can by adding <code>compression=N</code> to the <code>NYTPROF</code> environment variable.</p>
<p>Here are the change notes for the 2.04 release:</p>
<pre>
  Fixed rare divide-by-zero error in reporting code.
  Fixed rare core dump in reporting code.
  Fixed detection of #line directives to be more picky.
  Fixed some compiler warnings thanks to Richard Foley.
  Added on-the-fly ~90% zip compression thanks to Nicholas Clark.
    Reduces data file size per million statements executed
    from approx ~13MB to ~1MB (depends on code being profiled).
  Added extra table of all subs sorted by inclusive time.
  No longer warns about '/loader/0x800d8c/...' synthetic file
    names perl assigns reading code from a CODE ref in @INC
</pre>
<p>Enjoy!</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Python after Perl]]></title>
<link>http://tenyearsfromnow.wordpress.com/?p=180</link>
<pubDate>Thu, 02 Oct 2008 12:52:33 +0000</pubDate>
<dc:creator>weesiong</dc:creator>
<guid>http://tenyearsfromnow.wordpress.com/2008/10/02/python-after-perl/</guid>
<description><![CDATA[Sigh. So they say python is a lot neater and readable than perl, how it&#8217;s the next wave of scr]]></description>
<content:encoded><![CDATA[<p>Sigh. So they say python is a lot neater and readable than perl, how it's the next wave of scripting coolness. They say that if you're still new to programming, and you're not too deep into perl, you should learn python. Some say that some beginner's knowledge in perl will help expedite the learning of python, after all, it's just the same thing, but neater.</p>
<p>Well, I have to say learning python can be a bitch. First, there's the publicly acknowledged lack of quality online help sites. Not to mention, there's that nagging voice that keeps going "Why am I learning/struggling to learn this in python when I already know how to do it in perl?"</p>
<p>Oh well, I shall perservere, or as they say in perl:</p>
<p>@action = ("screw_python", "learn_python", "perservere and");<br />
while (programming_level == noob) {<br />
if (perl_level == pro) {<br />
print "@action[0]"<br />
}<br />
elsif (perl_level == noob) {<br />
if (mental_state == still_sane) {<br />
print "@action[1]";<br />
}<br />
elsif (mental_state == @&#38;#^@^$%!@#&#38;^$&#38;*@!^$*@#%^(!@) {<br />
print "@action[2]@action[1]";<br />
}}<br />
}</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Aghreni Technologies inducts several top profile senior leaders for its management team]]></title>
<link>http://aghreni.wordpress.com/?p=17</link>
<pubDate>Thu, 02 Oct 2008 06:48:23 +0000</pubDate>
<dc:creator>aghreni</dc:creator>
<guid>http://aghreni.wordpress.com/2008/10/02/aghreni-technologies-inducts-several-top-profile-senior-leaders-for-its-management-team/</guid>
<description><![CDATA[Bangalore, Karnataka, India - 2. Oct 2008
Aghreni Technologies inducted several senior leaders in op]]></description>
<content:encoded><![CDATA[<p>Bangalore, Karnataka, India - 2. Oct 2008</p>
<p>Aghreni Technologies inducted several senior leaders in open source technologies for its management team.</p>
<p>Manjunatha Kutarahalli (KG) joined as Managing Director of Aghreni Technologies. Manjunatha brings in 25 years of global experience to Aghreni. Over the last 3 years he built an open source technology team for a US online marketing automation company from ground up in India.</p>
<p>Ram K joined as Director Business Solutions. Ram brings in 20 years of experience and decades of experience in working with open source business solutions.</p>
<p>Anil Menon joined as Director Engineering. Anil brings in 9 years of experience in architecting and implementing open source products and solutions for Multi-national companies.</p>
<p>Raghunandan Mysore joined as Director Infrastructure. Raghunandan brings in 12 years of experience in building and managing Network and system infrastructure for IT companies in India and abroad.</p>
<p><strong>About Aghreni Technologies Private Limited<br />
</strong>Aghreni technologies started at Banglore, India is focussing on providing open source technology services and solutions. It provides product incubation and services on open source technologies like Java, perl, php and ruby. It has an interesting mix of services for clients.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[perl script for transposing csv]]></title>
<link>http://opensourceeconomics.wordpress.com/?p=43</link>
<pubDate>Thu, 02 Oct 2008 00:05:00 +0000</pubDate>
<dc:creator>howardchong</dc:creator>
<guid>http://opensourceeconomics.wordpress.com/2008/10/02/perl-script-for-transposing-csv/</guid>
<description><![CDATA[ 
 
I needed to tranpose a 600&#215;5 csv (comma separated values) file so I could read it in Exce]]></description>
<content:encoded><![CDATA[<p> </p>
<p> </p>
<p>I needed to tranpose a 600x5 csv (comma separated values) file so I could read it in Excel 2003.</p>
<p>Found what I needed here: <a href="http://biowhat.com/2007/01/14/getting-the-transpose-of-a-csv/">http://biowhat.com/2007/01/14/getting-the-transpose-of-a-csv/</a></p>
<p>However, I did need to modify the code one bit. See the discussion below</p>
<blockquote><p> </p>
<p>Thanks for the script.</p>
<p>Just a comment though. You have the if condition:<br />
elsif ($AoA[$j][$i] eq “”){<br />
print RESULT “\n”;<br />
last;</p>
<p>this ignore that all elements past j in $AoA[$j][$i].</p>
<p>That is, if you have any missing values that are coded as blanks, this imposes that blanks are afterwards. I think this is probably good for your dataset (you have streams of observations of different lengths (?))</p>
<p>Since my data has missing observations coded as blanks, I’m gonna remove this elseif condition.</p>
<p>As an example</p>
<p>a csv file with one line:<br />
1, 2, 3, 4, 5, , 7, 8, 9</p>
<p>would be transposed to:<br />
1<br />
2<br />
3<br />
4<br />
5</p>
<p>and the values after the blank would get dropped off.</p></blockquote>
]]></content:encoded>
</item>
<item>
<title><![CDATA[smack]]></title>
<link>http://softwareetc.wordpress.com/?p=13</link>
<pubDate>Wed, 01 Oct 2008 23:12:35 +0000</pubDate>
<dc:creator>softwareetc</dc:creator>
<guid>http://softwareetc.wordpress.com/2008/10/01/smack/</guid>
<description><![CDATA[Earlier today I was writting some vba code (since it was all that was readily available on the compu]]></description>
<content:encoded><![CDATA[<p>Earlier today I was writting some vba code (since it was all that was readily available on the computer that had easy access to retrieving hwnds).</p>
<p>-Consequently, later in the day (in perl mode) i pulled one of these moves:</p>
<p>my @_rst = grep {$_ = $_check} @_previous</p>
<p>Took a bit of debugging to realize that all the items in previous mysteriously became whatever the most recent value of check was.  Ugh, stupid.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Reservoir Sampling in Perl]]></title>
<link>http://webkist.wordpress.com/?p=21</link>
<pubDate>Wed, 01 Oct 2008 17:45:23 +0000</pubDate>
<dc:creator>Mike</dc:creator>
<guid>http://webkist.wordpress.com/2008/10/01/reservoir-sampling-in-perl/</guid>
<description><![CDATA[A method for randomly selecting N values from a finite (but unknown length) list of elements, withou]]></description>
<content:encoded><![CDATA[<p>A method for randomly selecting N values from a finite (but unknown length) list of elements, without replacement. Algorithm is from <a href="http://blogs.msdn.com/spt/archive/2008/02/05/reservoir-sampling.aspx">Taming Uncertainty</a>. This version takes lines of input on STDIN (or files on @ARGV) and selects 20 of them at random and prints the results to STDOUT.</p>
<pre>#!/usr/bin/perl

use strict;
my $N = 20;
my $k;
my @r;

while(&#60;&#62;) {
  if(++$k &#60;= $N) {
    push @r, $_;
  } elsif(rand(1) &#60;= ($N/$k)) {
    $r[rand(@r)] = $_;
  }
}

print @r;</pre>
]]></content:encoded>
</item>
<item>
<title><![CDATA[IPW2008 il giorno dopo]]></title>
<link>http://caminac.wordpress.com/?p=20</link>
<pubDate>Wed, 01 Oct 2008 15:43:38 +0000</pubDate>
<dc:creator>caminac</dc:creator>
<guid>http://caminac.wordpress.com/2008/10/01/ipw2008-il-giorno-dopo/</guid>
<description><![CDATA[Impressione molto positiva, i numeri si possono trovare su perl.it, per le sensazioni bisognava esse]]></description>
<content:encoded><![CDATA[<p>Impressione molto positiva, i numeri si possono trovare su perl.it, per le sensazioni bisognava esserci.<br />
L'attenzione attorno all'evento è notevolmente cresciuta (basta guardare gli sponsor), tutti gli interventi che ho visto sono stati degni di nota. Quello che a me è piaciuto di più è stato 'Perl Myths' di Tim Bunce: soprattutto perchè nonostante l'intervento fosse in inglese ho capito quasi tutto... :-)... [continua]</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Some Perl ebooks for Programing Language seminar]]></title>
<link>http://nvtiep.wordpress.com/?p=109</link>
<pubDate>Wed, 01 Oct 2008 14:45:17 +0000</pubDate>
<dc:creator>nvtiep</dc:creator>
<guid>http://nvtiep.wordpress.com/2008/10/01/some-perl-ebooks-for-programing-language-seminar/</guid>
<description><![CDATA[Gửi cho leader Long và Trí. Hy vọng máy cuốn sách này có thể làm tăng tốc trước]]></description>
<content:encoded><![CDATA[<p>Gửi cho leader Long và Trí. Hy vọng máy cuốn sách này có thể làm tăng tốc trước cái tình trạng trì trệ của môn PL.</p>
<p>Link: <a href="http://sites.google.com/site/nvtiepsite/Home/Perlebooks.rar?attredirects=0">http://sites.google.com/site/nvtiepsite/Home/Perlebooks.rar?attredirects=0</a></p>
<p>Dưới đây là những thông tin cơ bản nhất về Perl. Tham khảo trong: <a href="http://vi.wikipedia.org/wiki/Perl">http://vi.wikipedia.org/wiki/Perl</a>  và <a href="http://en.wikipedia.org/wiki/Perl">http://en.wikipedia.org/wiki/Perl</a> hoặc homepage của Perl: <span style="font-size:11pt;color:#000000;"><a title="http://www.perl.org" href="http://www.perl.org/"><span style="color:#0000ff;font-family:Times New Roman;">http://www.perl.org</span></a></span></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Linux Application Engineer]]></title>
<link>http://spillerlaszlo.wordpress.com/?p=526</link>
<pubDate>Wed, 01 Oct 2008 08:52:45 +0000</pubDate>
<dc:creator>Spiller László</dc:creator>
<guid>http://spillerlaszlo.wordpress.com/2008/10/01/linux-application-engineer/</guid>
<description><![CDATA[About this role:

This is for people to work on our Linux Application Engineering team, covering lar]]></description>
<content:encoded><![CDATA[<p>About this role:</p>
<ul>
<li>This is for people to work on our Linux Application Engineering team, covering large scale ETL systems for fixed income financial data. This is a developer role with focus on new development and maintenance of legacy systems. You will work closely with users and colleagues doing similar for Linux Application Engineering.</li>
</ul>
<p>Requirements:</p>
<ul>
<li>Bachelor Degree in Computer Science or related discipline</li>
<li>Java Core (JSE 1.5 preferred)</li>
<li>JDBC</li>
<li>Experience with Spring, iBatis or Hibernate frameworks preferred.</li>
<li>SQL 92, Transact-SQL, or similar expertise</li>
<li>Sybase DB experience preferred </li>
<li>Comfortable working in a Linux/Unix Environment.</li>
<li>Scripting (cshell, korn shell or bash)</li>
<li>Working knowledge of Perl</li>
<li>Module development and OOP preferred.</li>
<li>Web development experience a plus</li>
<li>JavaScript</li>
<li>AJAX</li>
<li>2-5 years Experience in IT</li>
</ul>
<p><a href="mailto:laszlo_spiller@kellyservices.hu">laszlo_spiller@kellyservices.hu</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[rant about today's major scripting languages]]></title>
<link>http://vhaerun.wordpress.com/?p=49</link>
<pubDate>Wed, 01 Oct 2008 08:12:50 +0000</pubDate>
<dc:creator>vhaerun</dc:creator>
<guid>http://vhaerun.wordpress.com/2008/10/01/rant-about-todays-major-scripting-languages/</guid>
<description><![CDATA[My opinion is that all the scripting languages today have the same power and you can accomplish the ]]></description>
<content:encoded><![CDATA[<p>My opinion is that all the scripting languages today have the same power and you can accomplish the same thing using any of  them . The only difference is the control they give you .  The main contestants today are Perl , Python and Ruby , each having it's own strengths and weaknesses .</p>
<p><em><strong>Perl</strong></em></p>
<p><strong>strong points :</strong></p>
<ul>
<li>CPAN ( of course )</li>
<li>gets things done really fast</li>
<li>makes you feel like a hacker while coding a script</li>
<li>Perl Monks ( the smartest community I've ever met )</li>
</ul>
<p><strong>weak points :</strong></p>
<ul>
<li>if you're a perl n00b , even maintaining your own scripts can be hard</li>
<li>perl OOP ( not really a weak point since Moose fixes this ) , but for a beginner , things may not seem all that logical</li>
</ul>
<p><em><strong>Python</strong></em></p>
<p><strong>strong points :</strong></p>
<ul>
<li>some of the greatest libraries I've seen are written in python</li>
<li>seems like a language most security specialists use</li>
<li>easier to maintain for a beginner</li>
</ul>
<p><strong>weak points :</strong></p>
<ul>
<li>from my perspective , python gives you "the way" to do something right . Limited TIM TOWDY ( There Is More Than One Way to Do It )</li>
<li>you are forced to use indentation instead of braces ( some people consider this a feature . I don't )</li>
</ul>
<p><em><strong>Ruby</strong></em></p>
<p><strong>strong points :</strong></p>
<ul>
<li>very intuitive</li>
<li>my oppinion is that it tries to be a decent Perl alternative , and just from a OOP point of view , it does the job pretty good</li>
<li>fast growing ( friendly too ) community</li>
<li>TIM TOWDY</li>
</ul>
<p><strong>weak</strong> <strong>points :</strong></p>
<ul>
<li>until 1.9 will reach a stable version , speed is one of ruby's weak points</li>
</ul>
]]></content:encoded>
</item>

</channel>
</rss>
