Acme-Pano-Util

 view release on metacpan or  search on metacpan

lib/Acme/Pano/Util.pm  view on Meta::CPAN



=head1 SYNOPSIS

This module provides various random utilities that Pano Papadatos made.

=head1 EXPORT

toBareword - Converts any string to a string with only letters, underscores and numbers that does not start with a number (bareword)

fromBareword - Converts a string that was returned using toBareword back to its original form

=head1 SUBROUTINES/METHODS

=head2 toBareword

Usage: converts any string to a string with only letters, underscores and numbers that does not start with a number (bareword)

Arguments: (0) the string to convert

Returns: the converted string

lib/Acme/Pano/Util.pm  view on Meta::CPAN

    return if(!defined($string));
    $string =~ s/_/__/g;
    $string =~ s/0/00/g;
    $string =~ s/([0-9]+)/_$1/g;
    $string =~ s/([^a-zA-Z0-9_]+)/join('',map {'_0_'.ord($_)} split('',$1))/eg;
    return $string;
}

=head2 fromBareword

Usage: converts any string that was returned using "toBareword" back to its original form

Arguments: (0) the string to convert

Returns: the converted string

=cut

sub fromBareword{
    my ($string) = @_;
    return if(!defined($string));



( run in 1.170 second using v1.01-cache-2.11-cpan-1c8d708658b )