On Mon, Feb 23, 2009 at 10:11:56PM +0100, Steffen Mueller wrote: > Hi Nicholas, > > Nicholas Clark wrote: > > Add deprecate.pm. Deprecate shipping Switch.pm in the core distribution. > > Yay! > > > 3: Fix the bit of the code that is commented as "fragile" > > What's wrong with the following change that fixes 1/2 of the fragility? > > Make the ugly line > > use if $] >= 5.011, 'deprecate'; > > become the ugly line > > BEGIN { if ($] >= 5.11) { require deprecate; deprecate->import(); } } > > which does the same without additional call stacks. And reads more > easily (to me), too. Well, basically, I didn't think of writing it on one line. :-) I was thinking use deprecated if $] >= 5.11; then "oh crap, that seems to be a syntax error" and then thought that writing it all out longhand would be a big intrusion on the code of each module we want to deprecate. However, I'm coming round to the view that your one liner is possibly better than if.pm, despite if.pm existing for just this. Nicholas ClarkThread Previous | Thread Next