Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

new CGI is easily misunderstood. Some even suggest that you should write CGI::->new() to prevent CGI->new() being interpretted as main::CGI()->new(), which is possible. I'm not completely decided on that last point because I don't think it is supported in moderately old versions of Perl and I feel that I can usually avoid having functions that have the same name as modules that I use. I will probably convert to CGI::->new() before too long, though.

So let's consider:

my $q= new CGI;
What if you do this from a package? You probably have a new() method of your own and now you've (probably) done:
my $q= new( "CGI" );
I think there are also gotchas with regard to confusing precedence, but I don't recall them.

So many (including me) suggest that you always avoid "indirect object" notation. This might also apply to the standard:

print HANDLE "Stuff\n";
which should instead be written:
HANDLE->print( "Stuff\n" );
but I've not seen that point pushed much. I personally think that things will slowly migrate that direction, though.

        - tye (but my friends call me "Tye")

In reply to Indirect object syntax (RE: Beginnings of Online CGI Course) by tye
in thread Beginnings of Online CGI Course by Ovid

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-04-18 13:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found