in reply to Re: opening filehandle with Win32API::File seems to return scalar (OsFHandleOpen)
in thread opening filehandle with Win32API::File seems to return scalar
I got it to work that way but only with a baretext filehandle and without using strict. When I used a lexical variable I got the error message "Can't use an undefined value as a symbol reference at D:\Users\lock\t2.pl line 18." Line 18 is the print statement.
I still don't understand why the tie didn't work. There was no implementation of TIESCALAR in the module but I found TIEHANDLE.
#use strict; use warnings; use Data::Dumper; use Win32API::File 0.08 qw( :ALL ); my $testfile = "test.xml"; print "file exists\n" if -e $testfile; my $hObject = createFile( $testfile, 'rw k e' ); unless ( $hObject ) { die "error creating handle: $^E\n"; } print Dumper( $hObject); my $fh; OsFHandleOpen( FHTEST, $hObject, 'rw' ) or die "OsFHandleOpen: $^E\n"; print FHTEST "test"; print "finished\n"; __DATA__ output: Name "main::FHTEST" used only once: possible typo at D:\Users\lock\t2. +pl line 18. file exists $VAR1 = 116; finished
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: opening filehandle with Win32API::File seems to return scalar (IO::Handle)
by tye (Sage) on Oct 14, 2014 at 21:46 UTC |