JWSlogger has asked for the wisdom of the Perl Monks concerning the following question:

I am attempting to setup the new Google Adwords API v2009 for Perl and I am running into a compilation error.

The latest version of the Google Code Perl libraries for interfacing with the API are not released to CPAN, nor is there any traction to get them there.

I followed the directions in the Google read me file: http://code.google.com/p/google-api-adwords-perl/source/browse/trunk/README

Bellow is an overview of the hoops I had jumped through so far:

I have downloaded and installed the latest library package:
http://code.google.com/p/google-api-adwords-perl/downloads/detail?name=awapi_perl_lib_1.3.2.tar.gz

I have downloaded and installed the latest version of the SOAP WSDL module (now on version 861 the last time I checked BTW - the Google READ me was looking for an older version of the code - 846):
http://soap-wsdl.svn.sourceforge.net/viewvc/soap-wsdl/SOAP-WSDL/branches/Typemap.tar.gz?view=tar&pathrev=861

Ran the WSDL patch as decribed in the README.

Did the build and install.

Made the Google Accounts - got the tokens.

I created an adwords.properties file in my home directory and edited it with my account data (I did not turn on the Sandbox setting).

Made a local copy of http://google-api-adwords-perl.googlecode.com/svn/trunk/example/display_stats.pl

When I tried to run the above test script I got the following error:

SOAP/Deserializer.pm did not return a true value at (eval 93) line 3. ...propagated at /usr/lib/perl5/5.8.8/base.pm line 85. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/ Google/AdWords/Deserializer.pm line 24. Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/ Google/ AdWords/Client.pm line 26. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/ Google/AdWords/Client.pm line 26. Compilation failed in require at display_stats.pl line 24. BEGIN failed--compilation aborted at display_stats.pl line 24

Any ideas?

Thanks!

Replies are listed 'Best First'.
Re: Setting up Google AdWords API v200909 - compilation error
by almut (Canon) on Jun 01, 2010 at 18:12 UTC
    SOAP/Deserializer.pm did not return a true value at (eval 93) line 3. ...propagated at /usr/lib/perl5/5.8.8/base.pm line 85. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/ Google/AdWords/Deserializer.pm line 24.

    Line 24 of Google/AdWords/Deserializer.pm reads

    use SOAP::Lite; use base qw(SOAP::Deserializer);

    The code for the package SOAP::Deserializer is contained in the file SOAP/Lite.pm.  In other words, there is normally no SOAP/Deserializer.pm file — at least not in the current SOAP::Lite release.  OTOH, base checks if there exists a package variable $SOAP::Deserializer::VERSION (which doesn't in this case), and if not tries to load SOAP/Deserializer.pm. This is all fine as long as there is in fact no such file, as the error "Can't locate SOAP/Deserializer.pm at..." would silently be ignored by base.

    Now, the thing is that you do seem to have such a file (as the error message indicates), and apparently one which doesn't return a true value when required, which is an error condition that base does not ignore...   Further support for this theory is that if I put an empty Deserializer.pm file in my SOAP-Lite installation, I can reproduce the issue:

    $ perl -MSOAP::Lite -e'use base qw(SOAP::Deserializer);' SOAP/Deserializer.pm did not return a true value at (eval 80) line 3. ...propagated at /usr/lib/perl5/5.10.1/base.pm line 93. BEGIN failed--compilation aborted at -e line 1.

    So, check if you maybe also have such a stray Deserializer.pm file...


    Anyhow, the short version of all this is that replacing the above line (in Google/AdWords/Deserializer.pm)

    use base qw(SOAP::Deserializer);

    with

    BEGIN { our @ISA = "SOAP::Deserializer"; }

    should also fix the issue...

      Thank you for the quick reply.

      According to the Google README doc, the deserialization does not occur in SOAP::Lite:

      The backbone of the client library is a modified version of SOAP::WSDL. It handles the serialization/deserialization, transport, and creating classes for the objects defined in the AdWords API WSDLs. SOAP::WSDL, in turn, uses SOAP::Lite under the hood for some operations.

      Later on the the README, in the "Step-by-step guide for getting started:" section it states:

      4) This client library relies on a development version of the SOAP::WSDL module, and also relies on patches to that module. You download the version of SOAP::WSDL available at
      http://soap-wsdl.svn.sourceforge.net/viewvc/soap-wsdl/SOAP-WSDL/branches/Typemap.tar.gz?view=tar&pathrev=846
      and expand the gzip and tar archive. Once that's done, run the soap_wsdl_patches.pl script on the expanded Typemap directory like so:
      bin/soap_wsdl_patches.pl /path/to/downloaded/Typemap

      5) Install the patched SOAP::WSDL following the directions in its README.

      I have followed all of these steps with the exception that I downloaded a later version of the SOAP::WSDL module.

      I took a look and there is indeed a /SOAP/WSDL/Deserializer directory with the following modules in it:

      • Hash.pm
      • SOM.pm
      • XSD.pm

      FYI I tried your BEGIN { push @ISA, "SOAP::Deserializer"; } fix and got the following error:

      Global symbol "@ISA" requires explicit package name at /usr/lib/perl5/ +site_perl/5.8.8/Google/AdWords/Deserializer.pm line 25. BEGIN not safe after errors--compilation aborted at /usr/lib/perl5/sit +e_perl/5.8.8/Google/AdWords/Deserializer.pm line 25. Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/Google +/AdWords/Client.pm line 26. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/Go +ogle/AdWords/Client.pm line 26. Compilation failed in require at display_stats.pl line 24.
        According to the Google README doc, the deserialization does not occur in SOAP::Lite:

        It doesn't really matter where the deserialization actually occurs...  Google/AdWords/Deserializer.pm loads SOAP::Lite and tries to set up an inheritance relationship with SOAP::Deserializer. And that's the line where the error occurs...


        FYI I tried your BEGIN { push @ISA, "SOAP::Deserializer"; } fix and got the following error ...

        Sorry, my fault. That should've been BEGIN { our @ISA = ... (as I've updated my node in the meatime).