P
Piet L.
Hey,
I'm working with IIS (Windows 2000).
I've create a virtual directory usr-cgi met link naar e:\cgi
It works all well when I run simple scripts, but with the following script
I get a "Page can not be displayed" error.
Here is the code:
--------->>>>orders.pm
package orders;
use strict;
use vars qw(@ISA);
use CGI::XMLApplication;
use XML::LibXML;
use DBI;
use XML::Generator:BI;
use XML::Handler::YAWriter;
@ISA = qw(CGI::XMLApplication);
my $path = "e:/cgi/finaal/";
my $file_name = "orders";
my $xmlfile = "$file_name.xml";
my $xslfile = "$file_name.xsl";
my $xmlfile_path = "$path$xmlfile";
my $xslfile_path = "$path$xslfile";
sub selectStylesheet {
my $self = shift;
my $context
my $style = $context->{STYLE} || $xslfile;
return $path . $style;
}
sub requestDOM {
my $self = shift;
my $context;
fetch_record();
my $xml_file = $context->{REQUEST} || $xmlfile;
my $requested_doc = $path . $xml_file;
my $parser = XML::LibXML->new();
my $doc = $parser->parse_file($requested_doc);
my $root = $doc->getDocumentElement();
return $root;
}
sub fetch_record() {
my $self = shift;
# create a DBI connection
my $dbh = DBI->connect ("DBI:mysql:MyDB", "MYLOGIN", "MYPASSWORD",
{ RaiseError => 1,
PrintError => 0
});
# instantiate a new XML::Handler::YAWriter object
my $out = XML::Handler::YAWriter-> new(
AsFile => "$xmlfile_path",
Pretty => {PrettyWhiteNewline => 0,
PrettyWhiteIndent => 0,
CatchEmptyElement => 1,
CatchWhiteSpace => 0
},
Encoding => "ISO-8859-1",
);
# instantiate a new XML::Generator:BI object
my $gen = XML::Generator:BI->new(
Handler => $out,
dbh => $dbh
);
# define the SQL query
my $query1 = "SELECT *
FROM orders
";
warn "SQL $query1";
my $sth1 = $dbh->prepare($query1);
$gen->execute($sth1);
}
--------->>>>orders.cgi
#!/usr/bin/perl -w
use strict;
use CGI qwstandard);
use lib 'e:/cgi/finaal';
use orders;
my $q = CGI->new();
my %context = ();
my $gateway_name = orders;
$context{STYLE} = $q->param('style') if $q->param('style');
$context{REQUEST} = $q->url(-relative=>1);
$context{REQUEST} =~ s/^$gateway_name\/?//;
$context{REQUEST} ||= 'orders.xml';
my $app = orders->new();
$app->run(%context);
I know the script is working, because when I try it in DOS
e:\cgi\finaal> perl orders.cgi
I get the right output
Problem is the http://localhost/usr-cgi/finaal/orders.cgi
Is there something wrong with my path definition?
I'm working with IIS (Windows 2000).
I've create a virtual directory usr-cgi met link naar e:\cgi
It works all well when I run simple scripts, but with the following script
I get a "Page can not be displayed" error.
Here is the code:
--------->>>>orders.pm
package orders;
use strict;
use vars qw(@ISA);
use CGI::XMLApplication;
use XML::LibXML;
use DBI;
use XML::Generator:BI;
use XML::Handler::YAWriter;
@ISA = qw(CGI::XMLApplication);
my $path = "e:/cgi/finaal/";
my $file_name = "orders";
my $xmlfile = "$file_name.xml";
my $xslfile = "$file_name.xsl";
my $xmlfile_path = "$path$xmlfile";
my $xslfile_path = "$path$xslfile";
sub selectStylesheet {
my $self = shift;
my $context
my $style = $context->{STYLE} || $xslfile;
return $path . $style;
}
sub requestDOM {
my $self = shift;
my $context;
fetch_record();
my $xml_file = $context->{REQUEST} || $xmlfile;
my $requested_doc = $path . $xml_file;
my $parser = XML::LibXML->new();
my $doc = $parser->parse_file($requested_doc);
my $root = $doc->getDocumentElement();
return $root;
}
sub fetch_record() {
my $self = shift;
# create a DBI connection
my $dbh = DBI->connect ("DBI:mysql:MyDB", "MYLOGIN", "MYPASSWORD",
{ RaiseError => 1,
PrintError => 0
});
# instantiate a new XML::Handler::YAWriter object
my $out = XML::Handler::YAWriter-> new(
AsFile => "$xmlfile_path",
Pretty => {PrettyWhiteNewline => 0,
PrettyWhiteIndent => 0,
CatchEmptyElement => 1,
CatchWhiteSpace => 0
},
Encoding => "ISO-8859-1",
);
# instantiate a new XML::Generator:BI object
my $gen = XML::Generator:BI->new(
Handler => $out,
dbh => $dbh
);
# define the SQL query
my $query1 = "SELECT *
FROM orders
";
warn "SQL $query1";
my $sth1 = $dbh->prepare($query1);
$gen->execute($sth1);
}
--------->>>>orders.cgi
#!/usr/bin/perl -w
use strict;
use CGI qwstandard);
use lib 'e:/cgi/finaal';
use orders;
my $q = CGI->new();
my %context = ();
my $gateway_name = orders;
$context{STYLE} = $q->param('style') if $q->param('style');
$context{REQUEST} = $q->url(-relative=>1);
$context{REQUEST} =~ s/^$gateway_name\/?//;
$context{REQUEST} ||= 'orders.xml';
my $app = orders->new();
$app->run(%context);
I know the script is working, because when I try it in DOS
e:\cgi\finaal> perl orders.cgi
I get the right output
Problem is the http://localhost/usr-cgi/finaal/orders.cgi
Is there something wrong with my path definition?