<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package XML::SAX::Debian;

use strict;
use warnings;

use base "XML::SAX";

use File::Spec ();

sub save_parsers_debian {
    my $class = shift;
    my ($parser_module,$directory, $priority) = @_;

    # add parser
    {
        # We do not want load_parsers to complain.
        local $ENV{HARNESS_ACTIVE} = 1;
        $class-&gt;load_parsers("/nonexistent");
    }
    $class-&gt;add_parser($parser_module);

    # get parser's ParserDetails file
    my $file = $parser_module;
    $file = "${priority}-$file" if $priority != 0;
    $file = File::Spec-&gt;catfile($directory, $file);
    chmod 0644, $file;
    unlink($file);

    open(my $fh, "&gt;$file") ||
        die "Cannot write to $file: $!";

    foreach my $p (@{ $class-&gt;parsers }) {
        print $fh "[$p-&gt;{Name}]\n";
        foreach my $key (keys %{$p-&gt;{Features}}) {
            print $fh "$key = $p-&gt;{Features}{$key}\n";
        }
        print $fh "\n";
    }

    print $fh "\n";

    close $fh;

    return $class;
}

1;
</pre></body></html>