|
|
|
|
|
by peteretep
5464 days ago
|
|
Learning Javascript changed my Perl for the ... more fun to write. Possibly better, too. I've started passing around coderefs as arguments to functions a lot more recently, and allowing people who use my APIs to do just that... I've been writing code that allows you to describe a website in data and at a high level recently, and builds you up all the methods you need to interact with it. In general, when people need to provide parameters, I also let them pass in coderefs that can be executed to provide those eg: my $name = ref($args{'form_name'}) eq 'CODE' ?
$args{'form_name'}->( $self, @user_options ) :
$args{'form_name'};
my $form = $self->mech->form_name( $name );
|
|
It essentially teaches you functional programming in Perl.