Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Works again now, with rakudo r47428 \o/

- Removed IO::Socket classes, since now they are
  in core rakudo libraries, and they were thus conflicting
- Started using ufo
  • Loading branch information...
commit 6851c143ed1fbf48e10067f65ad75271e89ebc3d 1 parent a9a958f
@cosimo authored
Showing with 11 additions and 80 deletions.
  1. +2 −0  .gitignore
  2. +8 −1 README
  3. +0 −78 lib/IO/Socket.pm
  4. +1 −1  lib/LWP/Simple.pm
View
2  .gitignore
@@ -0,0 +1,2 @@
+Makefile
+*.pir
View
9 README
@@ -1,7 +1,14 @@
Perl6 LWP::Simple
------------------
+=================
http://github.com/cosimo/perl6-lwp-simple/
This is a quick & dirty implementation
of a LWP::Simple clone for Rakudo Perl 6
+
+
+Current status
+==============
+
+As of 2010-06-10, runs with rakudo based on parrot r47428
+
View
78 lib/IO/Socket.pm
@@ -1,78 +0,0 @@
-#!/usr/bin/perl6
-#
-# -----------------------------------------------
-# THIS IMPLEMENTATION IS SUPERSEDED BY RAKUDO'S
-# CURRENT IO::Socket + IO::Socket::INET
-#
-# PLEASE IGNORE
-# -----------------------------------------------
-#
-
-class IO::Socket {
-
- has $!PIO;
-
- method open (Str $hostname, Int $port) {
-
- Q:PIR {
- .include "socket.pasm"
- .local pmc sock
- .local pmc address
- .local string hostname
- .local int port
- .local string buf
- .local int ret
-
- $P0 = find_lex "$hostname"
- hostname = $P0
-
- $P0 = find_lex "$port"
- port = $P0
-
- # Create the socket handle
- sock = new 'Socket'
- unless sock goto ERR
- sock.'socket'(.PIO_PF_INET, .PIO_SOCK_STREAM, .PIO_PROTO_TCP)
-
- # Pack a sockaddr_in structure with IP and port
- address = sock.'sockaddr'(hostname, port)
- sock.'connect'(address)
- setattribute self, '$!PIO', sock
- ERR:
- .return (0)
- }
- }
-
- method recv () {
- fail('Socket not available') unless $!PIO;
- my $received = $!PIO.recv();
- my $len = $received.chars;
- my $buf;
- while $len > 0 {
- $buf = $!PIO.recv();
- $received ~= $buf;
- $len = $buf.chars;
- }
- return $received;
- }
-
- method send (Str $string) {
- fail("Not connected") unless $!PIO;
- return $!PIO.send($string);
- }
-
- method close () {
- fail("Not connected!") unless $!PIO;
- return $!PIO.close();
- }
-
-}
-
-#my $s = IO::Socket.new;
-#
-#$s.open('www.google.com', 80);
-#$s.send("GET /\r\n");
-#my $stream = $s.recv();
-#print $stream;
-#$s.close();
-
View
2  lib/LWP/Simple.pm
@@ -4,7 +4,7 @@
# LWP::Simple for Perl 6
# ----------------------
-use IO::Socket::INET;
+#use IO::Socket::INET;
class LWP::Simple {
Please sign in to comment.
Something went wrong with that request. Please try again.