#!/usr/bin/perl
package RVL::Inflector;
##LICENSE##
use strict;
use warnings;
sub caseFix {
my ( $str, $force ) = @_;
my ($c) = RVL::Config::singleton();
my ($conf) = $c->getAll();
my (@aConfValues) = keys %{$conf};
my (@aConfValuesLowerCase) =
RVL::String::array_map( 'lc', @aConfValues );
my ($isFound) =
RVL::String::array_search( lc($str), @aConfValuesLowerCase );
return ( $isFound eq '' ) ? $str : $aConfValues[$isFound];
}
sub getManagerNameFromSimplifiedName {
my ($name) = shift;
# if Mgr suffix has been left out, append it
if ( lc( substr $name, -3 ) ne 'mgr' ) {
$name .= 'Mgr';
}
return RVL::Inflector::caseFix( ucfirst($name));
}
sub getSimplifiedNameFromManagerName {
my ($name) = shift;
# strip file extension if exists
if ( substr $name, -3 eq '.pm' ) {
$name = substr $name, 0, -3;
}
# strip 'Mgr' if exists
if ( lc( substr $name, -3 ) eq 'mgr' ) {
$name = substr $name, 0, -3;
}
return lc($name);
}
1;
Copyright 2K16 - 2K18 Indonesian Hacker Rulez