Good Day,

I was reading Z-Rated Code and Reinventing the Wheel which made reference to a few alternatives to the CGI module. One in particular was CGI::Simple. The CGI::Simple perldocs say the following with regards to the import_names method:

This method was silly, non OO and has been deleted.

Now, CGI::Simple's goal is to provide an OO interface, so naturally this method doesn't make much sense here.

But the statement that it was silly made me think a bit. What do other's think about using import_names?

I write web apps for a living. For most of my apps, I break out the controller into packages of event handlers (each package representing related functionality). import_names allows me to import all of my params into a namespace (I normally use in::) so I don't have to pass an object or hash between packages. It even supports multi-values as arrays (i.e. @in::foo).

I remember that PHP had a similar feature that was ultimately frowned upon because of security concerns, but I thought those were moot here because we specify a namespace, into which to dump the data.

Now, I am not debating the advantages of an OO framework by any means. I am just curious if there are any major pitfals with import_names that I am not seeing.

Thanks,

Ted Young

($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)

In reply to $CGI->import_names by TedYoung

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.