> > I was wondering if you could help me get this script > > tied to one of my Perl programs on my Win2000 box. > > After much experimentation, I've changed the line > > open(C, "./read-own-stdout-piper 2>&1 |") or warn $!; > > to > > open(C, "round2.bat 2>&1 |") or warn $!; > > > > round2.bat is a DOS batch file with a single line: > > perl round2.pl # (that is the way I run perl programs) > > > > round2.pl has: > > > > use strict; > > use warnings; > > my $number = 5.6278; > > my $rounded = sprintf '%.2f', $number; > > print "$rounded\n"; > > $|++; # << SHOULD THIS LINE BE HERE? > > > > AND IT ALL WORKS! > > > > I can't just do > > open(C, "round2.pl 2>&1 |") or warn $!; > > because then it just opens round2.pl in my text editor, > > > since that is the association I have ".pl" set to. > > Why?!?! Why screw with something that works, unscrewed with, just fine? The > asscociations set up > by the ActivePerl install are the appropriate ones for making Perl run.
Thanks for the response. Remember, I am using Windows on this box. As others have recently pointed out, I need to run Perl in a command prompt anyway, so it behooves me to associate ".pl" with my text editor and not the Perl executable. > If you > want associations to your > preferred editor, then: > Open Windows Explorer, or the abonminable kindergarten version My Computer > Click Folder Options on the Tools menu > Select File types > Find the PL extension. > Click the Advanced button. > Restore the Open association with the perl executable. The Open action should > read: > > "C:\Perl\bin\perl.exe" "%1" %* > > presuming that Perl is installed to the default location for Windows > > Create an Edit action tied to your editor. I don't know what an "Edit action" is, but I am looking into it. > > Changing the primary association is a bad hack, and a bad habit to be in as you > start learning a programming > language. > > Actually, once you right-click on any registered file type in Win2K, and use the > Open with... option option to > select an alternate handler, that handler will thereafter be available on a list > under the Open with menu item. > > In brief, there is no good reason to mess with a working file association > > > I tried > > open(C, "'perl round2.pl' 2>&1 |") or warn $!; > > but that didn't work either. > > open(C, "perl round2.pl 2>&1 |") or warn $!; I thought I tried that, but apparently not, because it works perfectly. Not too smart on my part. > or simply: > open(CHILD, "perl round2.pl | ") or warn "Could not open pipe from child > process: $!"; > > > > > That "Got:" prompt isn't too cool, but I'm sure I'll > > learn how to turn that off later. > > > > Also, it's unfortunate that copy and paste don't work > > in that TK box. > > If it is a Text widget, copy and paste will indeed work. Can you provide more > detail on > why you think it doesn't? I changed round2.pl to include "print "Hello World\n";" Now it's the nice, pretty Tk box with "Got: 5.63" on the first line and "Got: Hello World" on the 2nd line. Clicking on each line alternately highlights the entire line or unhighlights the entire line with a dark blue line. You can have both lines highlighted if you like. In any case, hitting ctrl C does not copy anything to the clipboard, and you cannot highlight just part of a line of text. > > Anyway, thanks a bunch. If there are other posts > > on the NG related to this, I'll see them when I get > > home. > > > > Mike Flannigan > > Houston, TX > > Mike, I think you have a conceptual problem here. Yeah, my main problem is I'm using Windows. I've been trying to get a Linux box set up for quite some time now, but it looks like it's going to be quite a bit longer before I have it running. > Seeking STDIN from a GUI > widget, Yeah, I thought you could do that. I need to study TK quite a bit. > hacking > and breaking working file associations, etc. indicate a bad habit that will > hobble your programming > efforts if unaddressed. *Let working systems be*, don't fix what ain't broke. > > Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>