I find that if I try to change the current page, by returning a
different value from 'respond', it dies with  "initialize_CGI not
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

Am I doing this correctly?
Should I file a bug report on rt?

(Sample code below).


# file One.pm
package One;
use warnings;
use strict;
use base 'CGI::Prototype';

sub respond {
  require Two;
  return 'Two';


# file Two.pm
package Two;
use warnings;
use strict;
use base 'CGI::Prototype';

sub template {
  return \'[% self.CGI.header %]Two';


# file test.t
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

Reply via email to