Hi,

I'm trying to find a way to initiate global variables through a form, but I
fail somehow.
Below I show two wrappers for "MyApplication.pm",
"my_application_fixed_data.pl" and "my_application_posted_data.pl".
"my_application_fixed_data.pl" works fine, with persistent data which could
be retreived from any run mode.
"my_application_posted_data.pl" only works the first time a run mode is
called, then the data is lost.

"OK, so why don't you retreive the data the first time and just pass the it
as a hidden field to other run modes?"
In a bigger application I wrote, the data contains POP3 username, password
and server name, so I don't wan't the data to be passed as a hidden field.
In that application, I currently save and retreive the data using dbm (tie
should be more proper), but if  I could avoid temporary files completely and
store the data as an application parameter, this would much be easier and, I
guess, more secure.

Anyone having a solution?
Thanks in advance.

Johan Kuuse
[EMAIL PROTECTED]

my_application_fixed_data.pl:
************************************
#!/usr/bin/perl
##
##  CGI Application my_application_fixed_data
##  Initiates $data itself
##
use strict;
use MyApplication;
my $data='FIXED DATA';
my $my_application = MyApplication->new(
                              PARAMS => {
                               'data' => $data,
                      }
      );
$my_application->run();
************************************


my_application_posted_data.pl:
************************************
#!/usr/bin/perl
##
##  CGI Application my_application_posted_data
##  Initiates $data from form
##
use strict;
use CGI;
use MyApplication;
my $q = new CGI;
my $data=$q->param('my_posted_data');
my $my_application = MyApplication->new(
                              PARAMS => {
                               'data' => $data,
                      }
      );
$my_application->run();
************************************

MyApplication.pm:
************************************
.
.
sub some_run_mode {
    my $self = shift;
    $data = $self->param('data');
return "Data: $data";
.
.
************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to