Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

cgi::application::plugin::stream(3pm) [debian man page]

CGI::Application::Plugin::Stream(3pm)			User Contributed Perl Documentation		     CGI::Application::Plugin::Stream(3pm)

NAME
CGI::Application::Plugin::Stream - CGI::Application Plugin for streaming files SYNOPSIS
use CGI::Application::Plugin::Stream (qw/stream_file/); sub runmode { # ... # Set up any headers you want to set explicitly # using header_props() or header_add() as usual #... if ( $self->stream_file( $file ) ) { return; } else { return $self->error_mode(); } } DESCRIPTION
This plugin provides a way to stream a file back to the user. This is useful if you are creating a PDF or Spreadsheet document dynamically to deliver to the user. The file is read and printed in small chunks to keep memory consumption down. This plugin is a consumer, as in your runmode shouldn't try to do any output or anything afterwards. This plugin affects the HTTP response headers, so anything you do afterwards will probably not work. If you pass along a filehandle, we'll make sure to close it for you. It's recommended that you increment $| (or set it to 1), which will autoflush the buffer as your application is streaming out the file. METHODS
stream_file() $self->stream_file($fh); $self->stream_file( '/path/to/file',2048); This method can take two parameters, the first the path to the file or a filehandle and the second, an optional number of bytes to determine the chunk size of the stream. It defaults to 1024. It will either stream a file to the user or return false if it fails, perhaps because it couldn't find the file you referenced. We highly recommend you provide a file name if passing along a filehandle, as we won't be able to deduce the file name, and will use 'FILE' by default. Example: $self->header_add( -attachment => 'my_file.txt' ); With both a file handle or file name, we will try to determine the correct content type by using File::MMagic. A default of 'application/octet-stream' will be used if File::MMagic can't figure it out. The size will be calculated and added to the headers as well. Again, you can set these explicitly if you want as well: $self->header_add( -type => 'text/plain', -Content_Length => 42, # bytes ); AUTHOR
Jason Purdy, <Jason@Purdy.INFO>, with inspiration from Tobias Henoeckl and tremendous support from the cgiapp mailing list. Mark Stosberg also contributed to this module. SEE ALSO
CGI::Application, http://www.cgi-app.org <http://www.cgi-app.org>, "CREATING A STANDARD HTTP HEADER" in CGI.pm, http://www.mail-archive.com/cgiapp@lists.erlbaum.net/msg02660.html <http://www.mail-archive.com/cgiapp@lists.erlbaum.net/msg02660.html>, File::Basename, "$|" in perlvar LICENSE
Copyright (C) 2004-2005 Jason Purdy, <Jason@Purdy.INFO> This library is free software. You can modify and or distribute it under the same terms as Perl itself. perl v5.12.3 2011-06-26 CGI::Application::Plugin::Stream(3pm)

Check Out this Related Man Page

CGI::Application::Plugin::DevPopup::HTTPHeaders(3pm)	User Contributed Perl Documentation   CGI::Application::Plugin::DevPopup::HTTPHeaders(3pm)

NAME
CGI::Application::Plugin::DevPopup::HTTPHeaders - show incoming and outgoing HTTP headers VERSION
version 1.07 SYNOPSIS
use CGI::Application::Plugin::DevPopup; use CGI::Application::Plugin::DevPopup::HTTPHeaders; The rest of your application follows ... Output looks roughly like this: Incoming HTTP Headers ----------------------------------- http ----------------------------------- HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 HTTP_ACCEPT_CHARSET UTF-8,*;q=0.5 HTTP_HOST www.example.com Outgoing HTTP Headers ----------------------------------- Content-Type: text/html; charset=utf8 Environment Dump ----------------------------------- CAP_DEVPOPUP_EXEC 1 DOCUMENT_ROOT /var/www/html GATEWAY_INTERFACE CGI/1.1 QUERY_STRING REMOTE_ADDR 127.0.0.1 LIMITATIONS
For obvious reasons, the outgoing headers only display what CGI::Application will generate. SEE ALSO
CGI::Application::Plugin::DevPopup, CGI::Application AUTHOR
Rhesa Rozendaal, rhesa@cpan.org BUGS
Please report any bugs or feature requests to bug-cgi-application-plugin-devpopup@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI-Application-Plugin-DevPopup <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI- Application-Plugin-DevPopup>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. COPYRIGHT &; LICENSE Copyright 2005 Rhesa Rozendaal, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.4 2011-10-31 CGI::Application::Plugin::DevPopup::HTTPHeaders(3pm)
Man Page