On Sun, Sep 09, 2001 at 11:49:09AM -0500, Craig A. Berry wrote:
>     sub safe_unlink {
>         my($file,$num);
>         foreach $file (@_) {
>             next unless VMS::Filespec::candelete($file);
>             $num += unlink $file;
>         }
>         $num;
>     }
> 
> (or you could just use C<VMS::Stdio::remove>, if you've installed
> the VMS::Stdio extension distributed with Perl).

Ok.  There's absolutely no way that I'm going to get everyone to
replace all the unlink() calls in all the tests with the above
function (nevermind all the $^O stuff necessary).  It's just too much
work.  Even worse considering just how many *more* built-in functions
I'm going to have to wrap.

These days, MacOS and VMS are the two least consistent ports of Perl
(as compared to the popular Unixen) and they're the ones we have to do
the most extra work to adjust for.  They're also two ports that we
don't have many people working on, so having them run around
correcting everyone's portability mistakes is a poor use of time.

So, in the interest of good old fashioned Laziness, we should have a
module which does this for us.

    use portability;

    unlink($file);  # does everything that needs to be done to make
                    # unlinking safe on all platforms.

and I'm going to encourage the macperl and vmsperl folks to start
working on this module.  Just whip through perlport and README.myos,
take all the caveats and codify them.

And I'm going to ask everyone else, everytime they write code that goes 

    $^O eq 'SomeWeirdOS' ? do_this() : do_that();

instead, patch portability.pm.  Then you don't have to write that
messy code anymore.


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
Me? A robot? That's rediculous! For one thing, that doesn't compute at all!

Reply via email to