I find that if I try to change the current page, by returning a
different value from 'respond', it dies with "initialize_CGI not
called".
I think this is because when the new page's package is required, it
reruns the code in CGI/Prototype.pm which add's the 'dummy' CGI slot
which dies with that exact error message.
(I thought that a module's body was only run once, for the first 'use'
or 'require', but I can't see any other explanation for what's
happening).
Am I doing this correctly?
Should I file a bug report on rt?
(Sample code below).
Cheers,
Carl
# file One.pm
package One;
use warnings;
use strict;
use base 'CGI::Prototype';
sub respond {
require Two;
return 'Two';
}
1;
# file Two.pm
package Two;
use warnings;
use strict;
use base 'CGI::Prototype';
sub template {
return \'[% self.CGI.header %]Two';
}
1;
# file test.t
#!/usr/bin/perl
use strict;
use warnings;
use CGI::Prototype::Mecha;
use Test::More tests => 2;
use Data::Dumper;
use lib '.';
my $t = CGI::Prototype::Mech->new( protoapp => 'One' );
$t->get( 'http://mecha/' );
ok $t->success;
ok $t->res =~ 'Two';
print STDERR Dumper $t->res;
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
cgi-prototype-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cgi-prototype-users