| capitalization documentation | Contained in the capitalization distribution. |
capitalization - no capitalization on method names
use XML::DOM;
no capitalization 'XML::DOM';
my $parser = XML::DOM::Parser->new;
# no capitalization ..
my $nodes = $parser->get_elements_by_tag_name("Foo");
# this can be OK
my $nodes = $parser->getElementsByTagName("Foo");
capitalization.pm allows you to use familiar style on method naming.
_ and upper case sequence would be lower cased.
Example: fooBar would be foo_bar.FOOs would be foos, _Foo would be _foo.no capitalization __PACKAGE__;If you want use capitalization pragma in module and add lower case API in the module itself, then you should use pragma after all subs are defined.
Tatsuhiko Miyagawa <miyagawa@bulknews.net>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| capitalization documentation | Contained in the capitalization distribution. |
package capitalization; use strict; use vars qw($VERSION); $VERSION = 0.03; use Devel::Symdump; my %done; sub unimport { my($class, @mods) = @_; for my $mod (@mods) { next if $done{$mod}; my $file = mod2file($mod); require $file unless $INC{$file}; my $dump = Devel::Symdump->new($mod); for my $meth (map { s/^\Q$mod\E:://; $_ } $dump->functions) { my $new = nocap($meth); if ($new ne $meth) { no strict 'refs'; *{"$mod\::$new"} = \&{"$mod\::$meth"}; } } $done{$mod} = 1; } } sub nocap { my $method = shift; $method =~ s/(?<=[a-z])([A-Z]+)/"_" . lc($1)/eg; $method =~ tr/A-Z/a-z/; return $method; } sub mod2file { my $mod = shift; $mod =~ s!::!/!g; return "$mod.pm"; } 1; __END__