[Rt-devel] Re: [PATCH] DBIx::SB::Record.pm aliases cleanup and
docs
Ruslan Zakirov
Ruslan.Zakirov at miet.ru
Tue May 3 03:39:50 EDT 2005
Jesse Vincent wrote:
>
>On Thu, Apr 07, 2005 at 05:01:44PM +0400, Ruslan U. Zakirov wrote:
>
>
>>Forgot about attachment :)
>>
>>Ruslan U. Zakirov wrote:
>>
>>
>>> Hello.
>>>Attached patch add missing aliases and some words that such aliases exist.
>>>
>>>
>>>
>
>
>What do you think about switching to use miyagawa's capitalization.pm
>for this function instead?
>
>
First, I had some time to try it but with no success. I didn't find way
to drop capitalization in current module from module itself. This module
is for external users, that is reason why pragma exists at all. I'll try
it again under debugger, may be today tonight, just to understand why it
doesn't work in such way.
Second, considering that I don't like all this jumping around method
naming, I see several ways to go.
1) Obsolete lower case naming for 2-3 releases with warning and then
drop it. Suggest capitalization.pm for users if they used lower case
variant and don't want rewrite.
2) Maintain aliases by hand. We even can write .t file that check that
all functions has alias. This .t would help to maintain and check that
you didn't forget to define alias for new sub.
I like both solutions. The worth solution is to implement
cpatilazation.pm into DBIx::SB because it slows down DBIx::SB startup, a
little, but slowdown and that's for user to decide if he want lower case
methods and want to pay some CPU cycles for it.
Third, this module/pragma has a little bug and doesn't work well with
subs like _Accessible, because of using 'lcfirst' on return code path
while converting name from upper to lower case. It requires some fixing.
This is what I think. DBIx::SB requires consistent, stable and
documented API, that's all.
--
Regards, Ruslan.
>
>
>>>--
>>>Best regards, Ruslan.
>>>
>>>
>>>
>
>
>
>>==== Patch <-> level 1
>>Source: [No source]
>>Target: fac90757-c5f0-0310-a953-bfb799f65e4e:/DBIx-SearchBuilder/local:242
>>Log:
>>naming cleanup in record.pm and docs
>>=== META.yml
>>==================================================================
>>--- META.yml (revision 242)
>>+++ META.yml (patch - level 1)
>>@@ -1,5 +1,5 @@
>> name: DBIx-SearchBuilder
>>-version: 1.25
>>+version: 1.26
>> license: perl
>> distribution_type: module
>> build_requires:
>>=== SearchBuilder/Record.pm
>>==================================================================
>>--- SearchBuilder/Record.pm (revision 242)
>>+++ SearchBuilder/Record.pm (patch - level 1)
>>@@ -336,7 +336,10 @@
>> this HowTo to discuss using container classes, overloading, and what
>> ever else I think of.
>>
>>+=head1 METHODS NAMING
>>
>>+All documented methods has lower case aliases, '_' is used to distinguish words.
>>+For example method C<_PrimaryKeys> has alias C<_primary_keys>.
>>
>> =head1 METHODS
>>
>>@@ -362,7 +365,7 @@
>> $self->_Init(@_);
>>
>> return $self;
>>- }
>>+}
>>
>> # }}}
>>
>>@@ -376,7 +379,6 @@
>>
>>
>> *Id = \&id;
>>-
>> sub id {
>> my $pkey = $_[0]->_PrimaryKey();
>> $_[0]->{'values'}->{$pkey};
>>@@ -384,8 +386,6 @@
>>
>> # }}}
>>
>>-=head2 primary_keys
>>-
>> =head2 PrimaryKeys
>>
>> Return a hash of the values of our primary keys for this function.
>>@@ -521,6 +521,7 @@
>>
>> =cut
>>
>>+*_primary_keys = \&_PrimaryKeys;
>> sub _PrimaryKeys {
>> my $self = shift;
>> return ['id'];
>>@@ -557,6 +558,7 @@
>> # XXX This is stub code to deal with the old way we used to do _Accessible
>> # It should never be called by modern code
>>
>>+*_class_accessible = \&_ClassAccessible;
>> sub _ClassAccessible {
>> my $self = shift;
>> my %accessible;
>>@@ -577,6 +579,7 @@
>>
>> =cut
>>
>>+*readable_attributes = \&ReadableAttributes;
>> sub ReadableAttributes {
>> my $self = shift;
>> my $ca = $self->_ClassAccessible();
>>@@ -594,6 +597,7 @@
>>
>> =cut
>>
>>+*writable_attributes = \&WritableAttributes;
>> sub WritableAttributes {
>> my $self = shift;
>> my $ca = $self->_ClassAccessible();
>>@@ -819,6 +823,7 @@
>>
>> =cut
>>
>>+*truncate_value = \&TrancateValue;
>> sub TruncateValue {
>> my $self = shift;
>> my $key = shift;
>>@@ -877,6 +882,7 @@
>>
>> =cut
>>
>>+*_object = \&_Object;
>> sub _Object {
>> my $self = shift;
>> return $self->__Object(@_);
>>@@ -945,7 +951,6 @@
>> =cut
>>
>> *load_by_col = \&LoadByCol;
>>-
>> sub LoadByCol {
>> my $self = shift;
>> my $col = shift;
>>@@ -1035,7 +1040,6 @@
>> =cut
>>
>> *load_by_primary_keys = \&LoadByPrimaryKeys;
>>-
>> sub LoadByPrimaryKeys {
>> my ($self, $data) = @_;
>>
>>@@ -1064,7 +1068,6 @@
>> =cut
>>
>> *load_from_hash = \&LoadFromHash;
>>-
>> sub LoadFromHash {
>> my $self = shift;
>> my $hashref = shift;
>>@@ -1088,8 +1091,6 @@
>> =cut
>>
>> *load_from_sql = \&LoadFromSQL;
>>-
>>-
>> sub _LoadFromSQL {
>> my $self = shift;
>> my $QueryString = shift;
>>@@ -1144,7 +1145,6 @@
>> =cut
>>
>> *create = \&Create;
>>-
>> sub Create {
>> my $self = shift;
>> my %attribs = @_;
>>@@ -1185,7 +1185,6 @@
>> =cut
>>
>> *delete = \&Delete;
>>-
>> sub Delete {
>> $_[0]->__Delete;
>> }
>>@@ -1256,7 +1255,7 @@
>> $self->{'DBIxHandle'} = shift;
>> }
>> return ($self->{'DBIxHandle'});
>>- }
>>+}
>>
>> # }}}
>>
>>
>>==== BEGIN SVK PATCH BLOCK ====
>>Version: svk 0.29 (linux)
>>
>>eJyFU99rHFUUvuJudrsGi0FEEGFjJkEWtpk7d37dGJZN2qxUbaxm9cXa7Z1772QHJzvr7GxIzFW4
>>0xqioeCb+ANEn+2LD0r9CwpJmzd91YfiLwhq1WfvzDaQiijzMNxzvu873zmc04rbTzWhaDR0oUFd
>>rLz87NzceZLQ7rR6abbgLEiiWLNEyNd5qCERRquaKXpkjatsQuJVnjQaUJHdEXkpJxyJmJmGR5Ko
>>N9BwLtZJYs41KMymJZqGaCJFFVAloz7vdeIoSlQRwzRUrpM5omE04J2MqaCKo9DGEdoPQq654txS
>>e+HU5lqYC43IOQ5p0BwBWRBzqmxtahCJFU5i2l0cBiHj8TEOygpadwseYwiY+bRGWdLvh5udhG8k
>>jIcJyd0gQ9gYEQNy34fM1LH6OZaOmGdD6mCXYahBrMazDEA6mU6W7psGEsitGbtpHm8yb+euINFd
>>aHGCPOxz03CgS2xi6NT1kW47jJojS9kc7xmG8Y/2Zl/kNIrZqf5aPo//aRT9Z6Nm5gsR3WLUdSiz
>>dN1wdWgwzBDGjDDkO56voWzCWafyly15+GpangJ7HDy4t1qQ4XbxeksWrz8iy+++XpT7j459Pxz7
>>aPry2PsrhY9fKXz1WvmwlBbkNzNXCvI9s7B9cfwTqyR343T8h1lZlB+2lvafOLPfGT+Yki/seUCu
>>7Q3BxZsMXLp1GnxQPHDlhLxRVdjS7XmwXfpxMS3KL+cfuj15cmchC6Vbh8uy/PuT8oG33yzInyoT
>>vz7eOmAg7f52Tpb/fPj8ndrEnaks8vnzf2B5Qn72RuWvjcsVuYuz4O5b8tPx9IT8op2W5LVc8Opz
>>8tpJcDWQX18AV+6XN1ogDeX+M2AHyQMX7AzltyF4x5HfKauX5M+PnV1+ulJZoJyEQTAYBoPu6flG
>>o1brqK/Wjkmtc2HmX/chnzun0CIcY2y4jsMt7GHTRr7t6Q41CXbgaI/t7DCD3mqVhpz0hv1q0KvG
>>RxtQJT1WZREdKGy90TCEZhijm23nZzw391IvWOfxgITTtlBH3idJV61MzNfVYzgMmGZYYvbM4tmN
>>+r1LFkaUhKPlyjz4hGLdsZw6tXy9riOo1wm2UN3zPQdj37a4yf8GABR/sQ==
>>==== END SVK PATCH BLOCK ====
>>
>>
>
>
>
>>_______________________________________________
>>Rt-devel mailing list
>>Rt-devel at lists.bestpractical.com
>>http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
>>
>>
>
>
>
>
More information about the Rt-devel
mailing list