~ubuntu-branches/ubuntu/utopic/libxml-sax-perl/utopic

« back to all changes in this revision

Viewing changes to SAX.pm

  • Committer: Bazaar Package Importer
  • Author(s): Niko Tyni
  • Date: 2008-04-04 16:00:12 UTC
  • mfrom: (1.1.4 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080404160012-2kh7ygoy3a8l1s9g
Tags: 0.16+dfsg-3
README.Debian: replace a broken link to the CPAN FAQ entry about
uninstalling CPAN modules with its intended content. (Closes: #469958)

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
sub load_parsers {
48
48
    my $class = shift;
49
49
    my $dir = shift;
50
 
    my $file = shift;
51
50
    
52
51
    # reset parsers
53
52
    $known_parsers = [];
54
53
    
 
54
    # get directory from wherever XML::SAX is installed
55
55
    if (!$dir) {
56
 
        # get directory from wherever XML::SAX is installed
57
56
        $dir = $INC{'XML/SAX.pm'};
58
 
        $dir =  File::Spec->catfile(dirname($dir), "SAX");
59
 
    }
60
 
 
61
 
    if (!$file) {
62
 
        # use default file name
63
 
        $file = PARSER_DETAILS;
 
57
        $dir = dirname($dir);
64
58
    }
65
59
    
66
60
    my $fh = gensym();
67
 
    if (!open($fh, File::Spec->catfile($dir, $file))) {
68
 
        XML::SAX->do_warn("could not find $file in $dir\n");
 
61
    if (!open($fh, File::Spec->catfile($dir, "SAX", PARSER_DETAILS))) {
 
62
        XML::SAX->do_warn("could not find " . PARSER_DETAILS . " in $dir/SAX\n");
69
63
        return $class;
70
64
    }
71
65
 
186
180
    my $class = shift;
187
181
    
188
182
    # get directory from wherever XML::SAX is installed
189
 
    #my $dir = $INC{'XML/SAX.pm'};
190
 
    #$dir = dirname($dir);
191
 
    
192
 
    #my $file = File::Spec->catfile($dir, "SAX", PARSER_DETAILS);
193
 
    #chmod 0644, $file;
194
 
    #unlink($file);
195
 
    
196
 
    #my $fh = gensym();
197
 
    #open($fh, ">$file") ||
198
 
    #    die "Cannot write to $file: $!";
199
 
 
200
 
    #foreach my $p (@$known_parsers) {
201
 
    #    print $fh "[$p->{Name}]\n";
202
 
    #    foreach my $key (keys %{$p->{Features}}) {
203
 
    #        print $fh "$key = $p->{Features}{$key}\n";
204
 
    #    }
205
 
    #    print $fh "\n";
206
 
    #}
207
 
 
208
 
    #print $fh "\n";
209
 
 
210
 
    #close $fh;
211
 
 
212
 
    print "\n";
213
 
    print "Please use 'update-perl-sax-parsers(8) to register this parser.'\n";
214
 
    print "See /usr/share/doc/libxml-sax-perl/README.Debian for more info.\n";
215
 
    print "\n";
216
 
 
217
 
    return $class;
218
 
}
219
 
 
220
 
sub save_parsers_debian {
221
 
    my $class = shift;
222
 
    my ($parser_module,$directory) = @_;
223
 
 
224
 
    # add parser
225
 
    $known_parsers = [];
226
 
    $class->add_parser($parser_module);
227
 
    
228
 
    # get parser's ParserDetails file
229
 
    my $file = File::Spec->catfile($directory, $parser_module);
 
183
    my $dir = $INC{'XML/SAX.pm'};
 
184
    $dir = dirname($dir);
 
185
    
 
186
    my $file = File::Spec->catfile($dir, "SAX", PARSER_DETAILS);
230
187
    chmod 0644, $file;
231
188
    unlink($file);
232
189