in reply to Optimizing away calls to functions defined in eval
Strangely enough about a week ago we were talking about auto-generating accessors and I still had the following code in my scratchpad... maybe it will help...
BTW - Is untested, but should give you the idea...package accessors; sub import { no strict 'refs'; my $pkg = (caller)[0]; for my $sub (@_) { *{$pkg.'::'.$sub} = sub { $#_ && $_[0]->{$sub} = $_[1]; $_[0]->{$s +ub} } } } package main; use accessors qw(foo bar baz);
- Ant
- Some of my best work - Fish Dinner
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Optimizing away calls to functions defined in eval
by dragonchild (Archbishop) on Oct 16, 2001 at 17:56 UTC | |
by chromatic (Archbishop) on Oct 16, 2001 at 20:33 UTC | |
by demerphq (Chancellor) on Oct 17, 2001 at 17:35 UTC | |
by suaveant (Parson) on Oct 16, 2001 at 18:02 UTC | |
by jackdied (Monk) on Oct 17, 2001 at 00:46 UTC | |
by dragonchild (Archbishop) on Oct 17, 2001 at 02:23 UTC | |
by jackdied (Monk) on Oct 17, 2001 at 02:47 UTC |