in reply to Can you override lexically scoped variables when sub-classing a module.

Not really, no. That's kind of the point of lexical variables. They can't be accessed from outside their scope, so they are immune to "spooky action at a distance".

It's a bit of a hack, but you might have some luck with PadWalker's set_closed_over.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
  • Comment on Re: Can you override lexically scoped variables when sub-classing a module.
  • Download Code

Replies are listed 'Best First'.
Re^2: Can you override lexically scoped variables when sub-classing a module.
by learnedbyerror (Monk) on Oct 11, 2012 at 21:53 UTC

    Thanks, I'll take a look at it. I had looked at Padwalker earlier but didn't get deep enough with it to figure out how to apply it to the module in question

    lbe