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

We're trying to get a mod_perl script to work on Windows. The script works fine as mod_perl on Linux (Linux/Apache2/mod_perl), and also works fine on Windows when pulled out and run as a stand-alone Perl script -- but when running as Apache2/mod_perl on Windows 2008, parsing breaks with the following error:
'error' => 'Can\'t call method "parse_string" on unblessed reference at C:/Perl/site/lib/XML/Compile/Transport.pm line 77.
As you can see, we're using XML::Compile to manage the data. We've traced the calls, and the log files look essentially identical when run as stand-alone perl and mod_perl -- but the mod_perl version (on Windows) returns the above error and exits before decoding the XML.

Again, this script works fine as mod_perl on Linux, so there would appear to be some critical difference between Linux and Win 2008 versions of Apache/mod_perl -- or between certain of the respective packages thereof.

For what it's worth, we've tried both Strawberry and ActivePerl versions (both v. 5.12) -- same error with each.

Any suggestions would be much appreciated.

  • Comment on XML::Compile problem in Win-based mod_perl app

Replies are listed 'Best First'.
Re: XML::Compile problem in Win-based mod_perl app
by bart (Canon) on Aug 05, 2012 at 22:03 UTC
    Can't call method "parse_string" on unblessed reference at C:/Perl/site/lib/XML/Compile/Transport.pm line 77.
    This obtuse error message simply means that you don't have an object. You now have to find out why.
      Thanks -- yes, it's definitely the case that the object isn't being created (ref unblessed). What's confounding us is why this is happening here and not when the same script runs in a Linux-based Apache/mod_perl setting or when the code is run on Windows as a standalone Perl script.

      For comparison, here are trace examples from both working and non-working login calls. Note the error field near the end of the second (breaking example) trace:

      START TRACE FOR WORKING LOGIN ==============

      
       TRACE INFO:$VAR1 = bless( {
        'transport_end' => '1344195499.00649',
        'parse_elapse' => '0.000446081161499023',
        'connect_elapse' => '0.420936822891235',
        'stringify_elapse' => '5.19752502441406e-005',
        'response_dom' => bless( do{\(my $o = 79470568)}, 'XML::LibXML::Document' ),
        'http_response' => bless( {
          '_protocol' => 'HTTP/1.1',
          '_content' => '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><LoginResponse xmlns="http://somedomain.com"><LoginResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Error i:nil="true"/><Session><Organisation>string<SessionId>sessidstring</SessionId><User><Email>dude@somedomain.com</Email><FacilityIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">guidstringguidstringguidstringaguidstring</FacilityIds><FirstName>UserFirstName</FirstName><GroupId>groupidstring</GroupId><Id>idstring</Id><Inactive>false</Inactive><LastName>UserLastName</LastName></User></Session></LoginResult></LoginResponse></s:Body></s:Envelope>',
          '_rc' => 200,
          '_headers' => bless( {
            'client-date' => 'Sun, 05 Aug 2012 19:38:18 GMT',
            'x-powered-by' => 'ASP.NET',
            'content-type' => 'text/xml; charset=utf-8',
            'client-response-num' => 1,
            'date' => 'Sun, 05 Aug 2012 19:38:18 GMT',
            'client-peer' => '168.63.166.222:80',
            'server' => 'Microsoft-IIS/7.5',
            'content-length' => '1149'
          }, 'HTTP::Headers' ),
          '_msg' => 'OK',
          '_request' => bless( {
            '_content_ref' => 1,
            '_content' => \'<?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><tns:Login xmlns:tns="http://somedomain.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><tns:email>someguy@somedomain.com</tns:email><tns:password>passwordstring</tns:password><tns:ip>someip</tns:ip></tns:Login></SOAP-ENV:Body></SOAP-ENV:Envelope>
      ',
            '_protocol' => 'HTTP/1.1',
            '_uri' => bless( do{\(my $o = 'http://somedomain.com/AppService.svc')}, 'URI::http' ),
            '_headers' => bless( {
              'user-agent' => 'libwww-perl/6.04',
              'x-xml-compile-soap-version' => '2.28',
              'x-xml-compile-cache-version' => '0.991',
              'content-length' => 407,
              'soapaction' => '"http://somedomain.com/AppService/Login"',
              'x-xml-libxml-version' => '2.0003',
              'x-xml-compile-version' => '1.25',
              'content-type' => 'text/xml; charset="utf-8"',
              'x-lwp-version' => '6.04'
            }, 'HTTP::Headers' ),
            '_method' => 'POST'
          }, 'HTTP::Request' )
        }, 'HTTP::Response' ),
        'encode_elapse' => '0.000396013259887695',
        'elapse' => '0.470435857772827',
        'transport_elapse' => '0.421434879302979',
        'http_request' => $VAR1->{'http_response'}{'_request'},
        'decode_elapse' => '0.0486049652099609',
        'start' => '1344195498.41262',
        'transport_start' => '1344195498.28505'
      }, 'XML::Compile::SOAP::Trace' );
      
      END TRACE FOR WORKING LOGIN

      =============================
      START TRACE FOR BREAKING LOGIN

       TRACE INFO:$VAR1 = bless( {
        'transport_end' => '1344194990.68682',
        'parse_elapse' => '0.0023648738861084',
        'connect_elapse' => '0.311218023300171',
        'stringify_elapse' => '5.60283660888672e-005',
        'http_response' => bless( {
          '_protocol' => 'HTTP/1.1',
          '_content' => '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><LoginResponse xmlns="http://somedomain.com"><LoginResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Error i:nil="true"/><Session><Organisation>wcat1<DiscountRate>0.00</DiscountRate><FYStartMonth>0</FYStartMonth><Id>6ad37dcb-b962-4867-ac39-d6c3ab2879ed</Id><Inactive>false</Inactive><InflationRate>0.00</InflationRate><Name>Sample Sessoin</Name></Organisation><SessionId>sessionstring</SessionId><User><Email>someguy@somedomain.com</Email><FacilityIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">guidstringguidstringguidstringguidstring</FacilityIds><FirstName>FirstName</FirstName><GroupId>numbersstuff</GroupId><Id>numbersandletters</Id><Inactive>false</Inactive><LastName>LastName</LastName></User></Session></LoginResult></LoginResponse></s:Body></s:Envelope>',
          '_rc' => 200,
          '_headers' => bless( {
            'client-date' => 'Sun, 05 Aug 2012 19:29:50 GMT',
            'x-powered-by' => 'ASP.NET',
            'content-type' => 'text/xml; charset=utf-8',
            'client-response-num' => 1,
            'date' => 'Sun, 05 Aug 2012 19:29:50 GMT',
            'client-peer' => 'ip.address',
            'server' => 'Microsoft-IIS/7.5',
            'content-length' => '1149'
          }, 'HTTP::Headers' ),
          '_msg' => 'OK',
          '_request' => bless( {
            '_content_ref' => 1,
            '_content' => \'<?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><tns:Login xmlns:tns="http://somdomain.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><tns:email>name@addr.com</tns:email><tns:password>passwordstring</tns:password><tns:ip>ip.addr</tns:ip></tns:Login></SOAP-ENV:Body></SOAP-ENV:Envelope>
      ',
            '_protocol' => 'HTTP/1.1',
            '_uri' => bless( do{\(my $o = 'http://somedomain.com/AppService.svc')}, 'URI::http' ),
            '_headers' => bless( {
              'user-agent' => 'libwww-perl/6.04',
              'x-xml-compile-soap-version' => '2.28',
              'x-xml-compile-cache-version' => '0.991',
              'content-length' => 407,
              'soapaction' => '"http://somedomain.com/IAppService/Login"',
              'x-xml-libxml-version' => '2.0003',
              'x-xml-compile-version' => '1.25',
              'content-type' => 'text/xml; charset="utf-8"',
              'x-lwp-version' => '6.04'
            }, 'HTTP::Headers' ),
            '_method' => 'POST'
          }, 'HTTP::Request' )
        }, 'HTTP::Response' ),
        'encode_elapse' => '0.000400066375732422',
        'error' => 'Can\'t call method "parse_string" on unblessed reference at C:/strawberry/perl/site/lib/XML/Compile/Transport.pm line 82.
      ',
        'elapse' => '0.314038991928101',
        'transport_elapse' => '0.313638925552368',
        'http_request' => $VAR1->{'http_response'}{'_request'},
        'start' => '1344194990.37278',
        'transport_start' => '1344194990.37318'
      }, 'XML::Compile::SOAP::Trace' );
      
      END TRACE FOR BREAKING LOGIN ==============

      The reason for the unblessed ref isn't clear to us at this point. Any suggestions are most welcome.

Re: XML::Compile problem in Win-based mod_perl app
by Anonymous Monk on Aug 06, 2012 at 01:58 UTC

    Again, this script works fine as mod_perl on Linux, so there would appear to be some critical difference between Linux and Win 2008 versions of Apache/mod_perl -- or between certain of the respective packages thereof.

    Its kind of early to leap to that conclusion, but, if its true, it should be easy to replicate in a minimal sample you can share with us