in reply to Prototype mismatch

I encountered two problems: missing dependencies and proper use of load.pm. I fixed the dependencies with this:
#!/usr/bin/perl use strict; use warnings; use CPAN; CPAN::Shell->install(qw( load Thread::Serialize Thread::Tie Thread::Conveyor Thread::Conveyor::Monitored Thread::Queue XML::NamespaceSupport XML::SAX::Base XML::SAX XML::SAX::Expat XML::LibXML::SAX XML::Simple WWW::RobotRules HTML::Tagset HTML::Parser HTTP::Date Encode::Locale LWP::UserAgent LWP::MediaTypes HTTP::Headers HTTP::Headers::Util HTTP::Status HTTP::Daemon Net::HTTP URI HTTP::Negotiate File::Listing));
This fixed the ptoyotype mismatch in load.pm:
#!/usr/bin/perl BEGIN { eval { do { use strict; use warnings; } }; } use load qw(AutoLoader now); use Thread::Pool; use Amazon::SQS::Simple; my $queue_url = 'https://queue.amazon.com'; my $access_key = q{id}; my $secret_key = q{key}; my $sqs = new Amazon::SQS::Simple($access_key, $secret_key); my $q = $sqs->GetQueue($queue_url); my $msg; while (1) { $msg = $q->ReceiveMessage(); if ($msg != "") { print $msg->MessageBody(); } else { print "No new messages.\n" } sleep(2); }
The rest is up to you.

Replies are listed 'Best First'.
Re^2: Prototype mismatch
by chromatic (Archbishop) on Apr 12, 2012 at 23:05 UTC

    What is this supposed to do?

    BEGIN { eval { do { use strict; use warnings; } }; }

    You can delete the whole thing and the rest of the code will behave the same way.


    Improve your skills with Modern Perl: the free book.

      It's there to do nothing---that's why I put it there. A simple use strict; seemed counter-productive, based on my understanding of load.
        It's there to do nothing---that's why I put it there.

        I don't understand. Why write a big wad of code that does absolutely nothing? (Okay, it prepopulates the require cache with both modules, but what good is that?)

Re^2: Prototype mismatch
by caxtor (Initiate) on Apr 13, 2012 at 21:15 UTC

    Thanks Khen1950fx, The AutoLaoder seemed to fix the Prototype Mismatch, but I am still unable to go past the load.pm error:

    Could not find file for 'XML::LibXML::SAX' at /usr/local/share/perl/5.12.4/load.pm line 214.

    I also had to add $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; as it was failing...

    I'm guessing RecieveMessage is NOT thread safe??