Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Standard way for displaying a script's output.

by BrowserUk (Pope)
on Feb 11, 2012 at 09:58 UTC ( #953199=note: print w/ replies, xml ) Need Help??


in reply to Standard way for displaying a script's output.

How about we mandate a standard template for a PM submissions(1). This has the advantage that it automatically captures the output for you:

#! perl -sw use strict; use Inline::Files; select OUTPUT; print while <INPUT1>; print while <INPUT2>; __DATA__ __INPUT1__ 1 2 3 4 5 __INPUT2__ A B C D E __OUTPUT__ 1 2 3 4 5 A B C D E

<smaller>(1)JK! </smaller>


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?


Comment on Re: Standard way for displaying a script's output.
Download Code
Re^2: Standard way for displaying a script's output.
by Anonymous Monk on Feb 11, 2012 at 10:54 UTC

    I'd much prefer to avoid Inline::Files , but no reason the user can't choose what kind of NEW QUESTION to ask

    Do you have code, sample input, expected output? Ask your question with NEW QUESTION VROOM template

    <p> I'm trying to merge and edit two files with this program (short ex +ample files in %data ) <code> #!/usr/bin/perl -s -- use strict; use warnings; use autodie; Main( @ARGV ); exit( 0 ); sub Main { if( $help ){ return print Usage(); } open my($in1) , '<', \$data{input1}; open my($in2) , '<', \$data{input1}; while( not( grep eof, $in1, $in2 ) ){ my $line1 = <$in1>; my $line2 = <$in1>; chomp $line1; print $line1, $line2; } close $in1; close $in2; } sub Usage { <<"__USAGE__"; $0 $0 -help $0 -foo $0 -oof=bar $0 -oof=bar baz __USAGE__ } ## end sub Usage BEGIN { our %data = ( input1 => \<<'__VROOM', __VROOM input2 => \<<'__VROOM', __VROOM expectedOutput => \<<'__VROOM', __VROOM ); } ## end BEGIN __END__ </code> <p> I want the get output $data{expectedOutput} but it gives me this +error message / faulty output:</p> <code> error message or faulty output here </code> <p> I'm trying to ... <p> I also tried ...

      Geez! Talk about overkill.

      First, look at the last line of my post.

      Second, are you really suggesting that every sample posted to ask a question here has to include a Usage section? Why not require formal test suite; and a perltidy formatting; and PBB compliance enforced by a documented, full perlcritic clean pass. Not forgetting a full GPL3 notice, liability waver. And a git repository link...

      If we raise the bar high enough ...


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

        Geez! Talk about overkill.

        choice is choice

        First, look at the last line of my post.

        What post? Why? JK? JK does not computer

        Second, are you really suggesting that every sample posted to ask a question here has to include a Usage section?

        For my template, sure, why not, goes along with the -s option , so it might as well

        Why require ... If we raise the bar high enough ...

        No thanks, I stay out of bars

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2014-12-25 21:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (163 votes), past polls