George Mpouras said:
This looks a URL to me. As a comment which is not a flame: You're
doing 'OS detection' at runtime and execute different code based
on that:
if ($^O=~/(?i)MSWin/) {
unless (0 == system(“RD /Q /S \â€$temp/$_\â€")) {
die “Could not delete \â€$temp/$_\†directory because\â€$^E\â€\nâ€
}
} else {
unless (0 == system(“rm -rf \â€$temp/$_\â€")) {
die “Could not delete \â€$temp/$_\†directory because \â€$^E\â€\nâ€
}
}
but the OS will rarely ever change at runtime. You should rather move
this into a BEGIN block and create 'a suitable function' you could
then call from the main code. I think you should also consider using
the 'list form' of system so that the runtime doesn't have to parse
you're command in order to deteremine how to execute them, especially
as this would also get around the (broken) 'quoted text
interpolation'. Example:
---------------
BEGIN {
if ($^O eq 'linux') {
*rmtree = sub {
system(qw(rm -rf), $_[0]) == 0 and return;
die("could not delete '$_[0]': $?");
};
}
}
rmtree($ARGV[0]);
---------------
Using $^E/ $! here doesn't make much sense because this will only
contain information about a problem which caused system to fail, not
about one encountered by the program which was started.
You should also consider to get rid of the 'inverted comparisons'
habit: This isn't even theoretically useful when both compared objects
are lvalues and mainly communicates a certain mathetic refusal to
accept reality: A lot of programming languages use == as comparison
operator, have been doing so for fourty years, and partisan syntax
won't change that. Also, natural western languages work such that
questions are asked in order to determine properties of object ('Is
the car blue?') and not objects of properties ('Is blue the colour of
the car?'). This latter is just awkward and outlandish style.