The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Myco::Util::Strings - a Myco entity class

SYNOPSIS

  use Myco::Util::Strings;

DESCRIPTION

A simple shell to store oft-used string-manipulation routines.

ADDED CLASS METHODS

pretty_print

  my $attribute_label = Myco::Util::Strings->pretty_print('person_last_name');
  my $do_these_words_match = $attribute_label eq 'Person Last Name';

Attempts to prettify any string.

get_last_uri_word

  my $title = Myco::Util::Strings->get_last_uri_word('/o/person/search/');
  my $nice_uri_last_word = $title eq 'Search';

Attempts to prettify and return the last word in a base uri.

js_dumper

  my %hash = ( a => 1, b => 2, c => 3 );
  my $javascript_hash = Myco::Util::Strings->get_javascript(\%hash);
  my $hashes_match = $javascript_hash eq "{ 'a' : 1, 'b' : 2, 'c' : 3 }";

Makes use of Data::Dumper to stringify a Perl data structure and format it for use as a javascript data structure.

classname

  my $strfmt = Myco::Util::Strings->new;
  my $abbr = $strfmt->get_abbr_classname('Myco::Animal::GiantSquid');
  my $isa_squid = $abbr eq 'Giant Squid';

Parses out a nice class name.

rand_str

  my $strfmt = Myco::Util::Strings->new;
  my $random_string = $strfmt->rand_str(6); # like 13d0vr

Generates a psudo-random alphanumeric string of n-length.

ssha_crypt

  my $password = Myco::Util::Strings->ssha_crypt('hush-hush', $salt);

Encrypt a string using the SSHA (Secure Salted Hash Algorithm). Salt is optional, and will be generated in its absence.

LICENSE AND COPYRIGHT

Copyright (c) 2006 the myco project. All rights reserved. This software is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Myco::Util::Strings::Test, Myco::Entity, Myco, Tangram, Class::Tangram, myco-mkentity