Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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

by clueless newbie (Deacon)
on Jul 04, 2018 at 16:13 UTC ( #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 '' and '' run successfully. But if dbLoader opens a filehandle on the reference to a string (aka in-memory-file) only '' runs successful. '' 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?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2019-12-06 22:40 GMT
Find Nodes?
    Voting Booth?
    Strict and warnings: which comes first?

    Results (160 votes). Check out past polls.