: # feed this into perl
eval 'exec perl -S $0 ${1+"$@"}'
if $running_under_some_shell;
#
# $Id: storage,v 0.1 2001/04/22 17:57:05 ram Exp $
#
# Copyright (c) 1998-2001, Raphael Manfredi
# Copyright (c) 2000-2001, Christophe Dehaudt
#
# You may redistribute only under the terms of the Artistic License,
# as specified in the README file that comes with the distribution.
#
# HISTORY
# $Log: storage,v $
# Revision 0.1 2001/04/22 17:57:05 ram
# Baseline for first Alpha release.
#
# $EndLog$
#
require CGI::MxScreen;
package OBJECT;
sub make {
return bless {}, shift;
}
sub value { $_[0]->{value} }
sub set_value { $_[0]->{value} = $_[1] }
package SCREEN_A;
use CGI qw/:standard/;
use base qw(CGI::MxScreen::Screen);
sub init {
my $self = shift;
$self->{hashvar} = {};
$self->{aryvar} = [];
$self->{object} = OBJECT->make;
}
sub display {
my $self = shift;
print h1($self->screen_title);
my $context_var = $self->record_field(
-name => "context_var",
-storage => "context_var",
);
my $hash_var = $self->record_field(
-name => "hash_var",
-storage => [$self->{hashvar}, "hashed"],
);
my $ary_var = $self->record_field(
-name => "ary_var",
-storage => [$self->{aryvar}, 2],
);
my $object_var = $self->record_field(
-name => "object_var",
-storage => [$self->{object}, 'set_value'],
);
my $ok = $self->record_button(
-name => "ok",
-value => "OK",
-target => ["B", $self],
);
print p("context var", textfield($context_var->properties));
print p("hash var", textfield($hash_var->properties));
print p("array var", textfield($ary_var->properties));
print p("object var", textfield($object_var->properties));
print submit($ok->properties);
}
package SCREEN_B;
use CGI qw/:standard/;
use base qw(CGI::MxScreen::Screen);
sub display {
my $self = shift;
my ($from) = @_;
print h1($self->screen_title);
print p("context var =", $self->vars->{context_var});
print p("hash var =", $from->{hashvar}->{hashed});
print p("array var =", $from->{aryvar}->[2]);
print p("object var =", $from->{object}->value);
}
package main;
my $manager = CGI::MxScreen->make(
-screens =>
{
'A' => [-class => 'SCREEN_A', -title => "Screen A" ],
'B' => [-class => 'SCREEN_B', -title => "Screen B" ],
},
-initial => ['A'],
);
$manager->play();