12 my $path = "data.txt";
13 my $data = "random junk\n";
16 my $obj = FileObject->new($path);
17 isa_ok( $obj, 'FileObject' );
18 is( "$obj", $path, "check that the object correctly stringifies" );
20 my $is_glob = eval{ $obj->isa( 'GLOB' ) } ;
21 #print "GLOB $is_glob\n" ;
23 my $is_io = eval{ $obj->isa( 'IO' ) } ;
24 #print "IO $is_io\n" ;
26 my $io = IO::Handle->new() ;
29 my $is_io2 = eval{ $io->isa( 'GLOB' ) } ;
30 #print "IO2 $is_io2\n" ;
32 open( FH, "<$0" ) or die "can't open $0: $!" ;
35 #print "IO3: $io3\n" ;
37 my $is_io3 = eval{ $io3->isa( 'IO' ) } ;
38 #print "IO3 $is_io3\n" ;
41 #print "IO4: $io4\n" ;
43 my $is_io4 = eval{ $io4->isa( 'GLOB' ) } ;
44 #print "IO4 $is_io4\n" ;
48 # write something to that file
49 open(FILE, ">$obj") or skip 4, "can't write to '$path': $!";
53 # pass it to read_file()
54 my $content = eval { read_file($obj) };
55 is( $@, '', "passing an object to read_file()" );
56 is( $content, $data, "checking that the content matches the data" );
62 # the following mimics the parts from Path::Class causing
63 # problems with File::Slurp
66 q[""] => \&stringify, fallback => 1;
69 return bless { path => $_[1] }, $_[0]