Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^5: Password Generation and Module Multiplication (qw warnings)

by tye (Cardinal)
on Nov 29, 2010 at 03:28 UTC ( #874170=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Password Generation and Module Multiplication
in thread Password Generation and Module Multiplication

But that improvement doesn't go far enough. The "," and "#" warnings make me think it would be better to allow escaping inside qw. For example

my @tokens= qw( $ \# ; \, if else else\ if ); # '$' '#' ';' ',' 'if' 'else' 'else if'

The warning should be changed to:

Unescaped ',', '#', or '\' in qw ...

The trick is what level of deference to provide for backward compatibility of unlikely constructs. Silently changing the interpretation of qw( / - \ | ) would be bad. So I'd make qw( \ ) warn for a while before supporting escaped whitespace characters. I don't expect to find \# nor \, inside qw in existing code but maybe qw( \\ ) is slightly more common? That'd be the tough one to deal with.

Maybe just add qqw() that supports escaping? I'd like to be able to even use \n, \t, and \x3e type constructs in qw() on rare occasions.

I guess the current "fix" for the warnings is either no warnings 'qw'; or qw( . ? ! ), ',', qw( ; : ). I dislike the former as it can't distinguish the comma I meant to escape from the comma I slipped in by accident. So I tend to quickly end up replacing qw with quoted strings.

Actually, I'd like qqw to ignore /\s#(\s[^\n]*)?\n/ as my desire to add comments is a common reason I end up replacing qw with quoted strings.

- tye        


Comment on Re^5: Password Generation and Module Multiplication (qw warnings)
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2014-12-22 03:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (110 votes), past polls