Ok, I've figured out what was going wrong and how to fix it, however
it's brought up another issue.

Firstly, my apologies that the code I posted didn't run - it was
copy-typed from one machine to another.
The line:
my $t = CGI::Prototype::Mech->new( protoapp => "One" );
should have read:
my $t = CGI::Prototype::Mecha->new( protoapp => "One" );

The problem was caused, because CGI::Prototype does:

our $_mirror = __PACKAGE__->reflect;

  (CGI => sub { die shift, "->initialize_CGI not called" });

which adds the dummy CGI slot to the CGI::Prototype __PACKAGE__,
but then the initialize_CGI method adds the real CGI slot to $self,
which is the package 'One'...

sub initialize_CGI {
  my $self = shift;
    ([qw(CGI FIELD autoload)] => sub {
       require CGI;

When control passes to $next_page, which is package 'Two', it
inherit's CGI::Prototype's dummy CGI slot, but not the 'real' CGI slot
which is in 'One'.

The solution to that is to change the line in CGI::Prototype's
initialize_CGI from:

When this is done, the application works correctly.

However, my test file still does not pass... this is because in
CGI::Prototype::Mecha's 'new' method, it overrides the 'display' slot
for package 'One' (the protoapp that is passed).
When control passes to 'Two', it doesn't have the overridden 'display'
method, and so uses it's inherited 'display' from CGI::Prototype,
which prints to STDOUT.

Does anyone have any thoughts on how to deal with this?
Though, I admit to not being /too/ concerned about it, because my test
suite uses WWW::Mechanize through a real webserver.

I will post my suggested change to the initialize_CGI method to rt.


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