Igor Bujna > Dancer-Plugin-FakeCGI-0.2 > Dancer::Plugin::FakeCGI

Download:
Dancer-Plugin-FakeCGI-0.2.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 0.2   Source   Latest Release: Dancer-Plugin-FakeCGI-0.62

NAME ^

Dancer::Plugin::FakeCGI - run CGI methods or Perl-files under Dancer

SYNOPSIS ^

DESCRIPTION ^

Supports to run CGI perl files on CGI methods under Dancer.

CONFIGURATION ^

    plugins:
       FakeCGI:
          cgi-dir: 'cgi-bin'
          cgi-package: 'lib/CGI'

cgi-dir - for setting directory where is placed Perl CGI file, standart is 'cgi-bin'

cgi-package - for setting INC library where is CGI packages, standart is nothing.

TODO ^

Emulation of this CGI methods: header(), cookie()

METHODS ^

fake_cgi_mock

Array of Hashref of methods which will be mocked.

HASHREF of params ^

package => name of package where is method, when not defined, than we use CGI
method => method in specified package which we want to mocked
func => code reference of function which we want to run instead specieified function
not_destroy => 1 for not unmocking back after fast_cgi_* function ended.

Standart of method which we automatically mocked is CGI->header.

fake_cgi_method

Method for runned specified CGI method-function and return values of runned function.

PARAMS ^

Package name where is method, which we run. Automatically load this package to memory in first run.
Method name which we run.
Arguments for given method

fake_cgi_file

Method for runned specified Perl CGI file and returned exit value

PARAMS ^

Perl CGI filename and first in first run we compiled this file into memory

fake_cgi_as_string

TYPES ^

Return captured strings from CGI, which will be printed to STDOUT
If first arguments is reference to scallar, than captured strings will be added to this reference and returned size of captured string.

fake_cgi_compile

Load packages into memory or Compiled files into memory

PARAMS is array of HASHREF ^

filename => compile Perl filename into memory
package => load package into memory

HOOKS ^

This plugin uses Dancer's hooks support to allow you to register code that should execute at given times.

TYPES ^

fake_cgi_before : hook which will be called before run CGI method or Perl CGI file
fake_cgi_after : hook which will be called after runned CGI method or Perl CGI file

In both functions was as first arguments reference to IO::Capture::Stdout

EXAMPLE ^

    hook 'fake_cgi_before' => sub {
        my $capture = shift;
        # do something with the new DB handle here
    };

AUTHOR ^

Igor Bujna, <igor.bujna@post.cz>

CONTRIBUTING ^

ACKNOWLEDGEMENTS ^

BUGS ^

SUPPORT ^

LICENSE AND COPYRIGHT ^

Copyright 2010-12 Igor Bujna.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

SEE ALSO ^

Dancer

IO::Capture::Stdout

CGI::Compile

Test::TinyMocker

syntax highlighting: