Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

object::signature(3pm) [debian man page]

Object::Signature(3pm)					User Contributed Perl Documentation				    Object::Signature(3pm)

NAME
Object::Signature - Generate cryptographic signatures for objects SYNOPSIS
# In your module package My::Module use base 'Object::Signature'; # In outside code my $Object = My::Module->new; print "Object Signature: " . $Object->signature; DESCRIPTION
Object::Signature is an abstract base class that you can inherit from in order to allow your objects to generate unique cryptographic signatures. The method used to generate the signature is based on Storable and Digest::MD5. The object is fed to "Storable::nfreeze" to get a string, which is then passed to Digest::MD5::md5_hex to get a unique 32 character hexidecimal signature. METHODS
signature The "signature" method is the only method added to your class, and will generate a unique 32 hexidecimal signature for any object it is called on. SUPPORT
All bugs should be filed via the bug tracker at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Object-Signature <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Object-Signature> For other issues, or commercial enhancement or support, contact the author. TO DO
Incremental Generation Currently has to generate the entire Storable string before digesting it. Would be nice if there was a way to incrementally Storablise and Digest in one pass so that it becomes much more memory efficient for large objects. Strengthen the Digest Algorithm Once the current (as of 2005) hashing controversy settles down, consider selecting a newer and more powerful hashing algorithm to replace MD5. Or offer alternatives depending on how important the security situation is, as MD5 is very fast (90 meg a second) and many more-secure ones are a lot slower (more than 10 times slower in some cases). On our side is the fact we use Storable. It should be much harder to create collisions when you don't control the string, only the structure before it goes through Storable. AUTHOR
Adam Kennedy <adamk@cpan.org> SEE ALSO
Object::Signature::File, <http://ali.as/> COPYRIGHT
Copyright 2004 - 2011 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.12.3 2011-03-24 Object::Signature(3pm)

Check Out this Related Man Page

Test::Object(3) 					User Contributed Perl Documentation					   Test::Object(3)

NAME
Test::Object - Thoroughly testing objects via registered handlers SYNOPSIS
################################################################### # In your test module, register test handlers again class names # ################################################################### package My::ModuleTester; use Test::More; use Test::Object; # Foo::Bar is a subclass of Foo Test::Object->register( class => 'Foo', tests => 5, code => &foo_ok, ); Test::Object->register( class => 'Foo::Bar', # No fixed number of tests code => &foobar_ok, ); sub foo_ok { my $object = shift; ok( $object->foo, '->foo returns true' ); } sub foobar_ok { my $object = shift; is( $object->foo, 'bar', '->foo returns "bar"' ); } 1; ################################################################### # In test script, test object against all registered classes # ################################################################### #!/usr/bin/perl -w use Test::More 'no_plan'; use Test::Object; use My::ModuleTester; my $object = Foo::Bar->new; isa_ok( $object, 'Foo::Bar' ); object_ok( $object ); DESCRIPTION
In situations where you have deep trees of classes, there is a common situation in which you test a module 4 or 5 subclasses down, which should follow the correct behaviour of not just the subclass, but of all the parent classes. This should be done to ensure that the implementation of a subclass has not somehow "broken" the object's behaviour in a more general sense. "Test::Object" is a testing package designed to allow you to easily test what you believe is a valid object against the expected behaviour of all of the classes in its inheritance tree in one single call. To do this, you "register" tests (in the form of CODE or function references) with "Test::Object", with each test associated with a particular class. When you call "object_ok" in your test script, "Test::Object" will check the object against all registered tests. For each class that your object responds to "$object->isa($class)" for, the appropriate testing function will be called. Doing it this way allows adapter objects and other things that respond to "isa" differently that the default to still be tested against the classes that it is advertising itself as correctly. This also means that more than one test might be "counted" for each call to "object_ok". You should account for this correctly in your expected test count. SUPPORT
Bugs should be submitted via the CPAN bug tracker, located at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Object> For other issues, contact the author. AUTHOR
Adam Kennedy <cpan@ali.as> SEE ALSO
<http://ali.as/>, Test::More, Test::Builder::Tester, Test::Class COPYRIGHT
Copyright 2005, 2006 Adam Kennedy. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.18.2 2006-09-06 Test::Object(3)
Man Page