Skip Menu |

This queue is for tickets about the File-Fu CPAN distribution.

Report information
The Basics
Id: 41514
Status: stalled
Priority: 0/
Queue: File-Fu

People
Owner: Nobody in particular
Requestors: jloverso [...] mathworks.com
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: v0.0.4
Fixed in: (no value)



Subject: append() does not work on File::Fu::File
append() on a file object appears to do nothing: DB<1> use File::Fu DB<2> x $f = File::Fu::File->new('xdir') 0 File::Fu::File=HASH(0x7797c0) 'dir' => File::Fu::Dir=HASH(0xf9b260) 'dirs' => ARRAY(0xfa81a0) 0 '.' 'file' => 'xdir' DB<3> x $f->append('.tmp') 0 File::Fu::File=HASH(0x7797c0) 'dir' => File::Fu::Dir=HASH(0xf9b260) 'dirs' => ARRAY(0xfa81a0) 0 '.' 'file' => 'xdir' It would seem that this might be an issue with the lvalue-accessor from Class::Accessor::Classy, since append is: sub append { my $self = shift; my ($tail) = @_; $self->file .= $tail; $self; } For reference, I am using Perl 5.8.8 and the current CPAN version of Class::Accessor::Classy (v0.9.0).
From: jloverso [...] mathworks.com
It seems that the 'map' method does not work either, and for the same reason (it's the only other code using 'file' as an lvalue).
Subject: Re: [rt.cpan.org #41514] append() does not work on File::Fu::File
Date: Tue, 9 Dec 2008 16:47:36 -0800
To: bug-File-Fu [...] rt.cpan.org
From: Eric Wilhelm <scratchcomputing [...] gmail.com>
# from John LoVerso via RT # on Sunday 07 December 2008: Show quoted text
>  DB<1> use File::Fu > >  DB<2> x $f = File::Fu::File->new('xdir') >0  File::Fu::File=HASH(0x7797c0) >   'dir' => File::Fu::Dir=HASH(0xf9b260) >      'dirs' => ARRAY(0xfa81a0) >         0  '.' >   'file' => 'xdir' > >  DB<3> x $f->append('.tmp') >0  File::Fu::File=HASH(0x7797c0) >   'dir' => File::Fu::Dir=HASH(0xf9b260) >      'dirs' => ARRAY(0xfa81a0) >         0  '.' >   'file' => 'xdir'
Hi John, This appears to be something to do with lvalues and the perl debugger. I have tests which cover the behavior and cannot replicate it outside of the debugger. Having file as an lvalue was a compromise to get around the issue of string overloading to support $obj->file =~ s/\.this$/.that/. Unfortunately, the 5.10 debugger seems to have the same issue. So, I'm not sure what to do with this bug. I could refile it under Class::Accessor::Classy, but AFAICT, it is a perl bug. Thanks, Eric -- "Beware of bugs in the above code; I have only proved it correct, not tried it." --Donald Knuth --------------------------------------------------- http://scratchcomputing.com ---------------------------------------------------