Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: pattern match screwed up!!

by roboticus (Chancellor)
on Jan 22, 2015 at 11:54 UTC ( [id://1114124]=note: print w/replies, xml ) Need Help??


in reply to pattern match screwed up!!

mdfaizy:

In addition to what kennethk so eloquently said, I'd like to offer one little thing: A solution based on regexes can be fragile. You may spend a good bit of effort to make something that "works", and you'll be fine ... ... ... for a while. Every once in a while, the document will have something "interesting" in it, and your regex solution will break. Then you get to fix it. Unfortunately, it'll likely keep happening and irregular intervals.

Even worse, it may appear to be working, but you may miss important things. Since a regex solution doesn't understand the structure of the XML document, you won't know when your regexes aren't working unless they fail in an obvious fashion. The worst failures are when it fails in a non-obvious fashion. As an example, suppose you don't handle attributes on tags because there aren't any currently. Then someone makes a change, and you get a document like this:

... <orders> <order> <orderID>1234</orderID> .. other order details .. </order> <order priority="SUPER IMPORTANT"> <orderID>1235</orderID> .. multimillion dollar order .. </order> </orders> ...

Your boss, expecting a big order sometime soon asks "Hey, did we get any important orders yet?" You look at your log and say, "No, we just got one order today, it doesn't look special." That super important order will likely cause many people headaches and phone calls. But since the attribute existed in the order tag, it got missed.

</endOfContrivedExample>

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-23 20:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found