Hi,

I get a "Can't coerce GLOB to string"-error for every new thread that is
started (mp2). I have no idea why this happens (or even what this error
actually means).

The module is included below (line producing the error is marked "ERROR
HERE"). Error happens for every new thread (on the first request).
When running ApacheBench  ab -c 3 -n 100 http://...  I get 3 errors and 97
OKs.

Very grateful if anyone care to look at this!

[Apache/2.0.43 (Win32) mod_perl/1.99_09-dev Perl/v5.8.0 DAV/2]


---------- Here's the module ----------

package MyApache::XSLTransformer;

use strict;
use warnings FATAL=>'all', NONFATAL=>'redefine';

use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::Const -compile => qw(OK);

use threads;
use threads::shared;

use XML::LibXML;
use XML::LibXSLT;

use APR::OS;

my $statRequestCount = 0;
my $statErrorCount = 0;


sub handler {
  my $r = shift;

  $statRequestCount++;

  $r->content_type('text/html');

  my $documentFilename = $ENV{SCRIPT_FILENAME};
  my $stylesheetFilename = $r->dir_config("xslTransformer_stylesheet");

  return 404 unless -e $documentFilename;

  my $xmlParser   = XML::LibXML->new();
  my $xsltParser  = XML::LibXSLT->new();

  ### PARSE DOCUMENT
  my $document;
  eval {
    $document = $xmlParser->parse_file($documentFilename);
  };
  if ($@) {
    return error($r,'Error parsing XML document',$@);
  }

  ### PARSE STYLESHEET DOCUMENT
  my $stylesheetDocument;
  eval {
    $stylesheetDocument = $xmlParser->parse_file($stylesheetFilename);
  };
  if ($@) {
    return error($r,'Error parsing XSL stylesheet document (XML)',$@);
  }

  ### PARSE STYLESHEET
  my $stylesheet;
  eval {
    $stylesheet = $xsltParser->parse_stylesheet($stylesheetDocument);
  };
  if ($@) {
    return error($r,'Error parsing XSL stylesheet (XSLT)',$@);
  }

  ### TRANSFORM
  my $results;
  eval {
    $results = $stylesheet->transform($document);   ### <--- ERROR HERE
  };
  if ($@) {
    return error($r,'Error transforming document',$@);
  }

  ### PRINT
  eval {
    print $stylesheet->output_string($results);
  };
  if ($@) {
    return error($r,'Error serializing transformed document',$@);
  }

  my $tid = APR::OS::thread_current();
  $r->log_error("[xslTransformer] OK
[tid=$tid|reqno=$statRequestCount|errno=$statErrorCount]");

  return Apache::OK;
}

sub error {
  my ($r,$title,$msg) = @_;

  $statErrorCount++;

  my $tid = APR::OS::thread_current();
  $r->log_error("[xslTransformer] $title - $msg
[tid=$tid|reqno=$statRequestCount|errno=$statErrorCount]");
  return 500;
}

1;


--- The exact error log entry is: ---

[Tue Feb 25 16:04:04 2003] [error] [xslTransformer] Error transforming
document - Can't coerce GLOB to string in entersub at
E:/data/www/perlLib/MyApache/XSLTransformer.pm line 74.
[tid=APR::OS::Thread=SCALAR(0x1205be4)|reqno=1|errno=1]




Thanks,
-Kurt.
__________
kurt george gjerde <[EMAIL PROTECTED]>
intermedia uib, university of bergen

Working for bandwidth.

Reply via email to