Skip Menu |

This queue is for tickets about the Audio-Wav CPAN distribution.

Report information
The Basics
Id: 71715
Status: open
Priority: 0/
Queue: Audio-Wav

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

Bug Information
Severity: Important
Broken in: 0.12
Fixed in: (no value)



Subject: Support read/writes via file handle [patch]
This patch makes it so that the file names given to the Audio::Wav::Read and Audio::Wav::Write constructors may also be a GLOB (such as \*STDIN) and will be handled as such. Certain caveats exist, however, in using file handles, though. For instance, the size isn't known, and it is entirely possible to accidentally read past the end of the file. As long as
Subject: Audio-Wav-0.12_file_handle_support.patch
diff -ru Audio-Wav-0.12.orig/Wav/Read.pm Audio-Wav-0.12/Wav/Read.pm --- Audio-Wav-0.12.orig/Wav/Read.pm 2010-05-23 11:37:07.000000000 -0500 +++ Audio-Wav-0.12/Wav/Read.pm 2011-10-15 22:20:42.000000000 -0500 @@ -47,7 +47,10 @@ my $tools = shift; $file =~ s#//#/#g; my $size = -s $file; - my $handle = new FileHandle "<$file"; + my $handle = + (ref $file eq 'GLOB') ? + $file : + new FileHandle "<$file"; my $self = { 'real_size' => $size, diff -ru Audio-Wav-0.12.orig/Wav/Write.pm Audio-Wav-0.12/Wav/Write.pm --- Audio-Wav-0.12.orig/Wav/Write.pm 2010-05-23 11:37:07.000000000 -0500 +++ Audio-Wav-0.12/Wav/Write.pm 2011-10-15 22:20:32.000000000 -0500 @@ -76,7 +76,10 @@ my $details = shift; my $tools = shift; - my $handle = new FileHandle ">$out_file"; + my $handle = + (ref $out_file eq 'GLOB') ? + $out_file : + new FileHandle ">$out_file"; my $use_cache = 1; if ( ref $details eq 'HASH' && exists $details -> {'no_cache'} ) {
Thanks, this has been applied in SVN and will be relaesed with 0.13 this weekend. I'm trying to give credit in the Changes file, so please let me know how/if you'd like to be credited. Thanks, Brian On Sat Oct 15 23:38:39 2011, https://www.google.com/accounts/o8/id? id=AItOawlHE42Y1CaFExfNoDFa8RzYjn3VvOrLan0 wrote: Show quoted text
> This patch makes it so that the file names given to the
Audio::Wav::Read Show quoted text
> and Audio::Wav::Write constructors may also be a GLOB (such as
\*STDIN) Show quoted text
> and will be handled as such. > > Certain caveats exist, however, in using file handles, though. For > instance, the size isn't known, and it is entirely possible to > accidentally read past the end of the file. As long as
Just put Dan Church if you really want to credit me. I don't even know if it's worth keeping in; it was a minor hack I wrote up in a couple of minutes. More of a feature request with attached code. :-) On Fri Mar 30 16:48:13 2012, BRIANSKI wrote: Show quoted text
> Thanks, this has been applied in SVN and will be relaesed with 0.13
this Show quoted text
> weekend. > > I'm trying to give credit in the Changes file, so please let me know > how/if you'd like to be credited. > > Thanks, > Brian > > On Sat Oct 15 23:38:39 2011, https://www.google.com/accounts/o8/id? > id=AItOawlHE42Y1CaFExfNoDFa8RzYjn3VvOrLan0 wrote:
> > This patch makes it so that the file names given to the
> Audio::Wav::Read
> > and Audio::Wav::Write constructors may also be a GLOB (such as
> \*STDIN)
> > and will be handled as such. > > > > Certain caveats exist, however, in using file handles, though. For > > instance, the size isn't known, and it is entirely possible to > > accidentally read past the end of the file. As long as
>