Jorge::Plugin::Md5 - Sample plugin to provide Md5 encoding of Jorge Params


Jorge documentation Contained in the Jorge distribution.

Index


Code Index:

NAME

Top

Jorge::Plugin::Md5 - Sample plugin to provide Md5 encoding of Jorge Params

VERSION

Top

Version 0.01

SYNOPSIS

Top

Imports the function encodeMd5 into Jorge::DBEntity namespace.

AUTHORS

Top

Mondongo, <mondongo at gmail.com> Did the important job and started this beauty.

Julian Porta, <julian.porta at gmail.com> took the code and tried to make it harder, better, faster, stronger.

BUGS

Top

Please report any bugs or feature requests to bug-jorge at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Jorge. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Jorge




You can also look for information at:

* Github Project Page

http://github.com/Porta/Jorge/tree/master

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Jorge

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Jorge

* CPAN Ratings

http://cpanratings.perl.org/d/Jorge

* Search CPAN

http://search.cpan.org/dist/Jorge/

ACKNOWLEDGEMENTS

Top

Mondongo <mondongo at gmail.com> For starting this.

COPYRIGHT & LICENSE

Top


Jorge documentation Contained in the Jorge distribution.
package Jorge::Plugin::Md5;

use Digest::MD5;
use vars qw($VERSION @EXPORT);

use warnings;
use strict;

@EXPORT = qw(
  encodeMd5
);

our $VERSION = '0.01';

sub import {
    my $pkg     = shift;
    my $callpkg = caller;
    no strict 'refs';
    foreach my $sym (@EXPORT) {
        *{"${callpkg}::$sym"} = \&{$sym};
    }
}

sub encodeMd5 {
    my $self   = shift;
    my @params = @_;

    my $md5 = Digest::MD5->new;

    foreach my $key (@params) {
        my $k = $self->{$key};
        $md5->add($k);
    }
    return substr( $md5->hexdigest, 0, 8 );
}

1;    # End of Jorge::::DB