Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > print to STDOUT works but FH1 does not with FIFO named pipe

Reply
Thread Tools

print to STDOUT works but FH1 does not with FIFO named pipe

 
 
Paul Lalli
Guest
Posts: n/a
 
      07-14-2004
On Wed, 14 Jul 2004, Rocky wrote:

> My mistake. I left the FH1 and FH2 out of the posted code. When I run
> this script and just print it to standard out the data will stream
> perfectly as it comes in from the FIFO. If I print it to FH1,FH2 and tail
> -f the output files I get nothing. That, I guess, is what I should have
> said from the beginning


As I said in my last post, show us your code. We can't debug something on
your assertion that it should work. We have to see the actual code you're
using. Show us the code that you think should work, but does not.

Paul Lalli
 
Reply With Quote
 
 
 
 
Rocky
Guest
Posts: n/a
 
      07-14-2004
On Wed, 14 Jul 2004 12:16:48 -0700, Purl Gurl wrote:

> Paul Lalli wrote:
>
>> Rocky wrote:
>> > Purl Gurl wrote:
>> > > Rocky wrote:

>
> (snipped)
>
>> > >> I have a problem and I need assistance.

>
>> > > Can't find string terminator "`" anywhere before EOF at test.pl line 6.

>
>> In your post, you accidentally typed a ` character after line 6 of the
>> code. It clearly does not belong there.

>
> Bit of a stretch that, but not your words.
>
> For a typist to type a grave accent, she (typical typist gender)
> must stretch her little finger upward and leftward, quite a good
> distance, while keeping her left index finger on the f key, and
> if limber, both left thumb and right thumb pressed against the
> bottom edge of her spacebar.
>
> It is very difficult to accidently type the least noticable key,
> a grave accent, even if typical masculine index finger poking
> style typing.
>
> Last character typed is a semicolon, next would be Enter, with
> both on the far right edge of keyboard standard keys. To
> suddenly stretch upward and to the left, illogical and
> rather suggestive; very difficult to be accidental, even
> for BoBo The Clown.
>
>
> Purl Gurl


Not a typo -- a feature of my broken keyboard -- free `backticks` every
few hundred characters it is 6 years old but I like it because it has
"clicky keys" that make me sound like a good typist
 
Reply With Quote
 
 
 
 
Rocky
Guest
Posts: n/a
 
      07-14-2004
On Wed, 14 Jul 2004 15:10:58 -0400, Paul Lalli wrote:

> On Wed, 14 Jul 2004, Rocky wrote:
>
>> My mistake. I left the FH1 and FH2 out of the posted code. When I run
>> this script and just print it to standard out the data will stream
>> perfectly as it comes in from the FIFO. If I print it to FH1,FH2 and tail
>> -f the output files I get nothing. That, I guess, is what I should have
>> said from the beginning

>
> As I said in my last post, show us your code. We can't debug something on
> your assertion that it should work. We have to see the actual code you're
> using. Show us the code that you think should work, but does not.
>
> Paul Lalli


so posted sir.

#!/usr/bin/perl
use warnings;
use strict;
$| = 1;
#open(FH3,"</var/run/syslogdpipe") or die "$!\n";
open(FH3,"</storage/tempmail") or die "$!\n";
open(FH1,">./mx0out") or die "$!\n";
open(FH2,">./mx1out") or die "$!\n";
while (<FH3>)
{
my $line = $_;
if ($line =~ /^.*svr-linux.*$/)
{
print FH1 "mx00 $line\n";
}
elsif ($line =~ /^.*192\.168.*$/)
{
print FH2 "mx01 $line\n";
}
}

 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      07-14-2004
Rocky <(E-Mail Removed)> wrote in
news(E-Mail Removed) rg:

> On Wed, 14 Jul 2004 18:13:37 +0000, A. Sinan Unur wrote:
>
>> Rocky <(E-Mail Removed)> wrote in
>> news(E-Mail Removed) rg:
>>
>>> On Wed, 14 Jul 2004 10:48:24 -0700, Purl Gurl wrote:
>>>
>>>> Rocky wrote:
>>>>
>>>>> I have a problem and I need assistance.
>>>>
>>>> Can't find string terminator "`" anywhere before EOF at test.pl line
>>>> 6.
>>>>
>>>> Purl Gurl
>>> ???
>>> Is that an error that you get while trying to run the script? I do
>>> not get the same thing and I can see no place where it might occurr.
>>> Please explain. thank you,
>>> Rocky

>>
>> Check your posting carefully:
>>
>>>>> open(FH1,">./mx0out");`

>>
>> See those few pixels at the end of the line ... That's an extra
>> character.


> Indeed it is. Thank you for pointing that out. Please forgive me.
> you have cracked the case. My compliments on a job well done. Cornell
> sucks


Well, especially since you seemed to be aware of your keyboard's tendency
to produce extra unwanted characters, maybe you should have checked your
post for those characters before claiming you could see nothing in your
posted code that would have caused the error message noted by Purl Gurl.

BTW, your attitude does not work in your favor.

--
A. Sinan Unur
http://www.velocityreviews.com/forums/(E-Mail Removed)d
(remove '.invalid' and reverse each component for email address)

 
Reply With Quote
 
Matt Garrish
Guest
Posts: n/a
 
      07-14-2004

"Purl Gurl" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Purl Gurl wrote:
>
> > ...least noticable key,

>
> Noticeable noticable, a hazard of typing at
> Warp 9 speed.
>


Doesn't say much for your English skills if that is the only error you think
is worth correcting.

Matt

p.s. If you want to know why you never see your students again after the
first lesson, it's because one lesson is enough to establish that they know
more than the teacher.


 
Reply With Quote
 
Matt Garrish
Guest
Posts: n/a
 
      07-14-2004

"Rocky" <(E-Mail Removed)> wrote in message
news(E-Mail Removed) rg...
> On Wed, 14 Jul 2004 15:10:58 -0400, Paul Lalli wrote:
>
> > On Wed, 14 Jul 2004, Rocky wrote:
> >
> >> My mistake. I left the FH1 and FH2 out of the posted code. When I run
> >> this script and just print it to standard out the data will stream
> >> perfectly as it comes in from the FIFO. If I print it to FH1,FH2 and

tail
> >> -f the output files I get nothing. That, I guess, is what I should

have
> >> said from the beginning

> >
> > As I said in my last post, show us your code. We can't debug something

on
> > your assertion that it should work. We have to see the actual code

you're
> > using. Show us the code that you think should work, but does not.
> >
> > Paul Lalli

>
> so posted sir.
>
> #!/usr/bin/perl
> use warnings;
> use strict;
> $| = 1;
> #open(FH3,"</var/run/syslogdpipe") or die "$!\n";
> open(FH3,"</storage/tempmail") or die "$!\n";
> open(FH1,">./mx0out") or die "$!\n";
> open(FH2,">./mx1out") or die "$!\n";
> while (<FH3>)
> {
> my $line = $_;
> if ($line =~ /^.*svr-linux.*$/)
> {
> print FH1 "mx00 $line\n";
> }
> elsif ($line =~ /^.*192\.168.*$/)
> {
> print FH2 "mx01 $line\n";
> }
> }
>


Are you closing the filehandles? That would be my guess as to why you aren't
seeing any output in the files.

Matt


 
Reply With Quote
 
Rocky
Guest
Posts: n/a
 
      07-14-2004
On Wed, 14 Jul 2004 20:21:28 +0000, A. Sinan Unur wrote:

> Rocky <(E-Mail Removed)> wrote in
> news(E-Mail Removed) rg:
>
>> On Wed, 14 Jul 2004 18:13:37 +0000, A. Sinan Unur wrote:
>>
>>> Rocky <(E-Mail Removed)> wrote in
>>> news(E-Mail Removed) rg:
>>>
>>>> On Wed, 14 Jul 2004 10:48:24 -0700, Purl Gurl wrote:
>>>>
>>>>> Rocky wrote:
>>>>>
>>>>>> I have a problem and I need assistance.
>>>>>
>>>>> Can't find string terminator "`" anywhere before EOF at test.pl line
>>>>> 6.
>>>>>
>>>>> Purl Gurl
>>>> ???
>>>> Is that an error that you get while trying to run the script? I do
>>>> not get the same thing and I can see no place where it might occurr.
>>>> Please explain. thank you,
>>>> Rocky
>>>
>>> Check your posting carefully:
>>>
>>>>>> open(FH1,">./mx0out");`
>>>
>>> See those few pixels at the end of the line ... That's an extra
>>> character.

>
>> Indeed it is. Thank you for pointing that out. Please forgive me.
>> you have cracked the case. My compliments on a job well done. Cornell
>> sucks

>
> Well, especially since you seemed to be aware of your keyboard's tendency
> to produce extra unwanted characters, maybe you should have checked your
> post for those characters before claiming you could see nothing in your
> posted code that would have caused the error message noted by Purl Gurl.
>
> BTW, your attitude does not work in your favor.



*this thread has not worked in my favor either*

I have checked out a few of the posters to this thread on google and you all seem to be very
intelligent people. Most instruct or teach in some form or another. Yet
you waste time and energy picking on the smallest error as though you were
larry wall himself. Please do not help me if that is your attitude.
There are 15 posts in this thread already and no one has addressed the
question that I have asked. There are many people who
really want to help. You sir, do not seem to be one. So to you I say
this. Cornell sucks because it produces people like you

 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      07-14-2004
Rocky <(E-Mail Removed)> wrote in
news(E-Mail Removed) rg:

> so posted sir.
>
> #!/usr/bin/perl
> use warnings;
> use strict;
> $| = 1;


I do not think there is any point to this. You are not printing anything
to STDOUT.

> #open(FH3,"</var/run/syslogdpipe") or die "$!\n";


Check the difference between

die "Error: $!\n";

and

die "Error: $!";

Most of the time, it is better not to use the newline.

> open(FH3,"</storage/tempmail") or die "$!\n";
> open(FH1,">./mx0out") or die "$!\n";
> open(FH2,">./mx1out") or die "$!\n";
> while (<FH3>)
> {
> my $line = $_;



The idiom for this is

while(my $line = <FH3>)

> if ($line =~ /^.*svr-linux.*$/)
> {
> print FH1 "mx00 $line\n";
> }
> elsif ($line =~ /^.*192\.168.*$/)
> {
> print FH2 "mx01 $line\n";
> }
> }


Please post properly formatted code.

use warnings;
use strict;

open my $fh1, '>', './mx0out' or die $!;
open my $fh2, '>', './mx1out' or die $!;

while( <DATA> ) {
if( /^.*svr-linux.*$/ ) {
print $fh1 "mx00 $_";
} elsif( /^.*192\.168.*$/ ) {
print $fh2 "mx01 $_";
}
}

close $fh2 or die $!;
close $fh1 or die $!;

__DATA__
sayudtauysdtyutasdsvr-linuxsaldfjksdfj
ksjadhfuysdtyutasdsvr-linuxsaldfjksdfj
sayudtaskjdfhutasdsvr-linuxsaldfjksdfj
192.168.1.1
192.168.1.2
34.234.32.4

C:\Home> ttt.pl

C:\Home\> cat mx0out
mx00 sayudtauysdtyutasdsvr-linuxsaldfjksdfj
mx00 ksjadhfuysdtyutasdsvr-linuxsaldfjksdfj
mx00 sayudtaskjdfhutasdsvr-linuxsaldfjksdfj

C:\Home> cat mx1out
mx01 192.168.1.1
mx01 192.168.1.2

--
A. Sinan Unur
(E-Mail Removed)d
(remove '.invalid' and reverse each component for email address)

 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      07-14-2004
I am going to rearrange this post a little bit to clarify what happened
here.

>>>>> On Wed, 14 Jul 2004 10:48:24 -0700, Purl Gurl wrote:
>>>>>
>>>>>> Rocky wrote:
>>>>>>
>>>>>>> I have a problem and I need assistance.
>>>>>>
>>>>>> Can't find string terminator "`" anywhere before EOF at test.pl
>>>>>> line 6.
>>>>>>
>>>>>> Purl Gurl


To which you responded

>>>> Rocky <(E-Mail Removed)> wrote in
>>>> news(E-Mail Removed) rg:
>>>>
>>>>> ???
>>>>> Is that an error that you get while trying to run the script? I
>>>>> do not get the same thing and I can see no place where it might
>>>>> occurr. Please explain. thank you,
>>>>> Rocky


>>> On Wed, 14 Jul 2004 18:13:37 +0000, A. Sinan Unur wrote:
>>>
>>>>
>>>> Check your posting carefully:
>>>>
>>>>>>> open(FH1,">./mx0out");`
>>>>
>>>> See those few pixels at the end of the line ... That's an extra
>>>> character.


I pointed out to you what was causing the error message about which you
seemed to be confused.

If your response to that is:

Rocky <(E-Mail Removed)> wrote in
news(E-Mail Removed) rg:

> Yet you waste time and energy picking on the smallest error
> as though you were larry wall himself. Please do not help
> me if that is your attitude. There are 15 posts in this thread
> already and no one has addressed the question that I have asked.
> There are many people who really want to help. You sir, do not
> seem to be one. So to you I say this. Cornell sucks because it
> produces people like you


I am happy as long as they pay my salary.
--
A. Sinan Unur
(E-Mail Removed)d
(remove '.invalid' and reverse each component for email address)

 
Reply With Quote
 
Rocky Allen
Guest
Posts: n/a
 
      07-14-2004
On Wed, 14 Jul 2004 21:38:14 +0000, A. Sinan Unur wrote:

> I am going to rearrange this post a little bit to clarify what happened
> here.
>
>>>>>> On Wed, 14 Jul 2004 10:48:24 -0700, Purl Gurl wrote:
>>>>>>
>>>>>>> Rocky wrote:
>>>>>>>
>>>>>>>> I have a problem and I need assistance.
>>>>>>>
>>>>>>> Can't find string terminator "`" anywhere before EOF at test.pl
>>>>>>> line 6.
>>>>>>>
>>>>>>> Purl Gurl

>
> To which you responded
>
>>>>> Rocky <(E-Mail Removed)> wrote in
>>>>> news(E-Mail Removed) rg:
>>>>>
>>>>>> ???
>>>>>> Is that an error that you get while trying to run the script? I
>>>>>> do not get the same thing and I can see no place where it might
>>>>>> occurr. Please explain. thank you,
>>>>>> Rocky

>
>>>> On Wed, 14 Jul 2004 18:13:37 +0000, A. Sinan Unur wrote:
>>>>
>>>>>
>>>>> Check your posting carefully:
>>>>>
>>>>>>>> open(FH1,">./mx0out");`
>>>>>
>>>>> See those few pixels at the end of the line ... That's an extra
>>>>> character.

>
> I pointed out to you what was causing the error message about which you
> seemed to be confused.
>
> If your response to that is:
>
> Rocky <(E-Mail Removed)> wrote in
> news(E-Mail Removed) rg:
>
>> Yet you waste time and energy picking on the smallest error
>> as though you were larry wall himself. Please do not help
>> me if that is your attitude. There are 15 posts in this thread
>> already and no one has addressed the question that I have asked.
>> There are many people who really want to help. You sir, do not
>> seem to be one. So to you I say this. Cornell sucks because it
>> produces people like you

>
> I am happy as long as they pay my salary.



Yeah, I guess that is what it's all about.

your results in the other section of this thread duplicate mine exactly.
The problem does not occurr when I read in a file. It occurrs when I read
from a named pipe which is what /var/run/syslogdpipe is. Anyway, thank
you for your help and have a great day. It might be faster just to read
the book.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
any body having complete code for a synchronous FIFO or know a link where FIFO codes are available chaitu VHDL 1 06-01-2007 03:45 AM
any body having complete code for a synchronous FIFO or know a link where FIFO codes are available chaitu VHDL 1 05-31-2007 03:31 PM
any body having complete code for a synchronous FIFO or know a link where FIFO codes are available chaitu VHDL 0 05-31-2007 02:28 PM
Problems redirecting STDOUT (NOT sys.stdout) to a pipe. Elad Python 0 03-19-2006 01:30 PM
[named pipe] i wanna know about validate of pipe handle of client lee, wonsun C++ 1 11-02-2004 04:29 AM



Advertisments