Re: A problem about IPC::Open2
Admittedly, that wasn't particularly germane to the perl6 mailing list; but it did bring up an issue that's been bothering me for a while. I would like to see Perl6 handle the equivalent of IPC::Open2 using the same sort of syntax and semantics that it uses for sockets, by default. That is, I'd like to be able to say something like: $fh = "filename".open :rw; # same as open2 "filename", $in, $out; $line = =$fh; # same as $line = =$in; $fh.say "rewrite!"; # same as $out.say "rewrite!"; -- Jonathan "Dataweaver" Lang
Re: A problem about IPC::Open2
unsubscribe
A problem about IPC::Open2
Hello, I'm a beginner of the PERL language and I have troubles in understanding a PERL program these days. Actually I've been confused for a long time.I hope you can look into this program and point out the problem for me:) The program is in the attachment.It's a bit long , but the error occured at the very beginning. Here is the description: It's about the use of "IPC::Open2". In line 60 of file "SearnShell.pl" a pipe is opened. The program executes correctly until line 745 of file "SearnShell.pl" which is "my $result = ;". "$result" is supposed to receive a value from another end of the pipe but it receives nothing...The other end of pipe is in line 17 of file "Control.pm" which is " while (<>) { ". It is supposed to receive the input from line 744 of file "SearnShell.pl" and do some comparing works and then print "OK\n" . Unfortunately, " while (<>) " receives nothing...As a result the whole thing can not work rightly. So I guess the problem is " while (<>) " in line 17 of file "Control.pm" receives nothing . I don't konw why it happens and really hope you can get me out of this confusion sincerely, becky SearnShell_v0.1.rar Description: Binary data
Re: Named captures (was: **{x,y} quantifier)
On 7/1/07, Amir E. Aharoni <[EMAIL PROTECTED]> wrote: On 01/07/07, Luke Palmer <[EMAIL PROTECTED]> wrote: > / $ntimes := (\d+) x**{$ntimes} / The examples of := usage in S05 seem to have notation such as this: $ := (\d+) Yes, that is correct. I've been away from the Perl 6 community for quite some time... it seems that not only have I not kept up with the latest changes, but my brain is suffering bit rot. Human brains seem to have some sort of LRU garbage collector... Luke
Named captures (was: **{x,y} quantifier)
On 01/07/07, Luke Palmer <[EMAIL PROTECTED]> wrote: On 7/1/07, Amir E. Aharoni <[EMAIL PROTECTED]> wrote: > > > please correct me if > > > i say something stupid or if this has already been discussed before.) > > > Another important loss if we were to go with <1..3> would be the > > ability to have runtime-dependent ranges; e.g.: > > > > / ($ntimes) x**{$ntimes} / > > That's exactly what i meant by "something stupid". That's quite alright, because both interpretations of that sentence were valid :-). I meant: / $ntimes := (\d+) x**{$ntimes} / Luke Funny - how did it make sense to me the first time around? :) This prompted me to re-read the parts about Subpattern captures and Aliasing in S05, and i've got to say that it's *extreme* TMTOWTDI. I'm happy about it, 'cause i've been wishing for named captures for a long time, but i'm not sure that i understand it in your example completely. The examples of := usage in S05 seem to have notation such as this: $ := (\d+) Is $ntimes supposed to be a predefined scalar variable (my $ntimes)? Or a regex variable? I'm getting confused ...
Re: **{x,y} quantifier
On 7/1/07, Amir E. Aharoni <[EMAIL PROTECTED]> wrote: > > please correct me if > > i say something stupid or if this has already been discussed before.) > Another important loss if we were to go with <1..3> would be the > ability to have runtime-dependent ranges; e.g.: > > / ($ntimes) x**{$ntimes} / That's exactly what i meant by "something stupid". That's quite alright, because both interpretations of that sentence were valid :-). I meant: / $ntimes := (\d+) x**{$ntimes} / Luke
Re: **{x,y} quantifier
> please correct me if > i say something stupid or if this has already been discussed before.) Another important loss if we were to go with <1..3> would be the ability to have runtime-dependent ranges; e.g.: / ($ntimes) x**{$ntimes} / That's exactly what i meant by "something stupid". Thanks - my bad.
Re: **{x,y} quantifier
On 7/1/07, Amir E. Aharoni <[EMAIL PROTECTED]> wrote: I got the reply that it is similar to exponentiation of variables in math: a ** 5 == a * a * a * a * a == a It makes sense after it is explained and i do like the rationalization of the range as a list-like range, instead of the comma, but the ** syntax is rather ugly to my taste. Seeing that the ** quantifier is not yet implemented anyway, I thought what could replace it, and the best i could find was <1 .. 3>. My rationale is this: * It looks clean. * It the chapter about Extensible metasyntax (<...>) in S05 most paragraphs begin by "A leading X means yadda yadda", where X can be: * whitespace * alphabetic character (not alphanumeric!) * ? $ :: @ % { & [ + - . ! ~~ ... so numbers are not covered. * As a side effect, * is a shortcut for <0 .. Inf>, + is a shortcut for <1 .. Inf>, ? * is a shortcut for <0 .. 1>. * The ? of non-greediness can come before the closing > - <1 .. 3 ?> Your argument seems to be "<1..3> is cleaner-looking to me, and it is possible to implement". While that second constraint is always an important one, cleanliness is not the highest concern. There's more to beauty than what the eye can see. I believe that **{1..3} was at one point spelled <1,3>. The rather glaring inconsistency of that is that <>-constructions are always assertions, never modifiers. That is to say, in the rest of the regex design, whenever you see , it never depends on what comes before it. Another important loss if we were to go with <1..3> would be the ability to have runtime-dependent ranges; e.g.: / ($ntimes) x**{$ntimes} / You also lose the ** exponentiation mnemonic, which I found pretty on the inside :-). You also lose the *-like (because it really is just a special kind of *) mnemonic. I think the losses are too great to warrant such a change just for the purpose of visual appeal. Luke
**{x,y} quantifier
(I'm just studying the intricacies of Perl 6, so please correct me if i say something stupid or if this has already been discussed before.) I was looking for the Perl 6 equivalent of "aaa" =~ /a{1,3}/ and finally found that it's "aaa" ~~ /a**{1 .. 3}/ This looked rather weird, so i asked on IRC what is the mnemonic for it: http://moritz.faui2k3.org/irclog/out.pl?channel=perl6;date=2007-06-29#id_l602 I got the reply that it is similar to exponentiation of variables in math: a ** 5 == a * a * a * a * a == a It makes sense after it is explained and i do like the rationalization of the range as a list-like range, instead of the comma, but the ** syntax is rather ugly to my taste. Seeing that the ** quantifier is not yet implemented anyway, I thought what could replace it, and the best i could find was <1 .. 3>. My rationale is this: * It looks clean. * It the chapter about Extensible metasyntax (<...>) in S05 most paragraphs begin by "A leading X means yadda yadda", where X can be: * whitespace * alphabetic character (not alphanumeric!) * ? $ :: @ % { & [ + - . ! ~~ ... so numbers are not covered. * As a side effect, * is a shortcut for <0 .. Inf>, + is a shortcut for <1 .. Inf>, ? * is a shortcut for <0 .. 1>. * The ? of non-greediness can come before the closing > - <1 .. 3 ?> Any comments? -- Amir Elisha Aharoni my band: http://www.myspace.com/tzabari/ my blog: http://aharoni.wordpress.com/