Apache2-ASP
view release on metacpan or search on metacpan
lib/Apache2/ASP/MediaManager.pm view on Meta::CPAN
#==============================================================================
sub open_file_for_writing
{
my ($s, $context, $filename) = @_;
# Try to open the file for writing:
my $ofh = IO::File->new();
$ofh->open($filename, '>' )
or die "Cannot open file '$filename' for writing: $!";
$ofh->binmode;
$ofh->autoflush(1);
return $ofh;
}# end open_file_for_writing()
#==============================================================================
sub open_file_for_reading
{
my ($s, $context, $filename) = @_;
# Try to open the file for reading:
my $ifh = IO::File->new();
$ifh->open($filename, '<' )
or die "Cannot open file '$filename' for reading: $!";
$ifh->binmode;
return $ifh;
}# end open_file_for_reading()
#==============================================================================
sub open_file_for_appending
{
my ($s, $context, $filename) = @_;
# Try to open the file for appending:
my $ofh = IO::File->new();
$ofh->open($filename, '>>' )
or die "Cannot open file '$filename' for appending: $!";
$ofh->binmode;
$ofh->autoflush(1);
return $ofh;
}# end open_file_for_appending()
#==============================================================================
sub compose_download_file_path
{
my ($s, $context) = @_;
lib/Apache2/ASP/Test/UserAgent.pm view on Meta::CPAN
# Now call the upload hook...
require Apache2::ASP::Test::UploadObject;
foreach my $uploaded_file ( keys( %{ $cgi->{uploads} } ) )
{
my $tmpfile = $cgi->upload_info($uploaded_file, 'tempname' );
my $filename = $cgi->upload_info( $uploaded_file, 'filename' );
my $ifh = IO::File->new;
$ifh->open($tmpfile, '<')
or die "Cannot open temp file '$tmpfile' for reading: $!";
binmode($ifh);
while( my $line = <$ifh> )
{
$hook_ref->(
Apache2::ASP::Test::UploadObject->new(
filename => $filename,
upload_filename => $filename
),
$line
);
}# end while()
( run in 0.243 second using v1.01-cache-2.11-cpan-8d75d55dd25 )