Changeset 1560

Show
Ignore:
Timestamp:
05/06/05 03:02:49
Author:
miyagawa
Message:

0.03

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • capitalization/trunk/Changes

    r836 r1560  
    11Revision history for Perl extension capitalization 
     2 
     30.03  Fri May  6 03:02:10 JST 2005 
     4        * Added support for ALUPPERCASE methods and documentation 
     5          (Thanks to Ruslan U. Zakirov) 
     6 
     70.02  Fri May  6 01:08:10 JST 2005 
     8        - Now _Bar() is callable by _bar() 
     9          (Thanks to Ruslan U. Zakirov) 
    210 
    3110.01  Thu Feb  7 07:28:31 2002 
  • capitalization/trunk/MANIFEST

    r836 r1560  
    66t/01_capital.t 
    77t/lib/Module/LikeJava.pm 
     8META.yml                                 Module meta-data (added by MakeMaker) 
  • capitalization/trunk/capitalization.pm

    r836 r1560  
    33use strict; 
    44use vars qw($VERSION); 
    5 $VERSION = 0.01
     5$VERSION = 0.03
    66 
    77use Devel::Symdump; 
     
    3232    my $method = shift; 
    3333    $method =~ s/(?<=[a-z])([A-Z]+)/"_" . lc($1)/eg; 
    34     lcfirst $method; 
     34    $method =~ tr/A-Z/a-z/; 
     35    return $method; 
    3536} 
    3637 
     
    6667capitalization.pm allows you to use familiar style on method naming. 
    6768 
     69=head1 RULES 
     70 
     71=over 1 
     72 
     73=item Lower case character followed by upper case sequence would be 
     74splitted with C<_> and upper case sequence would be lower cased. 
     75Example: C<fooBar> would be C<foo_bar>. 
     76 
     77=item All other upper case characters would be lower cased. 
     78Examples: C<FOOs> would be C<foos>, C<_Foo> would be C<_foo>. 
     79 
     80=back 
     81 
     82=head1 CAVEATS 
     83 
     84=head2 C<no capitalization __PACKAGE__;> 
     85 
     86If you want use capitalization pragma in module and add lower case 
     87API in the module itself, then you should use pragma after all subs 
     88are defined. 
     89 
    6890=head1 AUTHOR 
    6991 
  • capitalization/trunk/t/01_capital.t

    r836 r1560  
    11use strict; 
    2 use Test::More tests => 1
     2use Test::More tests => 2
    33 
    44use lib qw(t/lib); 
     
    66 
    77my $m = Module::LikeJava->new; 
    8 can_ok $m, qw(foo_and_bar bar_and_baz fooAndBar BarAndBAZ); 
     8can_ok $m, qw(fooAndBar   BarAndBAZ   _Bar FOO FOObar); 
     9can_ok $m, qw(foo_and_bar bar_and_baz _bar foo foobar); 
    910 
    1011 
  • capitalization/trunk/t/lib/Module/LikeJava.pm

    r836 r1560  
    88sub BarAndBAZ { } 
    99 
     10sub _Bar { } 
     11 
     12sub _Bar { } 
     13 
     14sub FOO { } 
     15 
     16sub FOObar { } 
     17 
    10181;