Guillaume Aubert > Audit-DBI-1.6.0 > Audit::DBI::Utils

Download:
Audit-DBI-1.6.0.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: v1.6.0   Source   Latest Release: Audit-DBI-v1.8.2

NAME ^

Audit::DBI::Utils - Utilities for the Audit::DBI distribution.

VERSION ^

Version 1.6.0

SYNOPSIS ^

        use Audit::DBI::Utils;
        
        my $ip_address = Audit::DBI::Utils::integer_to_ipv4( $integer );
        
        my $integer = Audit::DBI::Utils::ipv4_to_integer( $ip_address );
        
        my $differences = Audit::DBI::Utils::diff_structures(
                $data_structure_1,
                $data_structure_2,
                comparison_function => sub { my ( $a, $b ) = @_; $a eq $b; }, #optional
        );

FUNCTIONS ^

stringify_data_structure()

        my $string = Audit::DBI::Utils::stringify_data_structure(
                data_structure             => $data_structure,
                object_stringification_map =>
                {
                        'Math::Currency' => 'as_float',
                },
        );

integer_to_ipv4()

Convert a 32-bits integer representing an IP address into its IPv4 form.

        my $ip_address = Audit::DBI::Utils::integer_to_ipv4( $integer );

ipv4_to_integer()

Convert an IPv4 address to a 32-bit integer.

        my $integer = Audit::DBI::Utils::ipv4_to_integer( $ip_address );

diff_structures()

Return the differences between the two data structures passed as parameter.

By default, if leaf nodes are compared with '==' if they are both numeric, and with 'eq' otherwise.

An optional comparison_function parameter can be used to specify a different comparison function.

        my $differences = Audit::DBI::Utils::diff_structures(
                $data_structure_1,
                $data_structure_2,
        );
        
        # Alternative built-in comparison function.
        # Leaf nodes are compared using 'eq'.
        my $diff = Audit::DBI::Utils::diff_structures(
                $data_structure_1,
                $data_structure_2,
                comparison_function => 'eq',
        );
        
        # Alternative custom comparison function.
        my $diff = Audit::DBI::Utils::diff_structures(
                $data_structure_1,
                $data_structure_2,
                comparison_function => sub
                {
                        my ( $variable_1, $variable2 ) = @_;
                        # [...]
                        return $is_equal;
                }
        );

AUTHOR ^

Guillaume Aubert, <aubertg at cpan.org>.

BUGS ^

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

SUPPORT ^

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

    perldoc Audit::DBI::Utils

You can also look for information at:

ACKNOWLEDGEMENTS ^

Thanks to ThinkGeek (http://www.thinkgeek.com/) and its corporate overlords at Geeknet (http://www.geek.net/), for footing the bill while I write code for them!

COPYRIGHT & LICENSE ^

Copyright 2012 Guillaume Aubert.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/

syntax highlighting: