[ic] Calling a PERL function using a custom defined Globalsub
Fred Pope
interchange-users@interchange.redhat.com
Wed Jan 2 12:59:00 2002
> We are trying to do a custom subroutine that performs an HTTP post to
> another server.
>
> In our Globalsub we created a new routine called posttoserver which is the
> starting point for our work, however, we cannot get this simple
> function to
> work within Interchange:
>
> Here is an example:
>
> ********
> LINE# ACTUAL TEXT
>
> 1 GlobalSub <<EOF
> 2 sub posttoserver {
> 3
> 4 use strict;
> 5 use sigtrap;
> 6 use IO::Socket::INET;
> 7
> 8 my $result = IO::Socket::INET->new("www.fredpope.com:80");
> 9 print $result "GET \r\n";
> 10 my @out=<$result>;
> 11
> 12 close ($result);
> 13
> 14 print("Content-Type: text/html\n\n");
> 15 print ("@out");
> 16 }
> 17 EOF
>
> ********
>
> If I remove a line at the top and at the bottom, this runs predictably, as
> filename.pl in the cgi-bin directory but when I call it from interchange,
> nothing happens. Here is how I am calling it:
>
> [perl subs=yes]posttoserver[/perl]
"Is the global sub actual trying to run? "
Yes, if you replace the code (lines 2-15) with a simple return "something
goes here";
You get what ever you place in the quotes.
So in other words the globalsub is being used however when we try to use the
IO::Socket::INET module, it is not working.