孙海军 > Text-Naming-Convention > Text::Naming::Convention

Download:
Text-Naming-Convention-0.06.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.06   Source  

default_convention

get or set default convention, default is '_'. valid values are ( '_', '-', 'UpperCamelCase', 'lowerCamelCase' ). return the default convention.

default_keep_uppers

keep words of uppers or not, here uppers means all uppers like 'BAR', not 'bAr'. default value is true

naming

given a list of words, return the named string the last arg can be hashref that supplies option like: { convention => 'UpperCamelCase' }

renaming

given a name, renaming it with another convention. the last arg can be hashref that supplies option like: { convention => 'UpperCamelCase' }

return the renamed one.

if the convention is the same as the name, just return the name.

if without arguments and $_ is defined and it's not a reference, renaming $_

NAME ^

Text::Naming::Convention - Naming or Renaming( for identifiers, mostly )

VERSION ^

This document describes Text::Naming::Convention version 0.06

SYNOPSIS ^

    use Text::Naming::Convention qw/naming renaming/;
    my $name = naming( 'foo', 'bar', 'baz' ) # got foo_bar_baz
    $name = naming( 'foo', 'bar', 'baz',
            { convention => 'UpperCamelCase'} ); # got FooBarBaz
    my $new_name = renaming( 'FooBarBaz' ); # got foo_bar_baz
    $new_name = renaming( 'FooBarBaz',
            { convention => 'lowerCamelCase' } ); # got fooBarBaz

DESCRIPTION ^

This's a simple module for naming and renaming, mostly for identifiers or something like that.

I'm tired of writing renaming sub, so I chose to create this module, wish it can help you too :)

DEPENDENCIES ^

None.

INCOMPATIBILITIES ^

None reported.

BUGS AND LIMITATIONS ^

No bugs have been reported.

AUTHOR ^

sunnavy <sunnavy@bestpractical.com>

LICENCE AND COPYRIGHT ^

Copyright 2008-2009 Best Practical Solutions.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: