Re: modifing existing Excel cells using perl in Unix possible?



DJ Stunks (DJStunks@xxxxxxxxx) wrote on MMMMDCXXXV September MCMXCIII in
<URL:news:1147295046.307415.276750@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>:
//
// Abigail wrote:
// > Ben Morrow (usenet@xxxxxxxxxxxx) wrote on MMMMDCXXXV September MCMXCIII
// > in <URL:news:f3q9j3-s5c.ln1@xxxxxxxxxxxxxxxxxxxxxxx>:
// > {}
// > {} You do not need to use mv(1) for this; see File::Copy, or indeed just
// > {} rename in perlfunc.
// >
// >
// > File::Copy is utterly broken, and has extremely limited capabilities
// > compared to the utilities it's supposed to be an alternative for.
// >
// > I wouldn't touch File::Copy with a 10 feet pole.
// >
// > I'd use 'rename' if and only if I'm sure both the source and the
// > destination are files in the same filesystem - otherwise I would use
// > 'system mv'. And I rather write a Java program moving the file for me
// > then have File::Copy screw up.
// >
// > Friends don't let friend use File::Copy.
//
// well, that's quite an odd thing to say, particularly as it comes from
// someone who has and does contribute to Perl. Therefore, I feel a bit
// like I'm preaching to the choir, but the whole crux of the open source
// community is to feed back and resolve bugs... In addition, counselling
// thousands of people to roll their own copy() subroutine invalidates the
// whole theory behind the CPAN archive.
//
// So I would humbly suggest that if File::Copy really is broken (and I'd
// be quite surprised if it is since 1) it's a standard module, and 2)
// I've used it without issue in production) that you submit a bug report
// (at minimum) or a bug report and it's corresponding bugfix.
//


Please do your homework.


I've submitted the bug report.


Years ago.


And a few times a year, I rant about its brokenness. Noone seems to care
(but oh by god, people do care if you ignore a broken Perl module and
call something from a working toolbox - after all, most Perl programmers
that are active in forums are religious nuts)

In 2003, for instance, in this very forum:
<slrnbnhkbq.m1g.abigail@xxxxxxxxxxxxxxxxxxxx>
Or in a thread in 2004: <slrncnofsn.3ac.abigail@xxxxxxxxxxxxxxxxxxxx>

And if you have the stomach to visit perlmonks, you'll find posts by
me pointing out the brokenness of File::Copy.


Don't tell me I didn't warn "the community" - I've been doing so for years.


Here's a program that shows the brokenness of File::Copy::copy (move
suffers from the same problem if it needs to do a copy & delete action).


#!/usr/bin/perl

use strict;
use warnings;
no warnings 'syntax';

use File::Copy;


my ($src, $dest1, $dest2) = ("/tmp/src", "/tmp/dest1", "/tmp/dest2");

for my $file ($src, $dest1, $dest2) {
die "$file exists, not running this test\n" if -f $file;
}

umask 022 or die "umask: $!\n";

open my $fh => ">", $src or die "open: $!\n";
close $fh or die "close: $!\n";

chmod 0755 => $src or die "chmod: $!\n";

copy $src => $dest1 or die "copy: $!\n";
system cp => $src, $dest2 and die "cp: $?\n";

my $d1_perm = ((stat $dest1) [2]) & 07777;
my $d2_perm = ((stat $dest2) [2]) & 07777;

if ($d1_perm == $d2_perm) {
print "Permissions equal\n";
}
else {
die sprintf "Expected permissions %3o, got permissions %3o\n"
=> $d2_perm, $d1_perm;
}

__END__


Running the program gives:

Expected permissions 755, got permissions 644


Losing your execute bits when copying files means the module is broken.


// Finally, I would also suggest re-reading _The Cathedral and the Bazaar_
// to brush up on the notion that, as Linus once famously said, "Given
// enough eyes, all bugs are shallow."


Linus is wrong. Fixing bugs needs _tuits_, not eyes. Furthermore, more
thatn 99% of the users of an open source product will never look at the
code.


Abigail
--
# Perl 5.6.0 broke this.
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
.



Relevant Pages

  • Re: modifing existing Excel cells using perl in Unix possible?
    ... I'd use 'rename' if and only if I'm sure both the source and the ... Friends don't let friend use File::Copy. ... like I'm preaching to the choir, but the whole crux of the open source ... I've used it without issue in production) that you submit a bug report ...
    (comp.lang.perl.misc)
  • Re: How To activate command line history in debugger?
    ... > reading the bounce from that. ... It's indeed my fault. ... BUT: $INC has a content with perl -V: ... It's a bug report worth in every case. ...
    (comp.lang.perl.misc)
  • Re: question about installation of GD::Text on cygwin (could be a Makefile q)
    ... >> $ perl Makefile.PL ... > Silent failure to create a Makefile. ... I'll have a look to see whether I can reproduce it in my environment. ... happens here I'll submit a bug report. ...
    (comp.lang.perl.misc)
  • Re: a question?
    ... that file is a BUG report, which is made from JUNIT. ... Perl has no built-in limits on the size of the data it can store or ...
    (perl.beginners)
  • RE: FW: Reading a Unicode text file
    ... and I think you're right and Perl is ... Perl seemingly disagrees with some common tools ... It is best if you can include a utf8 file, ... important that the exact file contents be part of the bug report, ...
    (perl.beginners)