Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: cmd.exe piping stress

by tomazos (Deacon)
on Mar 20, 2006 at 17:10 UTC ( [id://537995]=note: print w/replies, xml ) Need Help??


in reply to Re: cmd.exe piping stress
in thread cmd.exe piping stress

Th dmp4.results and the dmp4.piped are identical.

When I then go and run:

C:/> perl unit2summary.pl < dmp4.piped

It works.

When however I run it with "perl units.pl COM1 | perl unit2summary.pl" it doesn't work.

The COM1 identifies the com port. It is part of a basic unit testing framework for a consumer electronics device.

The code for unit2summary.pl follows:

#!perl use strict; use warnings; my %results = (); my $total; my $command = ''; my $result = ''; while (<STDIN>) { chomp; next if /^\s*$/; if (/^COMMAND:\s+(.*)$/) { $command = $1; } if (/^RESULT:\s+(.*)$/) { $result = $1; print "$result: $command \n"; $results{$result}++; $total++; } } print "\n"; print "TESTS: $total "; foreach (keys %results) { print "$_: " . $results{$_} . " (" . abs($results{$_} * 100 / $tot +al) . "%) "; } print "\n";

A sample of the dmp4.piped follows:

COMMAND: mc creation TIMEOUT: 3 Creating various ContentData objects SUCCESS: Up-Casting HMediaAudioCD to HMediaCD SUCCESS: Up-Casting HMediaImageCD to HMediaCD SUCCESS: Up-Casting HMediaVideoCD to HMediaCD Working with const ContentData objects SUCCESS: Creation of new const-pointer HMediaAudioCD initialized w +ith non-const handle SUCCESS: Up-casting constHMediaAudioCD to constHMediaCD SUCCESS: Const-Casting from constHMediaAudioCD to HMediaAudioCD SUCCESS: Down-casting from constHMediaCD to constHMediaAudioCD SUCCESS: Making Const from cpHACDconst to ccpCD not successful RETURN: RESULT: PASSED COMMAND: mc attr TIMEOUT: 3 Creating HMediaAudioCD and add Title Attribute SUCCESS: HMediaAudioCD created SUCCESS: Checking for attribute "title" ERROR: Checking attribute value: This is my lif Changing value of Title attribute by re-adding with different valu +e SUCCESS: Checking for attribute "title" (2nd time) SUCCESS: Checking if attribute value was updated SUCCESS: Checking No. of attributes: 1 SUCCESS: Re-Checking No. of attributes: 1 SUCCESS: Removing attribute ERROR: Checking if attribute was really removed Adding more attributes SUCCESS: Attribute 0 has value A SUCCESS: Attribute 1 has value B SUCCESS: Attribute 2 has value C SUCCESS: Attribute 3 has value D SUCCESS: Attribute 4 has value E SUCCESS: Removing attribute at index 1 in list SUCCESS: Trying to remove non-existing attribute at index 5 ERROR: Removing all 4 Attributes: 4 elements left Checking setAttributeValue methods SUCCESS: Checking if setting value by name on non existing attribu +te prohibited SUCCESS: Checking if setting value by index on non existing attrib +ute prohibited SUCCESS: Setting value to new attribute SUCCESS: Re-setting value of existing attribute at index 0 Testing const char* - interface Adding attribute using const char* interface SUCCESS: Getting value of just added attribute SUCCESS: Checking if value of attribute is correct: somewhere over + the rainbow SUCCESS: Re-setting value of just added attribute using const char +* interface SUCCESS: Getting value of just changed attribute SUCCESS: Checking if value of attribute is correct: somewhere over + the rainbow RETURN: RESULT: FAILED

Any help appreciated.

-Andrew.


Andrew Tomazos  |  andrew@tomazos.com  |  www.tomazos.com

Replies are listed 'Best First'.
Re^3: cmd.exe piping stress
by BrowserUk (Patriarch) on Mar 20, 2006 at 18:47 UTC
    C:/> perl unit2summary.pl < dmp4.piped

    Can I take it from the prompt shown in your command line that you are using some other shell than cmd.exe?

    If so, try your commands with cmd.exe. I can't see any difference in the behaviour here:

    C:\test>perl -pe1 junk.dat | perl unit2summary.pl PASSED: mc creation FAILED: mc attr TESTS: 2 PASSED: 1 (50%) FAILED: 1 (50%) C:\test>perl unit2summary.pl <junk.dat PASSED: mc creation FAILED: mc attr TESTS: 2 PASSED: 1 (50%) FAILED: 1 (50%)

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      I use both cygwin and cmd.exe.

      In both situations I get the same results.

      I notice now that under cmd.exe it is finding the cygwin perl first in the path. Maybe it is the cygwin perl causing trouble.

      I'm reinstalling ActiveState and will put that first in my path, and see what that does.

      -Andrew.


      Andrew Tomazos  |  andrew@tomazos.com  |  www.tomazos.com

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-12 10:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found