[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Perlscript
. . -> [Subject]  Perl Socket Minibrowser

Perl Socket Minibrowser

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by MattMc   USA  (54 posts)  [Biography] bio
Date Tue 29 Jun 2004 12:42 PM (UTC)

Amended on Tue 29 Jun 2004 03:52 PM (UTC) by MattMc

Message
Howdy,

Below is a script I'm trying to get to work, but can't seem to figure it out. I admit my native language is php, then vbasic, and then a few other things before I get to perl so I'm really nieve on this language. Below is just the script, not the xml because I do know that much so I won't waste your time by making you flip through there.

I had a friend get this for me, so it may just not be mushclient compatable in its currently writen form. If someone can help me by pointing out the errors on it, or if you have the time to rewrite it that would also be cool, but I just need some guidence.

The object of the script is to seek a website, and return in the @output array the contents of the page. This is used to interface my computer to a php script on a different server so I can post data there, and then return errors or status reports on that post.


see below
[Go to top] top

Posted by MattMc   USA  (54 posts)  [Biography] bio
Date Reply #1 on Tue 29 Jun 2004 03:51 PM (UTC)

Amended on Tue 29 Jun 2004 05:21 PM (UTC) by MattMc

Message
Now that I'm awake... Here's the full file because it actually would help you to see it all after I made some fixes that were pretty obvious. Plus I've included the error I get.


see below
[Go to top] top

Posted by MattMc   USA  (54 posts)  [Biography] bio
Date Reply #2 on Tue 29 Jun 2004 05:23 PM (UTC)
Message

<script>
<![CDATA[
sub GetHTTP {
  my ($thename, $theoutput, $wildcards) = @_;
  my ($remote, $doc, $port, $iaddr, $paddr, $proto, $line,@output);
  $remote = $world->GetTriggerInfo ($thename,101);
  $doc = $world->GetTriggerInfo ($thename,102);
  $port = 80;
  $sockaddr = 'S n a4 x8';
  if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') }
  die "No port" unless $port;
  $thisaddr   = gethostbyname("localhost");
  $thataddr   = gethostbyname($remote);
  $this   = pack($sockaddr, AF_INET, 0, $thisaddr);
  $that   = pack($sockaddr, AF_INET, $port, $thataddr);

  $proto   = getprotobyname('tcp');
  socket(SOCK, PF_INET, SOCK_STREAM, $proto)  || die "socket: $!";
  bind(SOCK, $this)    || die "bind: $!";
  connect(SOCK, $that)    || die "connect: $!";
  select(SOCK); $| = 1; select(STDOUT);

do { $line = <SOCK> } until ($line =~ /^\r\n/); 
   @output = <SOCK>; 
   close (SOCK) || die "close: $!";
}
]]>
</script>

Poco y poco I'm making my way through, but I think I'm seriously stuck this time :D The bind function isn't recognized.

Error number: -2147467259
Event: Execution of line 1 column 0
Description: bind: Unknown error at (eval 2) line 17.

Called by: Function/Sub: GetHTTP called by trigger
Reason: processing trigger "gethttptrig"
[Go to top] top

Posted by MattMc   USA  (54 posts)  [Biography] bio
Date Reply #3 on Tue 29 Jun 2004 06:07 PM (UTC)

Amended on Tue 29 Jun 2004 06:10 PM (UTC) by MattMc

Message
Upgraded ActivePerl and same errors.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #4 on Wed 30 Jun 2004 03:05 AM (UTC)
Message
If I were to hazard a complete guess on this, it would be that the perl scripting engine can't handle networking. Sorry that I can't help you more than that.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,728 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]