GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Any Perl expert ? (https://gfy.com/showthread.php?t=577102)

CHMOD 02-17-2006 10:16 AM

Any Perl expert ?
 
I am running a script and I get an internal server error.
No diagnostic.

I know only very little of Perl language. I can't find out what the problem is here.

Anyone can tell me what is wrong with this script?

###########################################

#!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);
use diagnostics;
use CGI;
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;

$q = CGI->new();
$ua = LWP::UserAgent->new();

$req = POST 'http://maxmind.com:8010/b',
[
l => "hgfjgfdhhh",
i => "69.70.92.38",
];


$k = new CGI($res->content());

$region = $k->param( region );
$city = $k->param( city );
$country = $k->param( country );

print "Content-type: text/html\n\n";
print "$region\n";
exit;

######################################

Thanks !

swedguy 02-17-2006 10:31 AM

i => "69.70.92.38",

Should not be a comma after the last one. That's the only thing I see right now. If that doesn't work, check the message in Apache's error log.

CHMOD 02-17-2006 01:00 PM

Quote:

Originally Posted by swedguy
i => "69.70.92.38",

Should not be a comma after the last one. That's the only thing I see right now. If that doesn't work, check the message in Apache's error log.

Thanks !

I corrected this misstake but it still doesn't work.

I just asked webair to let me see my Apache's error log.

Harrison Richard 02-17-2006 01:03 PM

Quote:

Originally Posted by swedguy
i => "69.70.92.38",

Should not be a comma after the last one. That's the only thing I see right now. If that doesn't work, check the message in Apache's error log.


CGI::Carp qw/fatalsToBrowser/ would catch this.

OP is correct to check apache logs.

Harrison Richard 02-17-2006 01:04 PM

BTW, dude, don't print "Content-type....."

just do

print $k->header();

FuqALot 02-17-2006 01:37 PM

try this

Code:

#!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);
use CGI;
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;

$q = CGI->new();
$ua = LWP::UserAgent->new();

$req = POST 'http://maxmind.com:8010/b',
[l => "hgfjgfdhhh", i => "69.70.92.38" ];

$k = new CGI($ua->request($req)->content);

$region = $k->param( "region" );
$city = $k->param( "city" );
$country = $k->param( "country" );

print "Content-type: text/html\n\n";
print "$region\n";
exit;


FuqALot 02-17-2006 01:39 PM

I doubt the "new cgi()" is any good though.

CHMOD 02-17-2006 01:49 PM

Quote:

Originally Posted by FuqALot
try this

Code:

#!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);
use CGI;
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;

$q = CGI->new();
$ua = LWP::UserAgent->new();

$req = POST 'http://maxmind.com:8010/b',
[l => "hgfjgfdhhh", i => "69.70.92.38" ];

$k = new CGI($ua->request($req)->content);

$region = $k->param( "region" );
$city = $k->param( "city" );
$country = $k->param( "country" );

print "Content-type: text/html\n\n";
print "$region\n";
exit;


Hi !

Thanks for your help.

I just tried the exact code here and it still doesn't work.
I still get an internal server error message.

I don't understand why " use CGI::Carp qw(fatalsToBrowser); " doesn't show anything to help...

FuqALot 02-17-2006 01:52 PM

If I run my version here I don't get an error.
Do you have the loaded perl modules installed?

These are not standard modules on webair I believe.

Hit up webair tech live and tell 'em to install these three:
(LWP::UserAgent, HTTP::Request::Common and CGI).

salsbury 02-17-2006 01:58 PM

you should find the error messages in the server's error log file. check out, or find out, where the server or virtualhost's ErrorLog directive is pointed to (i'm assuming you're using Apache).

adding 'use strict' near the top and using 'perl -wc file.cgi' from the command line may also give you some hints.

mikeyddddd 02-17-2006 02:21 PM

The first thing I check is to see if the Perl path is correct and if the script was uploaded as ASCII or binary. That's where I usually screw up.

Babaganoosh 02-17-2006 02:22 PM

chmod 0755?

CHMOD 02-17-2006 02:42 PM

Thanks all for your help.

Yes, Perl path is correct, my files are uploaded as ASCII and were CHMOD 755

- FuqALot : I asked a webair tech to make sure HTTP::Request::Common is installed. I am waiting for his answer. The 2 other Perl models are installed for sure.

- salsbury : I am waiting on Webair to have access to my Apache error log file.

toddler 02-17-2006 02:42 PM

perl -e 'use HTTP::Request;'

do the rest of them as well. if it returns 0, you're module is installed. If it bitches, its not.

CHMOD 02-20-2006 12:52 PM

I finally got access to my error log file.
Here is the error massage I get when I try to run the script:

[Mon Feb 20 14:48:23 2006] [error] [client 556.200.545.202] File does not exist: /www/virtual/jonjovi/www.domain.com/public_html/favicon.ico

I don't know what it means at all !

FuqALot 02-20-2006 01:27 PM

That only means that when a browser tries to visit your site, there isn't an icon available (an icon that you would see next to the address in the browser window) - I doubt that's the reason why your perl program isn't doing anything.

What *are* you trying to do? What do you want the perl program to do?

split_joel 02-20-2006 01:44 PM

Quote:

Originally Posted by CHMOD
I finally got access to my error log file.
Here is the error massage I get when I try to run the script:

[Mon Feb 20 14:48:23 2006] [error] [client 556.200.545.202] File does not exist: /www/virtual/jonjovi/www.domain.com/public_html/favicon.ico

I don't know what it means at all !


My guess would be that the server your using at webair does not have the correct moduals loaded because when i tried the revised script posted by the other gfy member it worked fine for me.

teksonline 02-20-2006 02:00 PM

I can resolve this problem for you

icq 48721721

Luc 02-20-2006 02:05 PM

make sure the file is saved in UNIX text mode not DOS text mode. the line breaks are different, so you'll get an error for the next 5 lifetimes.

if you made this in notepad or other such program then it will never work because the line breaks are bad. just download and install Crimson Editor (it's a free code editor), open your script in there, goto Document->File Format->Unix and then save and upload it. Crimson even has an upload feature but just your regular FTP.

good luck

teksonline 02-20-2006 02:07 PM

that's not the problem, however if you have not got a response yet, you should find professional hosting, try http://www.ehosts.org
where the owners are programmers, so you don' t have these problems

fuzebox 02-20-2006 02:21 PM

I believe webair uses FreeBSD and perl is installed under /usr/local/bin/perl ... It's been a while since I had a webair account though so I could be wrong.

CHMOD 02-21-2006 02:57 PM

Quote:

Originally Posted by FuqALot
That only means that when a browser tries to visit your site, there isn't an icon available (an icon that you would see next to the address in the browser window) - I doubt that's the reason why your perl program isn't doing anything.

What *are* you trying to do? What do you want the perl program to do?


I need a script that can return me the region of an given IP address.
I send the IP and I should get these parameters back:

$region = $k->param( "region" );
$city = $k->param( "city" );
$country = $k->param( "country" );

and print them on my screen... Of course, if this works.. I will integrate it in my payment system.

I am trying to use Maxmind.com's service. Their customer service has been bad until now.
I wrote 5 Emails, got 5 answers but it looks like they don't read my Emails and keep asking me the same questions : What error messages, Wich version of our script are you running ? Gee... Just read my god damn Emails and you have all the informations !

I haven't found another company wich offers the same service until now or I would have switched long ago !

I just got a webair tech checking all my Perl modules needed to run the script and they are all there and up to date.

Damn ! I only get "Internal error messages " I don't even get errors in my Apache log file and the command : use CGI::Carp qw(fatalsToBrowser); doesn't work.

I don't know what to do. I don't have a clue on what to do and I have been working on this for 48 hours now. I am getting frustrated...

CHMOD 02-21-2006 03:05 PM

ok.. I finally got some error messages on my screen.

Here you are :

I have 10 lines like this one with different Global symbol errors :

Global symbol "$q" requires explicit package name at /www/virtual/jonjovi/www.domain.com/cgi-bin/example2.pl line 9.

drjones 02-21-2006 03:07 PM

Is perl working at all on that host? Just make sure by creating a real simple 'hello world' cgi script first..

drjones 02-21-2006 03:10 PM

and you really really really should turn on 'use strict;' and initialize all your variables with the my() function...

CHMOD 02-21-2006 03:11 PM

Quote:

Originally Posted by drjones
Is perl working at all on that host? Just make sure by creating a real simple 'hello world' cgi script first..


Of course ! :winkwink:


I have like dozens of scripts working.

CHMOD 02-21-2006 03:13 PM

Quote:

Originally Posted by drjones
and you really really really should turn on 'use strict;' and initialize all your variables with the my() function...

I did.
here is the new script :

#############################

#!/usr/bin/perl -wT
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use diagnostics;
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;

$q = CGI->new();
$ua = LWP::UserAgent->new();

$req = POST 'http://maxmind.com:8010/b',
[l => "hgfdgghhh", i => "69.70.92.38" ];

$k = new CGI($ua->request($req)->content);

$region = $k->param( "region" );
$city = $k->param( "city" );
$country = $k->param( "country" );

print "Content-type: text/html\n\n";
print "$region\n";
exit;

################################

drjones 02-21-2006 03:15 PM

Should be:


#############################

#!/usr/bin/perl -wT
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use diagnostics;
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;

my $q = CGI->new();
my $ua = LWP::UserAgent->new();

my $req = POST 'http://maxmind.com:8010/b',
[l => "hgfdgghhh", i => "69.70.92.38" ];

my $k = new CGI($ua->request($req)->content);

my $region = $k->param( "region" );
my $city = $k->param( "city" );
my $country = $k->param( "country" );

print "Content-type: text/html\n\n";
print "$region\n";
exit;

CHMOD 02-21-2006 04:21 PM

Quote:

Originally Posted by drjones
Should be:


#############################

#!/usr/bin/perl -wT
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use diagnostics;
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;

my $q = CGI->new();
my $ua = LWP::UserAgent->new();

my $req = POST 'http://maxmind.com:8010/b',
[l => "hgfdgghhh", i => "69.70.92.38" ];

my $k = new CGI($ua->request($req)->content);

my $region = $k->param( "region" );
my $city = $k->param( "city" );
my $country = $k->param( "country" );

print "Content-type: text/html\n\n";
print "$region\n";
exit;


Internal server error... :(

FuqALot 02-21-2006 04:27 PM

If you want you could give me a username and password to your ssh and server. I will try to fix it then. You may trust me.

Does it somewhere on maxmind say what your perl program needs to do, what parameters it has to pass and receive? If so, I could get you something going in minutes - free.

V_RocKs 02-21-2006 05:21 PM

FuqALot helped me before with similar shit... Good guy.

FuqALot 02-21-2006 05:24 PM

Quote:

Originally Posted by V_RocKs
FuqALot helped me before with similar shit... Good guy.

I did? Hah it's been years I did something for people other than myself (for money), so I guess it was a freebie? Don't remember. - Anyway I would've done this for free too.

mikeet 02-21-2006 05:37 PM

Not sure if this will work, but try using:
#!/usr/local/bin/perl -wT

instead of:
#!/usr/bin/perl -wT

woj 02-21-2006 06:15 PM

it's been 3 days, and you are still looking for someone to fix the problem? Offer a few bucks, and i'm sure someone will hook it up in no time...

toddler 02-21-2006 06:27 PM

A: sounds to me like you turned on strict and don't know what it means, and B: did you try the perl -e trick above to make sure you modules are installed?


All times are GMT -7. The time now is 03:33 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123