Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Coderefs and @INC (return filehandle or undef)

by clueless newbie (Curate)
on Jul 04, 2018 at 16:13 UTC ( [id://1217897]=note: print w/replies, xml ) Need Help??


in reply to Re: Coderefs and @INC (return filehandle or undef)
in thread Coderefs and @INC

Thank you, very much for the second link.

What is weird is that if my dbLoader writes the source to a file then returns a filehandle (the method used in the test) to that file both 'works.pl' and 'worksnot.pl' run successfully. But if dbLoader opens a filehandle on the reference to a string (aka in-memory-file) only 'works.pl' runs successful. 'worksnot.pl' still throws the error shown in the op.

Apparently I'm looking in the wrong place for the source of the problem. If dbloader opens a filehandle on an in-memory file where the contents are copied (rather than on the reference returned by the database) all is well. ie:

Won't work
open my $fh,'<',$body_sref or die "Couldn't open '\$body_ref' for reading. $!"; return $fh;
Will work
open my $fh,'<',\(my $buffer=$$body_sref) or die "Couldn't open in-memory file for io. $!"; return $fh;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1217897]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-26 05:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found