[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] problem with PATH_INFO not being recognized


Punkish,

Sorry about that. Version issue. The anonymous array I missed, also. Again, sorry. Thanks for the pointers.

Sean

On Dec 9, 2004, at 11:10 AM, punkish wrote:

On Thu, 9 Dec 2004 06:33:12 -0500, Sean Davis <suppressed> wrote:
Punkish,

path_info is going to be interpreted as a cgi parameter, so if you want
to feed the path_info parameter to your script, you need to do it as a
parameter.  In practice, that means:

http:://localhost/~user/myapp/index.cgi?path_info=welcome

no Sean. You are likely confusing QUERY_STRING with PATH_INFO (these
are the cgi environment variables that populate the ENV hash).

PATH_INFO refers to the portion _after_ the immutable part of the URI.

so, the non-changing part of my URI is ../index.cgi and everything
after that becomes PATH_INFO.


For directing traffic (moving from one page to the next), you will have
to provide path_info parameter in some manner.

Also, I think mode_param takes a single string like:

$self->mode_param('path_info');

C-A 3.31 provides a shortcut to grab PATH_INFO by setting
mode_param(path_info => 1)


And run_modes takes a hash of mode names and associated subroutines to
call like:

$self->run_modes(
     'welcome' => 'welcome',
     'login'   => 'login',
....
)

yes, but you can also provide runmodes as an anon array as long as the
runmodes themselves are named exactly as the calls they are gonna
make.

so the above can be shortened to run_modes([qw/welcome login/])

Thanks anyway.


I the stuff above is correct, but someone can correct me if I'm wrong
on this.  If you really need to "dispatch" from the path info like you
show below, you could look as CGI::Application::dispatch.

Sean




On Dec 9, 2004, at 1:40 AM, punkish wrote:

caution: extreme CGI-App n00b here.

My url is thus

http://localhost/~user/myapp/index.cgi

my extremely simple script is

sub setup {
      my $self = shift;
      $self->start_mode('welcome');
      $self->mode_param(path_info => 1);
      $self->run_modes([qw(welcome login verify about)]);
      $self->tmpl_path('templates/');
}

sub welcome { blah }
sub login { blah }
..

the PATH_INFO is not being handled correctly as the run_mode keeps on
defaulting to 'welcome' no matter what path_info I provide after
index.cgi. Even if it is ..index.cgi/login or ..index.cgi/about, I see
only 'welcome' almost as if no path_info was provided.

Please tell me what obviously stupid thing I am doing wrong so I may
not tear out my remaining hair.

Many thanks in advance for your patience and kindness.

--

punkish

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




--

punkish


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


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.