I know I going on about this, but it's still annoying...

OK, I know why the error is occuring (and I am using PPM v. 1.1.2).

If the PPM::read_href, when trying to read a HEADer, gets a success the
file will be attempted downloaded and parsed by XML::Parser.

Unfortunately, requesting the header information for, for example
http://www.activestate.com/Packages/nonexisting.ppd, yields a success! Then
PPM tries to download and parse the file and the XML::Parser dies.

So what can you do?

Well, I have a hack. I am not proud of it, because it generates extra
trafic and takes more processing time (the same file is process twice by
XML::Parser etc.) but it is a quick'n'dirty hack, that works, at least to
my knowledge. I'll try to get the time to make a prettier solution next
week (not till friday though).

In the PPM.pm module you could make a few changes:

1.
In the sub readPPDfile change the line
        my @parsed = @{ $parser->parse( $CONTENTS ) };
with
        my @parsed;
        eval {
                @parsed = @{ $parser->parse( $CONTENTS ) };
        };
        return undef if ($@);

2.
In the sub valid_URL_or_file change the line
        return 1 if ($File =~ m@^...*://@i && defined read_href("href" => $File,
"request" => 'HEAD'));
with
        if ($File =~ m@^...*://@i) {
                my $CONTENTS = read_href("href" => $File, "request" => 'GET');
                if (defined $CONTENTS) {
                        $CONTENTS =~ s/&(?!\w+;)/&/go;
                        my $parser = new XML::Parser( Style => 'Objects', Pkg => 
'XML::PPD' );
                        my @parsed;
                        eval {
                                @parsed = @{ $parser->parse( $CONTENTS ) };
                        };
                        return 0 if ($@);
                        return 1;
                }
        }

Not the prettiest solution, but hey, now PPM doesn't die and goes on
searching through all the repositories if it cannot find a PPD file :-)

/Henning



---
You are currently subscribed to perl-win32-users as: [[email protected]]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to