CGI-Application-Plugin-DevPopup-Query

 view release on metacpan or  search on metacpan

Query.pm  view on Meta::CPAN

sub _runmode_report {
    my $self = shift;

    my $current_runmode = '<h3>' . ($self->get_current_runmode() || '<em>default</em>') . '</h3>';

    return $self->devpopup->add_report(
        'title'   => 'Current Run Mode',
        'summary' => $current_runmode,
        'report'  => $current_runmode,
    );
}

sub _query_report {
    my $self = shift;
    my $cgi = _cgi_report($self);

    my $current_runmode = $self->get_current_runmode() || 'default';

    return $self->devpopup->add_report(
        'title'   => 'CGI Query',
        'summary' => 'CGI request parameters',
        'report'  => qq!<style type="text/css">tr.even{background-color:#eee; } thead th h3 {margin: 0;}</style><table><thead><th colspan="2"><h3>CGI Query</h3></th></thead><tbody> $cgi </tbody></table>!,
    );
}

sub _cgi_report {
    my $self = shift;

    my $r = 0;
    my $q = $self->query;
    my $report = '<tr><th>param</th><th>value</th></tr>' .
            join ($INPUT_RECORD_SEPARATOR, map {
                    $r=1-$r;
                    qq!<tr class="@{[$r?'odd':'even']}"><td valign="top"> $_ </td><td> @{[$q->param($_)]} </td></tr>!
                  } sort $q->param());
    return $report;
}

1;

=head1 DEPENDENCIES

L<CGI::Application::Plugin::DevPopup|CGI::Application::Plugin::DevPopup>

=head1 CONFIGURATION AND ENVIRONMENT

N/A

=head1 DIAGNOSTICS

N/A

=head1 SEE ALSO

L<CGI::Application::Plugin::DevPopup|CGI::Application::Plugin::DevPopup>, L<CGI::Application|CGI::Application>

=head1 INCOMPATIBILITIES

Not known.

=head1 BUGS AND LIMITATIONS

Not known.

=head1 AUTHOR

Serguei Trouchelle, L<mailto:stro@cpan.org>

Most of code is based by CGI::Application::Plugin::DevPopup by Rhesa Rozendaal, L<mailto:rhesa@cpan.org>

=head1 LICENSE AND COPYRIGHT

This module is distributed under the same terms as Perl itself.

Copyright (c) 2009-2011 Serguei Trouchelle

=cut



( run in 0.660 second using v1.01-cache-2.11-cpan-39bf76dae61 )