Friday, March 18, 2005

A Perl of Thoughts




Yesterday I spent my first full day coding in Perl. In the past I have done next to nothing with the language...only tinkering with a few lines here and there of existing scripts.

I would definitely say it's one of those "get-$hit-done" languages. Very little friction. I mostly related concepts back to what I knew from Python. I do think it's a language that one needs to be on their toes if they want to produce good code. "get-$shit-done" doesn't necessarily mean "write-readable-code".

Here's a few bits that I thought were neat:

Variable Interpolation

$name = "T-Bone Walker";
print "Great blues music by $name";

Prints: "Great blues music by T-Bone Walker"

That saves a lot of time especially when constructing things like HTML. It helps keep code clean by reducing concatenations.



Function with Arguments

This threw me sideways:
sub adder{
$sum = 0;
foreach $_ (@_) {
$sum += $_;
}
return $sum;
}

print add(1,2,3); # prints 6
print add(1,2,3,4,5); #prints 15
print add(1..5); # prints 15

It's unnatural to me to not declare function signatures but passing arguments as an array is an interesting concept. Lot's of flexibility.

I feel like the last person on earth learning to program with Perl but it is still exciting. I love feeling out new concepts especially with dyno-packed languages like Perl.

Wednesday, March 16, 2005

MVC Framework for Perl

I like the ideas implemented in Ruby on Rails but Ruby and an implmentation will probably not happen here at the day job. As far as languages go we're either going to go ASP.NET for Microsoft servers or Perl/Java on the linux servers.

One framework I found for MVC style web development in Perl is Maypole. It does some similar auto class constructing like the Rails project. Also included is a templating package for the view. Perl.com has an article that gives an adequate tutorial

Rapid Web Application Deployment with Maypole

V1 Arcvhies Available

I posted my stronglytype v1 archives from blogger:

http://www.stronglytyped.com/v1

I would like to note a few of my favorite posts: