in reply to Perl Programming guidelines/rules

Someone should mention Skud's article "In Defense of Coding Standards: How to Create Coding Standards that Work" on perl.com. That's a good starting point for any Perl coding standards I'll ever need.

Use OO Always might be appropriate in a CGI shop (I sure regretted not doing so once!), but would be serious overkill in some of the scripting glue elsewhere in production systems where Perl is a better Sh(ell). I don't need to write a Backup.pm and then say
perl -MBackup -e '$backup=Backup->new(); $backup->doit()', I can just write a backup.pl and run it. And for the better-grep-and-awk stuff, it's way overkill.

-- Bill n1vux

Replies are listed 'Best First'.
Re: Prior art reference, and comment
by submersible_toaster (Chaplain) on Nov 21, 2002 at 23:58 UTC

    How many systems are you backing up Bill the Anonymous Monk ? Are you going to deploy the script to every corner of the network, hack the configuration each time? What happens when the script is revised ? Magically diff the code updates from the variable hacks and then what. The OO call to Backup.pm could easily be a single config file. Update the module often as you like , all the config stays where it should be.

    Backup->new( "/etc/sys-backup.cfg" );

    If I've typed it twice already, how many more times today before I make it a method? $self->grumpy_reply(\$parent) : )

      What, you really think OO is the only way to archieve this? Don't be silly.
      use Backup; Backup::doit config => "/etc/sys-backup.cfg";

      works as well as an OO-wrapper.

      I've written backup programs in Perl as well. It did use a configuration file, and the functionality was changed without the need to change the interface. And guess what? It wasn't OO!

      Abigail