File: file_open_scalar.t

package info (click to toggle)
libxml-parser-perl 2.47-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,396 kB
  • sloc: xml: 3,937; perl: 2,026; makefile: 38; ansic: 27
file content (28 lines) | stat: -rw-r--r-- 557 bytes parent folder | download | duplicates (4)
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 );