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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|