| Apache2-ASP documentation | Contained in the Apache2-ASP distribution. |
Apache2::ASP::UploadHookArgs - Argument for UploadHook instances
my $Upload = Apache2::ASP::UploadHookArgs->new(
upload => $upload, # An APR::Request::Param::Table object
percent_complete => $percent_complete,
elapsed_time => $elapsed_time, # in seconds
total_expected_time => $total_expected_time, # in seconds
time_remaining => $time_remaining, # in seconds
length_received => $length_received, # in bytes
data => defined($data) ? $data : undef, # bytes received in this "chunk"
);
Rather than just passing a hashref as an argument, this class serves to enforce some structure to the whole Apache2::ASP upload model.
%args should be as shown in the synopsis above.
Returns an APR::Request::Param::Table object.
Returns a float representing what percent of the upload has been received so far.
Returns the number of seconds since the upload began.
Returns the total number of seconds we expect the upload to last.
Returns the number of seconds the upload will continue after this point in time.
Returns the number of bytes we have received from the upload so far.
Returns the value of $ENV{CONTENT_LENGTH} at this point, but may be updated later, based
on usage and requirements.
Returns the bytes received in this "chunk" of the upload.
After the upload has finished, you can count on the following methods returning actual values:
Returns the filename of the new file, as it was in the upload form field.
Example: C:\Documents\MyFile.txt
Returns something like MyFile.txt
Returns something like /media/MyFile.txt
It's possible that some bugs have found their way into this release.
Use RT http://rt.cpan.org/NoAuth/Bugs.html?Dist=Apache2-ASP to submit bug reports.
Please visit the Apache2::ASP homepage at http://www.devstack.com/ to see examples of Apache2::ASP in action.
John Drago mailto:jdrago_999@yahoo.com
Copyright 2007 John Drago, All rights reserved.
This software is free software. It may be used and distributed under the same terms as Perl itself.
| Apache2-ASP documentation | Contained in the Apache2-ASP distribution. |
package Apache2::ASP::UploadHookArgs; use strict; use warnings 'all'; #============================================================================== sub new { my ($s, %args) = @_; exists($args{$_}) or die "Required parameter '$_' was not provided" foreach qw( upload percent_complete elapsed_time total_expected_time time_remaining length_received data ); $args{content_length} = $ENV{CONTENT_LENGTH}; $args{new_file} = undef; $args{filename_only} = undef; $args{link_to_file} = undef; return bless \%args, $s; }# end new() #============================================================================== sub AUTOLOAD { my $s = shift; our $AUTOLOAD; my ($key) = $AUTOLOAD =~ m/::([^:]+)$/; return exists($s->{$key}) ? $s->{$key} : die "Invalid UploadHookArgs key '$key'"; }# end AUTOLOAD() sub DESTROY { } 1;# return true: __END__