Catalyst::Plugin::Upload::Audio::File - Get an Audio::File from an upload
use Catalyst qw/Upload::Audio::File/; if ( my $upload = $c->request->upload('file_to_upload') ) { # The destination file must have the file extension intact my $temp_file = "/tmp".$upload->filename; # The new file location must be reflected into the $upload object $upload->copy_to($temp_file); $upload->filename($temp_file); print "Got a file of length ".$upload->length."\n"; print "The bitrate is ".$upload->bitrate."\n"; }
Extends Catalyst::Request::Upload with Audio::File.
Catalyst::Request::Upload
Audio::File
Because `Catalyst::Request::Upload->filename` contains the name of the file as the user uploaded it and -not- the name of a real file on disk, and because `$upload->tempname` is a random string with no file extension, you must copy the file with the file extension intact and reflect the new file location back into the $upload object as demonstrated in the Synopsis.
$upload
See Audio::File for more detailed descriptions of available methods.
All methods except audio_file return the scalar value of the file property or undef.
audio_file
undef
The Audio::File object itself.
The length of the file.
The bitrate of the file.
The sample rate of the file.
The number of audio channels in the file.
The title from the file metadata ("tags").
The artist name from the file metadata.
The album name from the file metadata.
The comment from the file metadata.
The genre from the file metadata.
The year from the file metadata.
The track number from the file metadata.
The total tracks from the file metadata.
Nathaniel Heinrichs, nheinric@cpan.org
nheinric@cpan.org
Copyright (c) 2009 Nathaniel Heinrichs Written while employed at Orinoco K.K., L<http://www.orinoco.jp> This library is free software. You can redistribute it and/or modify it under the same terms as perl itself.
To install Catalyst::Plugin::Upload::Audio::File, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Plugin::Upload::Audio::File
CPAN shell
perl -MCPAN -e shell install Catalyst::Plugin::Upload::Audio::File
For more information on module installation, please visit the detailed CPAN module installation guide.