[Rt-devel] Re: [PATCH] DBIx::SB::Record.pm aliases cleanup and
docs [ver2]
Ruslan U. Zakirov
Ruslan.Zakirov at miet.ru
Thu May 12 09:54:36 EDT 2005
Jesse Vincent wrote:
> Ruslan U. Zakirov wrote:
>
>> Jesse Vincent wrote:
>>
>>>
>>>> Attach two solutions and three patches. Just for fun! :)
>>>>
>>>> 1) via capitalization.pm 0.03
>>>> nocap_via_pragma.patch
>>>> This patch has docs that should be added in any case.
>>>
>>>
>>>
>>>
>>> What do you think of doing this one, but with a "soft requirement" -- so
>>> that if the user doesn't have capitalization.pm, the module still runs,
>>> just inly in "CamelCase" mode?
>>>
>> No problems, here it is. Added feature to Makefile.PL, but looks like it
>> works nice only when auto_install is turned on :(
>
>
> Thanks. Applied
>
> I turned on auto_install in the Makefile.PL. Also, I reenabled a core
> mapping of Id -> id, since that's a pretty common idiom, even when
> you're using InterCapped style for the rest of the code.
>
>> If you want to add tests for nocap API then I can send you patch.
>
>
> It would not be a bad thing.
Attached.
--
Regards, Ruslan.
-------------- next part --------------
==== Patch <-> level 1
Source: [No source]
Target: fac90757-c5f0-0310-a953-bfb799f65e4e:/DBIx-SearchBuilder/local:1620
Log:
nocap API test
=== t/01nocap_api.t
==================================================================
--- t/01nocap_api.t (revision 1620)
+++ t/01nocap_api.t (patch - level 1)
@@ -0,0 +1,40 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use Test::More;
+BEGIN { require "t/utils.pl" }
+
+use vars qw(@SPEC_METHODS @MODULES);
+my @SPEC_METHODS = qw(AUTOLOAD DESTROY CLONE);
+my @MODULES = qw(DBIx::SearchBuilder DBIx::SearchBuilder::Record);
+
+if( not eval { require Devel::Symdump } ) {
+ plan skip_all => 'Devel::Symdump is not installed';
+} elsif( not eval { require capitalization } ) {
+ plan skip_all => 'capitalization pragma is not installed';
+} else {
+ plan tests => scalar @MODULES;
+}
+
+foreach my $mod( @MODULES ) {
+ eval "require $mod";
+ my $dump = Devel::Symdump->new($mod);
+ my @methods = ();
+ foreach my $method (map { s/^\Q$mod\E:://; $_ } $dump->functions) {
+ push @methods, $method;
+
+ my $nocap = nocap( $method );
+ push @methods, $nocap if $nocap ne $method;
+ }
+ can_ok( $mod, @methods );
+}
+
+sub nocap
+{
+ my $method = shift;
+ return $method if grep( { $_ eq $method } @SPEC_METHODS );
+ $method =~ s/(?<=[a-z])([A-Z]+)/"_" . lc($1)/eg;
+ return lc($method);
+}
+
==== BEGIN SVK PATCH BLOCK ====
Version: svk 1.0_01 (linux)
eJx1VF1v40QU7RNS/LASlWAlhMSQ9dJErOvYifPhkJB0bbfptk13k7LqbltrYo8bqxPbtcf92Dog
O05WoAWBBIg3XhBC+ysZp0VaHvZpdO8958zMnXtG84fNjhC126WIFUrR4JsnsrwPiTF+SCO2GiHT
Jq7PShFGFwiz5Qi7p2wlcuAE0SqB/iki7bZAyfVbsrok/CdSyTRGkLhOwDaWYjrxEWKFqNypRB0x
6pQpNRJo0fWQo/uuS6i8UBVLtKhnRzKwGyA9o2ZwKYOLrFC5xZu2jwy63zXNkqXQHbmckaU78rso
IVOpZiplth5B09QtG6MMS/iS4LgG9HTo2euZmqizYsQJ7xcTb4+0rELPw9c6QVfERJjAbAOdrdYl
2pa9lZWV171Yn238qa2+1Vb/2juOlcPfN4NNrMUf/DqIq388qf7TT1YSNca/PI/tn14k9/qJtThM
qnEvWZ0ryYNFL177bTteU5MP1fg83mooMydVZmdqwsT9+LsFDWMt/eiNkjZ3Z4aaKj/SzBst/WSh
JF5MWfNe2o230qOFmt5PlfQzdd6Ie+kRxT+d39fmjWRrbsRKem9rXvxemWuzbQpXZyczbd5JtPTj
zfTk595C+EFJo4Sucf+KMnsL8e/tRVd5/YU2v9YWnz74nA8Dnx/ZDu8hHwPukmHCAIGA+LZBmkMU
EFnedX3UZDbUzd4euAE+Og9pR0Ge8CGxcbDu4TyYXkA/AOeXhc5gX32s76rDrb4yAJ3dvnKwow6K
TWZyDVrdg2F/p99VgKIOhs/6h+DxTn9PVTZ6V7I8QNA3xhuhjU3kA1l+hgzXNymRsa0CcFwC0AXE
SjbUFHw9McOJB6agCG6YnIehA4Izmw4CxqDVBmt2YDsBoREy15rMFCAc0DmxacZ+BYntOp4PTycQ
EXrBgJYw9CmMYSx6VWiMAT0tO3HNQj7fZHItru2gy0KxM0Fk7JoBaIECKEygR7sR8CdHT49UWeb5
JmB1MOXaVugYQc4Lg/EjSs4xuWxGC7blTJmcAR3dPXPNR8UgHDE3LRCMbYtQmI9I6Du2BU595BXA
DTqffkvFC19/1XoJuVfHxcLLLvfi+Msin9fzYB1go8AKRR6dUle+47pba1CnlMWoJpUMQxLq0Kij
UnVUH0ETigKsN2DNEMo1c+k+6sulhUB3vweybtAs126LESuKt//DcPllyPKBY18gP4D4ITVjJfIg
GdPfxUcXNAhD22RFKeKzt+T+95Q8pvL4zuVsuRpZ0GiUalKNMySrxJXKQomDDanMjaxRrdGwqhKq
oH8BqcyetA==
==== END SVK PATCH BLOCK ====
More information about the Rt-devel
mailing list