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

NAME

Egg::Plugin::Tools - Various function collections.

SYNOPSIS

  use Egg qw/ Tools /;

  $e->escape_html($html);
  
  $e->unescape_html($plain);
  
  $e->sha1_hex('abcdefg');
  
  $e->comma('12345.123');
  
  my @array= (1..100);
  $e->shuffle_array(\@array);

DESCRIPTION

This plugin offers the method of various functions.

METHODS

encode_entities ( [HTML_TEXT], [ARGS] )

The result of HTML::Entities::encode_entities is returned.

  • Alias: escape_html, eHTML

encode_entities_numeric ( [HTML_TEXT], [ARGS] )

The result of HTML::Entities::encode_entities_numeric is returned.

decode_entities ( [PLAIN_TEXT], [ARGS] )

The result of HTML::Entities::decode_entities is returned.

  • Alias: unescape_html, ueHTML

uri_escape ( [URI_PARTS], [ARGS] )

The result of URI::Escape::uri_escape is returned.

  • Alias: escape_uri, eURI

uri_escape_utf8 ( [URI_PARTS], [ARGS] )

The result of URI::Escape::uri_escape_utf8 is returned.

uri_unescape ( [URI], [ARGS] )

The result of URI::Escape::uri_unescape is returned.

  • Alias: unescape_uri, ueURI

call ( [PACKAGE_NAME], [METHOD_NAME], [ARGS] )

PACKAGE_NAME is read, and METHOD_NAME is called.

Please give PACKAGE_NAME the module name since the project name.

$e and ARGS are passed to METHOD_NAME.

  # MyApp::AnyPkg->call_method($e, ... args ); is done.
  my $result= $e->call( AnyPkg => 'call_method', .... args );

sha1_hex ( [DATA] )

The result of Digest::SHA1::sha1_hex is returned.

  • Alias: md5_hex

comma ( [NUMBER] )

Is put in given NUMBER in each treble and it returns it.

  $e->comma('123456')       =>    123,456
  $e->comma('-654321.123')  =>   -654,321.123
  $e->comma('+123456789.0') => +1,234,567.0

shuffle_array ( [ARRAY] )

It returns it mixing given ARRAY at random.

  my @array= (1..10);
  $e->shuffle_array(\@array);

* Quotation from perlfaq.

filefind ( [FIND_REGIX], [SEARCH_DIR_ARRAY] )

File::Find is done and the result is returned by the ARRAY reference.

  my $files= $e->filefind(qr{\.pm$}, qw( /usr/lib/perl5/... ))
          || return 0;

referer_check ([FLAG])

The request is own passing on the site or it checks it.

If the request method is POST and doesn't exist when FLAG is given, false is returned.

HTTP_REFERER cannot be acquired by the influence of the security software that those who inspect it use etc. When HTTP_REFERER cannot be acquired by there is often a thing, too, true is returned.

gettimeofday

The result of Time::HiRes::gettimeofday is returned.

  my($second, $micro)= $e->gettimeofday;

mkpath ( [DIR], [VERBOSE], [PERMISSION] )

File::Path::mkpath is done.

* The argument extends to File::Path::mkpath as it is.

  $e->mkpath('/home/hoge', 0, 0755);

rmtree ( [DIR_LIST] )

File::Path::rmtree is done.

* The argument extends to File::Path::rmtree as it is.

  $e->rmtree('/home/hoge', '/home/boo');

SEE ALSO

HTML::Entities, URI::Escape, Digest::SHA1, Time::HiRes, File::Path, Egg::Release,

AUTHOR

Masatoshi Mizuno <lushe@cpan.org>

COPYRIGHT

Copyright (C) 2007 by Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.