Any Perl expert ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CHMOD
    Confirmed User
    • Jun 2003
    • 1697

    #1

    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 !
    Sell our Silicone Dolls and make big money!

    Our website:
    https://www.sexdolls-shop.com/

    Signup:
    http://www.sexdollscash.com/sliiing/registration.php

    Contact:
    [email protected]
  • swedguy
    Confirmed User
    • Jan 2002
    • 7981

    #2
    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.

    Comment

    • CHMOD
      Confirmed User
      • Jun 2003
      • 1697

      #3
      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.
      Sell our Silicone Dolls and make big money!

      Our website:
      https://www.sexdolls-shop.com/

      Signup:
      http://www.sexdollscash.com/sliiing/registration.php

      Contact:
      [email protected]

      Comment

      • Harrison Richard
        Confirmed User
        • Oct 2005
        • 199

        #4
        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.
        i sale executive summaries of threads

        Comment

        • Harrison Richard
          Confirmed User
          • Oct 2005
          • 199

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

          just do

          print $k->header();
          i sale executive summaries of threads

          Comment

          • FuqALot
            Confirmed User
            • Dec 2001
            • 3817

            #6
            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;

            Comment

            • FuqALot
              Confirmed User
              • Dec 2001
              • 3817

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

              Comment

              • CHMOD
                Confirmed User
                • Jun 2003
                • 1697

                #8
                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...
                Sell our Silicone Dolls and make big money!

                Our website:
                https://www.sexdolls-shop.com/

                Signup:
                http://www.sexdollscash.com/sliiing/registration.php

                Contact:
                [email protected]

                Comment

                • FuqALot
                  Confirmed User
                  • Dec 2001
                  • 3817

                  #9
                  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).

                  Comment

                  • salsbury
                    Confirmed User
                    • Feb 2002
                    • 1070

                    #10
                    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.
                    Last edited by salsbury; 02-17-2006, 12:00 PM.

                    Comment

                    • mikeyddddd
                      Viva la vulva!
                      • Mar 2003
                      • 16557

                      #11
                      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.

                      Comment

                      • Babaganoosh
                        ♥♥♥ Likes Hugs ♥♥♥
                        • Nov 2001
                        • 15841

                        #12
                        chmod 0755?
                        I like pie.

                        Comment

                        • CHMOD
                          Confirmed User
                          • Jun 2003
                          • 1697

                          #13
                          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.
                          Last edited by CHMOD; 02-17-2006, 12:43 PM.
                          Sell our Silicone Dolls and make big money!

                          Our website:
                          https://www.sexdolls-shop.com/

                          Signup:
                          http://www.sexdollscash.com/sliiing/registration.php

                          Contact:
                          [email protected]

                          Comment

                          • toddler
                            Confirmed User
                            • Jun 2002
                            • 1911

                            #14
                            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.
                            http://www.flickr.com/photos/zoddler/

                            Comment

                            • CHMOD
                              Confirmed User
                              • Jun 2003
                              • 1697

                              #15
                              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 !
                              Sell our Silicone Dolls and make big money!

                              Our website:
                              https://www.sexdolls-shop.com/

                              Signup:
                              http://www.sexdollscash.com/sliiing/registration.php

                              Contact:
                              [email protected]

                              Comment

                              • FuqALot
                                Confirmed User
                                • Dec 2001
                                • 3817

                                #16
                                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?

                                Comment

                                • split_joel
                                  Confirmed User
                                  • Jan 2005
                                  • 2270

                                  #17
                                  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.
                                  E-mail marketing - Automation Scripting - IP Space
                                  AIM: splitjoelp ICQ: 254759453 skype - splitjoelp 702-941-6465

                                  Comment

                                  • teksonline
                                    So Fucking Banned
                                    • Jan 2005
                                    • 2904

                                    #18
                                    I can resolve this problem for you

                                    icq 48721721

                                    Comment

                                    • Luc
                                      Confirmed User
                                      • Nov 2002
                                      • 1130

                                      #19
                                      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
                                      » Looking for Type-in domais? Page Rank domains? Alexa domains? Popular domains?
                                      » Domain Research Tool can scan hundreds of thousands of domains to find whatever you're looking for.
                                      » Auto-appraise domains and send automated domain offers in bulk with just one click.
                                      » Full support for Proxy Servers and International Overture. Try it Free.

                                      Comment

                                      • teksonline
                                        So Fucking Banned
                                        • Jan 2005
                                        • 2904

                                        #20
                                        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

                                        Comment

                                        • fuzebox
                                          making it rain
                                          • Oct 2003
                                          • 22365

                                          #21
                                          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.

                                          Comment

                                          • CHMOD
                                            Confirmed User
                                            • Jun 2003
                                            • 1697

                                            #22
                                            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...
                                            Last edited by CHMOD; 02-21-2006, 12:58 PM.
                                            Sell our Silicone Dolls and make big money!

                                            Our website:
                                            https://www.sexdolls-shop.com/

                                            Signup:
                                            http://www.sexdollscash.com/sliiing/registration.php

                                            Contact:
                                            [email protected]

                                            Comment

                                            • CHMOD
                                              Confirmed User
                                              • Jun 2003
                                              • 1697

                                              #23
                                              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.
                                              Sell our Silicone Dolls and make big money!

                                              Our website:
                                              https://www.sexdolls-shop.com/

                                              Signup:
                                              http://www.sexdollscash.com/sliiing/registration.php

                                              Contact:
                                              [email protected]

                                              Comment

                                              • drjones
                                                Confirmed User
                                                • Oct 2005
                                                • 908

                                                #24
                                                Is perl working at all on that host? Just make sure by creating a real simple 'hello world' cgi script first..
                                                Last edited by drjones; 02-21-2006, 01:08 PM.
                                                ICQ: 284903372

                                                Comment

                                                • drjones
                                                  Confirmed User
                                                  • Oct 2005
                                                  • 908

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

                                                  Comment

                                                  • CHMOD
                                                    Confirmed User
                                                    • Jun 2003
                                                    • 1697

                                                    #26
                                                    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 !


                                                    I have like dozens of scripts working.
                                                    Sell our Silicone Dolls and make big money!

                                                    Our website:
                                                    https://www.sexdolls-shop.com/

                                                    Signup:
                                                    http://www.sexdollscash.com/sliiing/registration.php

                                                    Contact:
                                                    [email protected]

                                                    Comment

                                                    • CHMOD
                                                      Confirmed User
                                                      • Jun 2003
                                                      • 1697

                                                      #27
                                                      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;

                                                      ################################
                                                      Sell our Silicone Dolls and make big money!

                                                      Our website:
                                                      https://www.sexdolls-shop.com/

                                                      Signup:
                                                      http://www.sexdollscash.com/sliiing/registration.php

                                                      Contact:
                                                      [email protected]

                                                      Comment

                                                      • drjones
                                                        Confirmed User
                                                        • Oct 2005
                                                        • 908

                                                        #28
                                                        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;
                                                        ICQ: 284903372

                                                        Comment

                                                        • CHMOD
                                                          Confirmed User
                                                          • Jun 2003
                                                          • 1697

                                                          #29
                                                          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...
                                                          Sell our Silicone Dolls and make big money!

                                                          Our website:
                                                          https://www.sexdolls-shop.com/

                                                          Signup:
                                                          http://www.sexdollscash.com/sliiing/registration.php

                                                          Contact:
                                                          [email protected]

                                                          Comment

                                                          • FuqALot
                                                            Confirmed User
                                                            • Dec 2001
                                                            • 3817

                                                            #30
                                                            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.

                                                            Comment

                                                            • V_RocKs
                                                              Damn Right I Kiss Ass!
                                                              • Nov 2003
                                                              • 32451

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

                                                              Comment

                                                              • FuqALot
                                                                Confirmed User
                                                                • Dec 2001
                                                                • 3817

                                                                #32
                                                                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.

                                                                Comment

                                                                • mikeet
                                                                  this & that
                                                                  • May 2005
                                                                  • 5365

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

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

                                                                  Comment

                                                                  • woj
                                                                    <&(©¿©)&>
                                                                    • Jul 2002
                                                                    • 47880

                                                                    #34
                                                                    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...
                                                                    Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
                                                                    Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
                                                                    Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

                                                                    Comment

                                                                    • toddler
                                                                      Confirmed User
                                                                      • Jun 2002
                                                                      • 1911

                                                                      #35
                                                                      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?
                                                                      http://www.flickr.com/photos/zoddler/

                                                                      Comment

                                                                      Working...