Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] [sympa-commits] sympa[8261] branches/sympa-6.2-branch/src/lib: [dev] split AUTOLOAD of Site to Site and Robot,

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Guillaume Rousse <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: Tue, 18 Dec 2012 15:42:05 +0100

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... ;-)
Indeed :)

However, in this case, it just restores the defaut behaviour for calling a non-existent function when AUTOLOAD is not used:

perl -MData::Dumper -e 'Data::Dumper::no_such_function()'
Undefined subroutine &Data::Dumper::no_such_function called at -e line 1.

--
Guillaume Rousse
INRIA, Direction des systèmes d'information
Domaine de Voluceau
Rocquencourt - BP 105
78153 Le Chesnay
Tel: 01 39 63 58 31

Attachment: smime.p7s
Description: Signature cryptographique S/MIME




Archive powered by MHonArc 2.6.19+.

Top of Page