Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

What is this the spanish inquisition?

The dude asked for the two values to be retrieved and sent to a function called data_transform the results of which get printed out.

He didn't specify what data_transform does with the two values and his example appeared to be very simplified, because I sincerely doubt the real task is actually about multiplying letters by a given number.

What stumped me about your solution was that I found no mention at all of the function data_transform, and I had to use knowledge and understanding of perl object orientation to actually read the code and figure out what it does.

Your solution uses this bit of code :

$node->appendText( $node->textContent() x (shift(@counts) - 1) );

To multiply the letters by the numbers as per the example, which as I mentioned appeared to be over simplified and not real world.

Now my point is this; the guy asking the question is obviously a real beginner who probably doesn't understand object orientation and its notation, and was asking for a simple method to strip out the values and send them to a specific function.

Your example obviously works and does what he actually asked for, but you completely failed to recognise that what he asked for was probably not what he really wanted, and as a result you created this over-engineered verbose solution which is in all likelyhood way too complex and reliant on advanced perl programming techniques for the guy to actually be able to make any use of it.

If an 8 year old asked me what the government is, I would tell him its the people that everyone has chosen to decide how to run the country. I wouldn't give him a 2 hour lecture on party politics, law, and history because most of it would just go straight over his head.


In reply to Re^14: Processing Two XML Files in Parallel by Logicus
in thread Processing Two XML Files in Parallel by tedv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found