|
root / base / usr / src / contrib / XML-Parser / t / file_open_scalar.t
file_open_scalar.t Perl 29 lines 557 B
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

use if $] < 5.006, Test::More => skip_all => 'syntax requires perl 5.6';

#tests behaviour on perls 5.10? .. 5.10.1
package Some::Fake::Packege;

sub fake_sub {
    require FileHandle;
}

package main;

use Test::More tests => 1;
use XML::Parser;
use strict;

my $count = 0;

my $parser = XML::Parser->new( ErrorContext => 2 );
$parser->setHandlers( Comment => sub { $count++; } );

open my $fh, '<', 'samples/REC-xml-19980210.xml' or die;

#on 5.10 $fh would be a FileHandle object without a real FileHandle class

$parser->parse($fh);

is( $count, 37 );