RE: trying to create first simple perl 'filter' program on windows

2011-03-04 Thread Brian Raven


From: perl-win32-users-boun...@listserv.activestate.com 
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Glenn 
Linderman
Sent: 04 March 2011 00:18
To: perl-win32-users@listserv.ActiveState.com
Subject: Re: trying to create first simple perl 'filter' program on windows

 On 3/3/2011 4:07 PM, Greg Aiken wrote:
 im wanting to write a simple perl 'filter' program in windows.
 I basically took the base code found here...


 when invoked as a true filter, type test.txt | filter.pl, it croaks with 'the 
 process tried to write to a
 nonexistent pipe'.

 I am not sure if what I am trying to do can be achieved with such simple code 
 on windows.

 Bug in your version of Windows.  Workaround:type test.txt | perl filter.pl

More likely a bug (or feature?) of the command shell. It works using the cygwin 
shell, as long as you put the appropriate line at the start of your script, 
e.g. #!c:/perl/bin/perl.

Another work around is to turn your script into a batch file. See the provided 
script pl2bat for help with that.

HTH


--
Brian Raven




Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient or have received this e-mail in error, please advise 
the sender immediately by reply e-mail and delete this message and any 
attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


trying to create first simple perl 'filter' program on windows

2011-03-03 Thread Greg Aiken
im wanting to write a simple perl 'filter' program in windows.

I basically took the base code found here.

 

http://www.techrepublic.com/blog/programming-and-development/simple-filters-
in-perl-ruby-and-bourne-shell/3481

 

the sample here is simple, convert upper case single byte ascii chars to
lower case.

 

#assume youve got a text file, 'test.txt' = 'THIS is a test file'

 

#this works on windows:

#  filter.pl test.txt

 

#this doesnt seem to work on windows (should it?):

#  type file.txt | filter.pl

 

while () {#read input from std in

print lc($_);   #print to std out the lowercase string

}

 

C:\perlsrc\getcfilter.pl test.txt

this is a test file

C:\perlsrc\getctype test.txt

THIS is a test file

C:\perlsrc\getctype test.txt | filter.pl

The process tried to write to a nonexistent pipe.

 

when invoked as filter.pl test.txt - it works fine.  but in this case
nothing is technically being 'piped' into filter.pl.  instead I am giving it
the name of a file as an ARGV.

 

when invoked as a true filter, type test.txt | filter.pl, it croaks with
'the process tried to write to a nonexistent pipe'.

 

I am not sure if what I am trying to do can be achieved with such simple
code on windows.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: trying to create first simple perl 'filter' program on windows

2011-03-03 Thread Glenn Linderman

On 3/3/2011 4:07 PM, Greg Aiken wrote:


im wanting to write a simple perl 'filter' program in windows.

I basically took the base code found here...

http://www.techrepublic.com/blog/programming-and-development/simple-filters-in-perl-ruby-and-bourne-shell/3481

the sample here is simple, convert upper case single byte ascii chars 
to lower case.


#assume youve got a text file, 'test.txt' = 'THIS is a test file'

#this works on windows:

#  filter.pl test.txt

#this doesnt seem to work on windows (should it?):

#  type file.txt | filter.pl

while () {#read input from std in

print lc($_);   #print to std out the lowercase string

}

C:\perlsrc\getcfilter.pl test.txt

this is a test file

C:\perlsrc\getctype test.txt

THIS is a test file

C:\perlsrc\getctype test.txt | filter.pl

The process tried to write to a nonexistent pipe.

when invoked as filter.pl test.txt -- it works fine.  but in this case 
nothing is technically being 'piped' into filter.pl.  instead I am 
giving it the name of a file as an ARGV.


when invoked as a true filter, type test.txt | filter.pl, it croaks 
with 'the process tried to write to a nonexistent pipe'.


I am not sure if what I am trying to do can be achieved with such 
simple code on windows.




Bug in your version of Windows.  Workaround:type test.txt | perl 
filter.pl
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs