Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: hash n' params

by stephen (Priest)
on Apr 07, 2001 at 21:35 UTC ( #70732=note: print w/ replies, xml ) Need Help??


in reply to hash n' params

A couple of comments:

  • Your <TYPE>my $dir</TYPE> at the top doesn't change during the lifetime of the script-- and it would be confusing if it did! Personally, I'd
    use constant DIR => '~/';
    or some such.
  • If you get an error in your system() calls, your error messages will be misleading. System() doesn't set $! on error. To get the return code on a system process that didn't return properly, use '$?'. I'd pull your system calls out into something like this:
    sub run_system { my (@params) = @_; system(@params) == 0 or die "System command @{[join ' ', @params]} failed: returned + @{[ $? >> 8 ]}; stopped"; }
  • You could replace the third function call with a call to open() (or open2()) to make it a bit more Perlish. It would require significantly more code, but would eliminate a temporary file.

But, these are merely suggestions. It looks like good Perl to me.

stephen


Comment on Re: hash n' params
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://70732]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2015-07-30 07:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (270 votes), past polls