in reply to Re^2: use/import params during require
in thread use/import params during require

I've played around with caller and Devel::StackTrace, and although code in the "global require time space" (as you put it) can see the frame where it's been required, it can't see the arguments. (Not even by using the DB package.)

You could potentially fake it - you get given the name of the file that required you, and the line number, so you could try reading your caller's file and parsing it yourself, but that's pretty fragile!

As you're using XS anyway, it's possible that XS code might have better luck peeking up the call stack. The information must (surely) already be in the op tree, so there may well be a way of teasing it out.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'