you wrote:

What is the best way to pass all these variables to a mason component that does all the SQL work? How do I declair the variables qty1, qty2...etc in an <%args> if the number if them is always different?

my reply:

The simple answer is, you don't. From the mason documentation:

2. %ARGS hash: This variable, always available, contains all of the parameters passed to the component (whether or not they were declared). It is especially handy for dealing with large numbers of parameters, dynamically named parameters, or parameters with non-valid variable names. %ARGS can be used with or without an <%args> section, and its contents are unrelated to what you have declared in <%args>.

Which means, that in your example you can acess qty2 with

$ARGS{'qty2'}

and you can find all your id's with

my @ids = map { /^podid(\d+)/ ; $1 } grep { /^podid\d+/ } keys %ARGS;

You might also look at making a request object and store a cgi instance on it, created with new CGI(%ARGS)


In reply to Re: HTML forms and variable line items by Tuppence
in thread HTML forms and variable line items by neilwatson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.