Subject: Developers of Sympa
List archive
Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,
- From: IKEDA Soji <address@concealed>
- To: address@concealed
- Subject: Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,
- Date: Thu, 20 Dec 2012 11:21:25 +0900
Marc and all,
On Wed, 19 Dec 2012 14:46:30 +0100
Marc Chantreux <address@concealed> wrote:
> On Tue, Dec 18, 2012 at 03:42:05PM +0100, Guillaume Rousse wrote:
> > Le 18/12/2012 15:35, David Verdin a écrit :
> > >
> > >Le 18/12/12 14:50, Guillaume Rousse a écrit :
> > >>Le 18/12/2012 14:35, David Verdin a écrit :
> > >>>I'm also quite found of the getters / setters. But we have to deal with
> > >>>legacy. What Soji proposes is a good compromise for the 6.2 version. It
> > >>>gives us accessors without having to rewrite large parts of the code.
> > >>>However, using get_* and set_* methods implemented looks like a good
> > >>>aim
> > >>>for 6.3 on my opinion.
> > >>Turning those automatically-generated 'foo()' accessors into
> > >>'get_foo()' is just a matter or changing the regexp used to parse
> > >>AUTOLOAD value:
> > >>
> > >>$AUTOLOAD =~ m/^(.*)::(.*)/;
> > >>to
> > >>$AUTOLOAD =~ m/^(.*)::get_(.*)/;
> > >>
> > >>The same statement, with a stricter regexp and error handling:
> > >>croak "no such method" unless $AUTOLOAD =~ m/^(\S+)::get_(\S+)/;
> > >Croak again, darn... ;-)
>
> I'm sorry i haven't found the thread on the archive
> (https://listes.renater.fr/sympa/arc/sympa-developpers/2012-11/)
> so maybe this is answer is irrelevant. Just ignore me if it is :)
>
> I had some bad experiences with $AUTOLOAD which is pain to debug in
> some cases. why not use Package::Stash and closures to manipulate those
> kind if symbols?
There are no serious reasons. I'd been making efforts not using
modules stir Perl internals (this is not an absolute rule). That's
why I used simple Perl idiom to generate dynamic methods instead
using external module.
If it is possible that current AUTOLOAD approach bumps against
any difficulties, module to solve them must be introduced (closure
is also used in current code). Would you please explain me what
problem(s) Package::Stash will solve?
> something like
>
> my $things = Package::Stash->new('Sympa::Things');
>
> for my $sym (qw< owner subscribers editors >) {
> $things->add_symbol
> ( "\&get_$sym" => sub { some_code_to_get $sym }
> );
> }
>
> Package::Stash is XS and PP, heavily used in Class::MOP AFAIK.
>
> regards
Regards,
--- Soji
--
株式会社 コンバージョン セキュリティ&OSSソリューション部 池田荘児
〒231-0004 神奈川県横浜市中区元浜町3-21-2 ヘリオス関内ビル7F
e-mail address@concealed TEL 045-640-3550
http://www.conversion.co.jp/
-
Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,
, (continued)
-
Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,,
Guillaume Rousse, 12/18/2012
-
Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,,
Marc Chantreux, 12/19/2012
-
Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,,
Guillaume Rousse, 12/19/2012
- Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,, Marc Chantreux, 12/19/2012
- Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,, Guillaume Rousse, 12/19/2012
- Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,, David Verdin, 12/19/2012
- Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,, Marc Chantreux, 12/19/2012
- Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,, David Verdin, 12/20/2012
- Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,, Marc Chantreux, 12/20/2012
-
Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,,
Guillaume Rousse, 12/19/2012
-
Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,,
Marc Chantreux, 12/19/2012
- Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,, Marc Chantreux, 12/19/2012
-
Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,,
Guillaume Rousse, 12/18/2012
Archive powered by MHonArc 2.6.19+.