Skip Menu |

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

Report information
The Basics
Id: 58593
Status: resolved
Priority: 0/
Queue: IO-File-WithPath

People
Owner: Nobody in particular
Requestors: jnareb [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: IO::File::WithPath vs object interface to File::Temp
File::Temp provides in object-oriented interface access to filename of temporary file, similar to how IO::File::WithPath provides access to filename of opened file. I wonder why IO::File::WithPath uses different API: the method returning filename is called filename() in File::Temp, and path() in IO::File::WithPath. There is nice feature of File::Temp related to pathname of file, which IO::File::WithPath doesn't support. OO interface of File::Temp make File::Temp object stringify to filename; it would be nice to have the same for IO::File::WithPath. <code> use overload '""' => "STRINGIFY", fallback => 1; #... sub STRINGIFY { my $self = shift; return $self->filename; } </code> The code dealing with storing filename in an object itself is also slightly different. IO::File::WithPath uses <code> # symboltable hack ${*$io}{+__PACKAGE__} = $path; </code> while File::Temp uses <code> # Store the filename in the scalar slot ${*$fh} = $path; </code>
add filename method on v0.05. thank you for your suggestion.
As we talked on #plack, I totally don't understand why it is "nice to have" File::Temp compatible method to IO::File::WithPath. This module was designed and coded to add a method "path" to $io, so that it complies to the PSGI specification to get the file path out of a filehandle, and nothing more. Now, IF you ask that PSGI spec to support ->filename instead of (or in addition to) ->path then it'd make more sense to me since then you can pass a filehandle obejct you get from File::Temp to PSGI interface directly (and yes we thought about it but we deicded not to do so). However I don't really understand what benefit we get by adding File::Temp compatible interface TO this module. You keep saying it's "nice to have" but we haven't really heard why you think it's nice, or really, which use case you think it's really nice (or even necessary). Adding something that's not design to support is a beginning of a mess - someone might show up and want this module to support File::Path methods, and another might want to add Path::Class... that's a mess.
I agree to miyagawa. I removed filename method.