Yeah, I have the tendancy of sliding in and out of backslashism from time to time. I often do it to impress the kids ;) Kidding aside, I agree, it does makes things more easier to read though.

-Carlos

Stas Bekman wrote:

Carlos Ramirez wrote:

Here's the latest 'diff -u' ;) (Thanks for the tip Stas)


If you don't mind, Carlos, a few readability tips to give less reason for people to state that perl is a write-once language.

Avoiding backslashism makes your code much more readable:

+ ## Parse $name's with Domain\Username + if ($name =~ /(\w+)[\\\/](.+)/) {


if ($name =~ m|(\w+)[\\/](.+)|) {

+    #Convert 'domain/userid' to 'domain\userid'
+    $name =~ s/\//\\/ if $name =~ /\//;


$name =~ s|/|\\| if $name =~ m|/|;

some people prefer s#foo#bar# but it's confusing. I normally use s|foo|bar| unless I need to OR patterns, in which case I usually use s{foo|tar}{bar}.

etc. in the rest of the code ;) sorry for sliding offtopic, but a good style helps.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to