Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Parsing arguments

by tadman (Prior)
on Feb 20, 2003 at 17:26 UTC ( [id://237144]=note: print w/replies, xml ) Need Help??


in reply to Parsing arguments

This is usually a lot trickier than the example code you have here for reasons such as:
bareword='quoted\'s string' bareword='quoted''s string' bareword="quoted \"string\""
I'm not sure if that's something you're going to have to deal with, but it's always good to have a complete test case.

Replies are listed 'Best First'.
Re: Re: Parsing arguments
by hv (Prior) on Feb 20, 2003 at 17:42 UTC

    Agreed, though there's no current requirement to support escaping in the quoted strings. But that's exactly the sort of reason I'm unhappy about the duplicated regexp chunks, since it'd be easy to enhance one of the ' ([^']*) ' fragments and miss the other.

    Similarly, I could collapse the single- and double-quoted string checks with a style like   (["']) (.*?) \1, but that can make tracking the capture numbers even harder, since now a change in the regexp would mean updating the numbering elsewhere in the pattern as well as in the push @args, ... code.

    Hugo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-19 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found