Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

PERL and ASP: using the $Request Object ?

by Buckaroo Buddha (Scribe)
on Jun 11, 2001 at 18:29 UTC ( [id://87502]=perlquestion: print w/replies, xml ) Need Help??

Buckaroo Buddha has asked for the wisdom of the Perl Monks concerning the following question:

I'm wondering where the hash is in the $Request->form() object is. for example: I'd like to go
foreach my $key (keys $Request->form()) { $Response->write("$key,"); }
I just can't figure out how to reference it...
%$Request->form()
didn't work either

Replies are listed 'Best First'.
Re: PERL and ASP: using the $Request Object ?
by Jouke (Curate) on Jun 11, 2001 at 18:32 UTC
    You were so close:

    %{$Request->form()}
    should work....

    Jouke Visser, Perl 'Adept'
    Using Perl to help the disabled: pVoice and pStory
      Thanks Jouke!
      I would have spent all day trying to find that out :)
      I now understand the object a lot better and have found out that the list of variables stored in the request object is not a hash table at all ... but a STRING!! (this, i'm sure many of you know ... but i'm even more sure that there are many who don't know and may stumble across this one day)

      the final code that i wound up using is
      split ('&',$Request->form->Item); foreach my $pair (@_) { my @temp = split ('=',$pair); $form_elements{$temp[0]} = $temp[1]; } foreach my $key (keys %form_elements) { $Response->write("$key = $form_elements{$key} <br>"); }
      this code is used in a situation where one has submited data from one form/webpage to the next. Having all of this information in a hash will allow you to carry all that data into the next form without worrying about what the specific KEYES of each of the form elements.

      There may be other ways to do this (feel free to chip in) ... but i think this is a pretty good way of doing it :)

Re: PERL and ASP: using the $Request Object ?
by $code or die (Deacon) on Jun 12, 2001 at 14:43 UTC
    There isn't a hash - you're accessing an OLE object.

    Check out this excellent PerlScript tutorial

    Remember that you can still use CGI with PerlScript and Win32::ASP

    I wrote this sub to create a hash for the Session Vars, you can do something similar with the Form collection
    use strict; use Win32::OLE qw(in); sub GetSessionVars { my %iis_sess; foreach my $key (in ($Session->Contents)) { $iis_sess{$key} = $Session->Contents($key); } return \%iis_sess; } my $session_vars = GetSessionVars();
    $code or die
    $ perldoc perldoc

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://87502]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-03-29 01:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found