Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • ...or any other language. Languages capable of expressing the whole of human existence are large, complex things. Languages capable of expressing this *elegantly* are even more so. Fortunately, we don't need to know the whole language to be fluent in it. Even though I don't know what "pseudoconcha" means, I can get along without that piece of information. More importantly, I know how to find out what it means.

    As if that wasn't enough, Perl is constantly growing. The community, the coding standards, the code on CPAN. What was considered good style five years ago is now looked on as a bit amatuerish. We learn, we grow, we change. Such is the stuff of life. In the other direction lies COBOL, FORTRAN, even LISP. Good languages that didn't or couldn't adapt.

    So don't despair, we're all in the same boat.

    Should you try Ruby? Yes. Its a wonderful language borrowing elements from Perl 5 and Smalltalk and even preempting chunks of Perl 6.

    Could your code be simpler? Sure. Apply a few idioms you might not know:

            name => 'copy_'.$item.'_'.$parent_id,

    using the less ambiguous ${foo} syntax, this can become:

            name => "copy_${item}_$parent_id",

    Honestly, I've never understood why popup_menu() requires you to put in *both* the values and the labels since the value entry is then redundant. So write a wrapper:

            sub my_popup_menu {
                    my $args = shift;
                    $args->{values} = [ keys $self->{labels} ]
                            if $self->{labels} && !$self->{values};

    and then use it:

                    name => 'source',
                    labels => { map {$_->[0], $_->[1] } @$items }

    On a more grand scale, if you're doing a lot of database work it would behoove you to look at modules like Ima::DBI, Class::DBI. Alazbo, etc... which abstracts away a lot of this work. Modules like Template::Toolkit mean you won't have to stick HTML formatting code in your program. More stuff to learn, but it makes coding easier.

    Jarkko Hietaniemi, 5.8 pumpking, puts at the end of every email: "There is this special biologist word we use for 'stable'. It is 'dead'." If you ever learned the entirety of Perl, or any language, it would be dead.
    • This is deep. Thanks for your comment back in July. I'm getting better in learning Perl idioms and ways to do job better. Still use VBA for quick analytical projects, though, it's just so much easier to put something "quick and dirty" together than it would be in Perl. But Perl really saves a lot of my time on some things where VBA just gives up.