Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: "Correct" program style questions

by joe++ (Friar)
on Oct 23, 2002 at 18:15 UTC ( #207480=note: print w/ replies, xml ) Need Help??


in reply to "Correct" program style questions

Hi Ovid,

I would personally rather not import anything in my namespace, but use the OO interface instead. This is a matter of taste, but anyway this would be "my coding style":

#!/usr/bin/perl -wT use strict; use CGI; my $cgi = new CGI; my $_name = $cgi->param('name') || ''; ...
I know, this isn't going to work with HTML::Entities, but I made the lucky choice to use UTF-8 as encoding for our webpages, so no character escaping necessary (unless your input charset isn't UTF-8, but that's another story about Text::Iconv).

Otherways, I like the POSIX character classes (even more when we're talking UTF-8 and international users). I still use those old fashioned ranges like [a-zA-Z] however, 'cause we are still on 5.00_03 on our production servers blush ;-)

--
Cheers, Joe
Do I need a Disclaimer?


Comment on Re: "Correct" program style questions
Select or Download Code
Re: Re: "Correct" program style questions
by Ovid (Cardinal) on Oct 23, 2002 at 19:00 UTC

    joe++ wrote: I know, [not importing anything] isn't going to work with HTML::Entities....

    Actually, it can work with HTML::Entities. Merely specify an empty import list and fully qualify the function name.

    use HTML::Entities (); HTML::Entities::encode_entities( $name );

    Alternatively, you could simply require HTML::Entities and not call the import method.

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://207480]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2014-04-21 03:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (490 votes), past polls