IO::Socket::INET.open() broken? RT#83866
Hi all, I just downloaded and compiled rakudo/parrot, as in: ~/src/perl6/perl6-cache-memcached$ perl6 -v This is Rakudo Perl 6, version 2011.02-43-gbfdd78d built on parrot 3.1.0 RELEASE_3_1_0-700-gdb77547 Copyright 2008-2011, The Perl Foundation and I discovered that my LWP::Simple code doesn't work anymore, as in: $ cd perl6-lwp-simple $ cat t/socket-sanity.t use v6; use Test; plan 2; my $s = IO::Socket::INET.new; ok($s, 'Socket object created'); # Tried IP address too, doesn't work #my $opened = $s.open('72.14.176.61', 80); my $opened = $s.open('www.rakudo.org', 80); ok($opened, 'Socket to www.rakudo.org:80 opened'); if ! $opened { diag("Failed opening the socket: $opened"); } $ PERL6LIB=lib prove -e perl6 -v t/socket-sanity.t t/socket-sanity.t .. 1..2 ok 1 - Socket object created Can't connect closed socket in 'IO::Socket::INET::open' at line 5935:CORE.setting in main program body at line 10:t/socket-sanity.t Dubious, test returned 1 (wstat 256, 0x100) Failed 1/2 subtests Test Summary Report --- t/socket-sanity.t (Wstat: 256 Tests: 1 Failed: 0) Non-zero exit status: 1 Parse errors: Bad plan. You planned 2 tests but ran 1. Files=1, Tests=1, 1 wallclock secs ( 0.04 usr 0.00 sys + 0.86 cusr 0.09 csys = 0.99 CPU) Result: FAIL Of course I can telnet to www.rakudo.org:80 just fine. I tried to figure out what's happening, but I'm not really sure. I replied to #83866 that seems to be about a similar (but not the same) problem: http://rt.perl.org/rt3/Ticket/Display.html?id=83866 So, what happened to IO::Socket::INET? -- Cosimo
Re: How to write this "properly" in Perl 6?
In data 27 mai 2009 alle ore 23:46:40, John M. Dlugosz <2nb81l...@sneakemail.com> ha scritto: Anything in the existing implementation that's hostile to Perl 6? Just port it over by lightly editing the text or using a p5 module importer. Yes, right, but that wouldn't use Perl 6 features. To write from scratch, I suppose it's just a recursive function that talks and drinks beer. About the beer drinking, that's one of the main points :) I think the interesting part is when you want to see it from the "real-world game" point of view, so in this case, writing a function that returns the next correct word. In the Perl 5 solution, I wrote a function that allows you to do this: # Up to any number of "repeats" my $iter = bon_digi_sequence(5); while (my $word = $iter->()) { print $word, ' '; } I'm not saying it's difficult, of course. To me it's interesting to know from others (because I don't know) how would you go writing this function with the weapons Perl 6 gives you. -- Cosimo
Re: How to write this "properly" in Perl 6?
In data 28 mai 2009 alle ore 00:13:19, Mark J. Reed ha scritto: You can write a sub to return the next step: sub bondigi { state $n=1; return (, xx $n, xx $n++); } Nahh. That's too easy... It's not fun :-) but I think an idiomatic Perl 6 solution would have a proper lazy Iterator. Yes, that's more interesting. -- Cosimo
How to write this "properly" in Perl 6?
Hi cool people, the "Amazing Perl 6" thread was amazing. It reminded me how Perl 6 looks interesting and fun. So... how can I write "properly", for some meaning of properly, the Perl 6 equivalent of this: http://search.cpan.org/dist/Games-BonDigi/ ? ( if it's not clear, you can run the example http://cpansearch.perl.org/src/COSIMO/Games-BonDigi-0.02/examples/generate_bondigi.pl ) -- Cosimo
S29 doubts that need clarification
Hi all, I'm in the process of refactoring existing pugs test suite, for example t/builtins, into t/spec/S29-. Questions: - @array.uniq is not mentioned in S29. Should it be in S29/List? or S29/Array? - cis(), polar() and friends belong to S29/Num while they should probably belong to S29/Complex? Thanks! -- Cosimo