Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

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

So what you're saying is:

  1. Program A outputs data with "\n" at the end.
  2. Program B chonks the data.
  3. Program A fails in some way, and outputs a line without a terminating "\n"
  4. Program B dies and reports the problem?

This will appear in test as.. what? a failure in Program A or Program B?

If Program A outputing "\n" at the end of the line is such a cruicial matter, shouldn't you be testing Program A's output explicitly for "\n" (or whatever your seperator is) instead of condeming the use of chomp everywhere?

And by using chop, how do you catch this in testing? like so?

$data = get_input_from_program_a(); $chopped = chop($data); if ($chopped ne $/) { die "Program A is acting up"; }

I'm just not up to the level to think that deeply into your problem, maybe you can help me understand?


He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.
Chady | http://chady.net/
Are you a Linux user in Lebanon? join the Lebanese GNU/Linux User Group.

In reply to Re^5: chop vs chomp by Chady
in thread chop vs chomp by Moron

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 imbibing at the Monastery: (4)
As of 2024-04-19 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found