Hi Adrian,

I just tried your code snippet, and I got the expected results!

There must be something else that you are doing that is causing your problem. One note, you do realize that you aren't supposed to be printing anything from your scripts right? I am assuming that you used print in the setup method purely for debugging purposes. It might help in that case to print to STDERR so that the debug messages go to your webserver error logs or in case you execute from the command line, you still see them on the screen (or can redirect them using the shell).

Anyway, here is the code that I executed based on your example code, and I've included the exact output I received below it.

----- start code -----
#!/usr/bin/perl

My::App->new->run;

package My::App;
use strict;
use warnings;

use base qw/CGI::Application/;

sub setup {
  my $self = shift;

  $self->run_modes(['start']);
  $self->param('testparamname','testparamvalue');
  print STDERR "param value in setup:".$self->param('testparamname').$/;
}

sub start {
  my $self = shift;
  return "param value in start:".$self->param('testparamname').$/;
}
----- end code -----

----- start output -----
param value in setup:testparamvalue
Content-Type: text/html; charset=ISO-8859-1

param value in start:testparamvalue
----- end output -----

Cheers,

Cees



Adrian Grigore wrote:
Hi Everybody!

I have just installed CGI::Application a few hours ago and am taking my first steps with this module. Unfortunately I have had major problems even running a generic application generated by CGI::Application::Generator. It might be something really obvious, but I have been trying to find out what is going wrong, read the manual twice, analyzed several demo applications but am still not able to figure out what's going wrong. I hope you'll forgive me pestering you with this newbie question.

My problems boil down to the fact that I don't seem to be able to set/get any Application parameters. Please consider the following example:

use strict;
use warnings;


use base qw/CGI::Application/;


sub setup {
        my $self = shift;

#setting a simple string scalar parameter with name 'testparamname' and value 'testparamvalue'... At least that's what I am *trying* here.
$self->param('testparamname','testparamvalue');
#getting the parameter value again
print "\r\nmy parameter value:".$self->param('testparamname')."\r\n";
...
}


Now, the problem is that this code actually prodoces the output "my parameter value: testparamname". So self->param() seems to return the parameter name, not it's value.

It's obvious that I must be missing something, but what is it? I've really run out of ideas.

Thanks in advance for your help!,



Adrian Grigore

--
Adrian Grigore
[EMAIL PROTECTED]
Lobstersoft - Fun Brain-Bending Games For All Ages
http://www.lobstersoft.com



---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to