Connecting Tech Pros Worldwide Help | Site Map

WebCalendar - LWP Connection refused

Newbie
 
Join Date: Aug 2007
Posts: 5
#1: Aug 6 '07
Hi folks,

I'm having problems running a perl script that uses LWP.

I'm trying to run webcal_cmd.pl which is part of WebCalendar by http://www.ma.utexas.edu/webcalendar/

When I run the script I get the reply "connection refused".

Why? Who refused it?

Any ideas?

Regards,
Andrew
Newbie
 
Join Date: Aug 2007
Posts: 5
#2: Aug 6 '07

re: WebCalendar - LWP Connection refused


Here's part of the script:

Expand|Select|Wrap|Line Numbers
  1. my $ua = LWP::UserAgent->new;
  2. my $request = POST($calendar_server,
  3.     Content_Type => 'form-data',
  4.     Content => $postcontent,
  5. );
  6. my $response = $ua->request($request);
  7.  
  8. die $response->message unless $response->is_success;
  9.  
miller's Avatar
Moderator
 
Join Date: Oct 2006
Location: San Francisco, CA
Posts: 830
#3: Aug 7 '07

re: WebCalendar - LWP Connection refused


Quote:

Originally Posted by rekabuk

Why? Who refused it?

The web url defined is $calendar_server. Who that is, no idea.

This problem is not relevant to this forum. If you're having trouble getting this software to work, I suggest that you consult the FAQ or UserGuide provided by this service.

- Miller
Newbie
 
Join Date: Aug 2007
Posts: 5
#4: Aug 7 '07

re: WebCalendar - LWP Connection refused


Quote:

Originally Posted by miller

This problem is not relevant to this forum.
- Miller

Why not? Isn't this a perl forum? The application (WebCalendar) is written in perl. There's no active forum for the application and I have spent many days searching the web for an answer.

If I type the contents of $calendar_server directly into a browser, I get a different error to when I use LWP. What stops LWP doing a POST? Has my web hoster disabled something I need?

Hope this is relevent....


Andrew
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#5: Aug 7 '07

re: WebCalendar - LWP Connection refused


The application is perl, and this is a perl forum, but why the connection is refused is not a perl issue unless you are making some error in the perl code.
Is $calendar_server a secret? If we could see what you are trying to connect to it might help. You say you get an error, what is the errror? Don't make it difficult to help you, supply all the information, the url you are trying to connect to, the exact error messages you are getting, etc etc etc.

LWP is not core module and some hosts do not have it installed.
Newbie
 
Join Date: Aug 2007
Posts: 5
#6: Aug 7 '07

re: WebCalendar - LWP Connection refused


Thanks kevin, some fair points there.


Here's the link that fails...
http://westcan.co.uk/members/calendar/mycal.pl

And here's the script, as you can see I've tried a lot of different options.....

================================================== ==
#!/usr/bin/perl
#

# open(PS_F, "ps -f|");
# $tmp=<PS_F>;
# print $tmp;
# close(PS_F);

#$tmp = `/home/sites/westcan.co.uk/public_html/members/calendar/webcal_cmd.pl -s http:://www.westcan.co.uk/members/calendar/webcal_cmd_server.pl -u westcan -p admin -c get -t appointment`;
#$tmp = eval(`webcal_cmd.pl -s http:://www.westcan.co.uk/members/calendar/webcal_cmd_server.pl -u westcan -p admin -c get -t appointment -startdate 07/25/07`);
#$tmp = `./webcal_cmd.pl -s ./webcal_cmd_server.pl -u westcan -p admin -c get -t appointment -startdate 07/25/07`;
#$tmp = eval(`date`);
#$tmp = `date`;
$tmp2 = `date`;
# $tmp = `./mytest.pl`;
# $tmp = `./webcal_cmd.pl`;


print "Content-Type: text/html\n\n";

# $tmp = eval('/home/sites/westcan.co.uk/public_html/members/calendar/webcal_cmd.pl -server http://www.westcan.co.uk/members/calendar/webcal_cmd_server.pl -username westcan -password admin -command get -t appointment');
# $tmp = `/home/sites/westcan.co.uk/public_html/members/calendar/webcal_cmd.pl -server http://www.westcan.co.uk/members/calendar/webcal_cmd_server.pl -help`;
# $tmp = `webcal_cmd.pl -server http://www.westcan.co.uk/members/calendar/webcal_cmd_server.pl -help`;
# $tmp = `./webcal_cmd.pl 2>&1`;
# $tmp = eval(`/home/sites/westcan.co.uk/public_html/members/calendar/webcal_cmd.pl -server http://www.westcan.co.uk/members/calendar/webcal_cmd_server.pl -username westcan -password admin -command get -type event`);
$tmp = `./webcal_cmd.pl -username westcan -password admin -command get -type event 2>&1`;
# $tmp = `./mytest.pl 2>&1`;
# print $tmp;

if ($@) # $@ contains the exception that was thrown
{
print $@;
}
print "-";
print $tmp;
print "-<br>";
print $tmp2;
================================================== ==

mycal.pl calls webcal_cmd.pl and the bit in webcal_cmd.pl that fails is:

#---------------------------------------------------------------------------------------------
# Now post the form
#
my $ua = LWP::UserAgent->new;
my $request = POST( $calendar_server,
Content_Type => 'form-data',
Content => $postcontent,
);
my $response = $ua->request($request);

die $response->message unless $response->is_success;
#-----------------------------------------------------------------------------------------------

Where $calendar_server is

my $calendar_server = "http://www.westcan.co.uk/members/calendar/webcal_cmd_server.pl";

does that help?

Regards
Andrew
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,569
#7: Aug 7 '07

re: WebCalendar - LWP Connection refused


I don't know if it is relevant to the issue, but when I plug that URL into my browser and hit enter, this is the error that I get back from the server:

-Use of uninitialized value in concatenation (.) or string at ./webcal_cmd.pl line 52. Can't connect to www.westcan.co.uk:80 (connect: Connection refused) at ./webcal_cmd.pl line 202. -
Tue Aug 7 14:30:42 BST 2007

Just from that error, I would agree with Miller that this isn't really a Perl issue, but more of an issue with the server/host.

Regards,

Jeff
Newbie
 
Join Date: Aug 2007
Posts: 5
#8: Aug 7 '07

re: WebCalendar - LWP Connection refused


OK, would someone be kind enough to point me at a forum where I might get some help on this one?

Thanks,
Andrew
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,569
#9: Aug 7 '07

re: WebCalendar - LWP Connection refused


Well, you will want to check both the webserver configuration and the firewall config, depending on which is not letting you connect. Since we do not know what those products are, then I would find out and then look in the appropriate forum.

Regards,

Jeff
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#10: Aug 8 '07

re: WebCalendar - LWP Connection refused


this is what I got when accessing the URL:

==_begin_response_status==
ERROR
==_end_response_status==
==_begin_response_message==
There is an error processing your request.
===Missing username or password, cannot authenticate.====;

==_end_response_message==

so it looks like the script is working but needs the name and password to run the program.
Reply