We don't bite newbies here... much | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Thank you. I was thinking about taking this road, using eval to switch package. I can't goto &$sub to erase the current stack frame, because I need to do the track housekeeping after the open, and record the (possible mutated) $_[0]. OTOH... thinking about it, I could switch package in that eval'ed sub again and do the housekeeping there. To that end, the %fh fieldhash must be a package var. Oh well. Currently, I am inspecting $_[0] with Devel::Caller etc. to find out whether the filehandle variable is lexical, package global, typeglob, bareword etc and trying to do the right thing. Anyways the overridden open would show up in the stack trace of Carp::cluck, so another stack frame wouldn't matter I guess. But with Sub::Name I could make that sub into the calling package. Maybe that's the best way to do it. It is definitely the cheapest in effort :-) update: and maybe the most robust also... Thanks again, salva!
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
In reply to Re^6: Track open file handles
by shmem
|
|