Loading ...
Sorry, an error occurred while loading the content.

Passing form input to subroutine

Expand Messages
  • Charlie Farinella
    I m passing parameters from a form to a result page, and then trying to call a subroutine from an external package to process the variable. I m using
    Message 1 of 3 , Sep 9, 2002
    • 0 Attachment
      I'm passing parameters from a form to a result page, and then trying to
      call a subroutine from an external package to process the variable.

      I'm using $Request->Form to get the value from the form to the result
      page, but my subroutine is unable to make use of it. What is required
      to make the subroutine aware of the variable?

      --
      ------------------------------------------------------------------------
      Charlie Farinella, Appropriate Solutions, Inc.
      cfarinella@...
      603-924-6079



      ---------------------------------------------------------------------
      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...
    • Josh Chamas
      ... You can do $main::Request- Form from any perl package, or if you have GlobalPackage set to something like MyPackage, you can do $MyPackage::Request- Form.
      Message 2 of 3 , Sep 9, 2002
      • 0 Attachment
        Charlie Farinella wrote:
        > I'm passing parameters from a form to a result page, and then trying to
        > call a subroutine from an external package to process the variable.
        >
        > I'm using $Request->Form to get the value from the form to the result
        > page, but my subroutine is unable to make use of it. What is required
        > to make the subroutine aware of the variable?
        >

        You can do $main::Request->Form from any perl package,
        or if you have GlobalPackage set to something like MyPackage,
        you can do $MyPackage::Request->Form. This inherently makes
        your package aware of ASP type variables, which might be bad design.
        You might better do something like &My::sub($Request->Form) when
        you call it from the ASP script in the first place. Request->Form
        is just a hash ref so is pretty ASP independent, and the params
        could come from anywhere.

        Regards,

        Josh
        ________________________________________________________________
        Josh Chamas, Founder phone:925-552-0128
        Chamas Enterprises Inc. http://www.chamas.com
        NodeWorks Link Checking http://www.nodeworks.com


        ---------------------------------------------------------------------
        To unsubscribe, e-mail: asp-unsubscribe@...
        For additional commands, e-mail: asp-help@...
      • Brat Wizard
        In my applications, I generally scoop up the form into a hash and then pass it as a hash ref. eg: my $form = $Request- Form(); myfunc($form); sub myfunc { my
        Message 3 of 3 , Sep 9, 2002
        • 0 Attachment
          In my applications, I generally scoop up the form into a hash and then pass it
          as a hash ref. eg:

          my $form = $Request->Form();
          myfunc($form);

          sub myfunc {
          my $form = shift;
          print "Use like this: ", $form->{key};
          print "Or like this: ", $$form{key};
          }

          Hope this helps

          John

          On Monday 09 September 2002 01:24 pm, Josh Chamas spewed into the ether:
          > Charlie Farinella wrote:
          > > I'm passing parameters from a form to a result page, and then trying to
          > > call a subroutine from an external package to process the variable.
          > >
          > > I'm using $Request->Form to get the value from the form to the result
          > > page, but my subroutine is unable to make use of it. What is required
          > > to make the subroutine aware of the variable?
          --

          --------------------------------------------------------------------------------
          Check out http://www.Wizard.Org for great deals on Electronic Parts
          *NEW* Computer Parts & Accessories - Drives - LCD - Systems - Linux
          --------------------------------------------------------------------------------
          ** Affordable Online Store w/Merchant Card Processing & Paypal **
          Write to us: sales@... -- Get your Store Online Today!
          --------------------------------------------------------------------------------



          ---------------------------------------------------------------------
          To unsubscribe, e-mail: asp-unsubscribe@...
          For additional commands, e-mail: asp-help@...
        Your message has been successfully submitted and would be delivered to recipients shortly.