View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to > HTTP-Engine-FirePHP > HTTP::Engine::FirePHP



Annotate this POD


View/Report Bugs
Module Version: 0.02   Source  


HTTP::Engine::FirePHP - Log to FirePHP from within HTTP::Engine


    use HTTP::Engine::Response;
    use HTTP::Engine::FirePHP;

    sub request_handler {
        my $req = shift;
        my $res = HTTP::Engine::Response->new;
        # ...
        # ...


If you are developing a web application and don't want to or can't check the error log, the traditional way is to include debug messages in the HTML page. However, this messes up the layout and mixes content with logging; the two really need to be separate.

FirePHP is a Firebug plugin which enables you to log to your Firebug Console by sending certain HTTP headers in the HTTP response. FirePHP is not just useful for PHP, though; any server-side application that can manipulate HTTP headers can log to Firebug.

The FirePHP response headers use the Wildfire protocol. The CPAN module FirePHP::Dispatcher can generate these headers.

This module then integrates FirePHP::Dispatcher with HTTP::Engine. By simply using this module, HTTP::Engine::Response gets a fire_php() accessor through which you can log to FirePHP.


    my $res = HTTP::Engine::Response->new;

This method is placed into the HTTP::Engine::Response class. The first time you access it, a new HTTP::Engine::FirePHP::Dispatcher object is created. You can use all logging methods of FirePHP::Dispatcher; please refer to that module's manpage.

Note that - despite what it says in FirePHP::Dispatcher - you don't have to call finalize(); this is done automatically each time something is logged.

When you load the response into Firefox, open the Firebug Console and you will find the logged messages there.

When you restart the HTTP::Engine-based server, be sure to do a shift-reload of the relevant page in Firefox; this ensures that headers aren't cached. If you don't do this, you might see remnant headers from previous responses.

    my $dbh = DBI->connect(...);
    my $res = HTTP::Engine::Response->new;
    $dbh->trace(2, $res->get_fire_php_fh);
    # Now the trace of all calls to $dbh will be sent to FirePHP

This method is placed into the HTTP::Engine::Response class. It returns a filehandle that sends every output to FirePHP - see PerlIO::via::ToFirePHP for details. A typical use is to pass this filehandle to DBI's trace() method and have all trace output sent to FirePHP.

This method requires PerlIO::via::ToFirePHP to be installed.


This module monkeypatches HTTP::Engine::Response, so it's not ideal encapsulation. Also, FirePHP::Dispatcher expects to work with a HTTP::Headers object, but HTTP::Engine::Response uses HTTP::Headers::Fast, so this module also munges the latter module's inheritance to make it look like the right class.


Wildfire protocol:


No bugs have been reported.

Please report any bugs or feature requests through the web interface at


See perlmodinstall for information and options on installing Perl modules.


The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit to find a CPAN site near you. Or see

The development version lives at Instead of sending patches, please fork this project using the standard git and github infrastructure.


Marcel Grünauer, <>


Copyright 2009 by Marcel Grünauer

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: