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

NAME

Package::Package - Name-of-package - short description of package

VERSION

Version 0.01

SYNOPSIS

Package::Package

long

description

of package

Usage

For example

    use Package::Package;
    my $Package = Package::Package->new();
    $package->do_something();

Is about the least code needed to do something useful

Usage

For example:

    use Package::Package;
    my $Package = Package::Package->new();
    $package->do_something();
    $package->do_something_else();
    $package->do_something_more();
    $package->do_something_other();

Introduces all the main options

SUBROUTINES/METHODS

new( local_port_num, remote_ip_address, remote_port_num, forward_translate_callback, back_translate_callback )

Creates a new mediator

Parameters

  • local_port_num - the port number to listen on

  • remote_ip_address, remote_port_number - the server to connect to

  • forward/back translate_callback - a function to do translations

  • Returns - the mediator object

Usage

For example:

    use Net::Mediator;
    my %forward_translations = (
      'a=(?<a>.+?),b=(?<b>.+?),c=(?<c>.+?);' => '<a>$+{a}</a><b>$+{b}</b><c>$+{c}</c>',
      );
    my %back_translations = (
      '<(.)>(.*?)</\1><(.)>(.*?)</\3><(.)>(.*?)</\5>' => '$1=$2,$3=$4,$5=$6;'
      );
    my $forward_translator = Net::Mediator->new_translator(\%forward_translations);
    my $back_translator = Net::Mediator->new_translator(\%back_translations);
    my $forward_translate = sub{$translator->translate(@_)};
    my $back_translate = sub{$translator->translate(@_)};
    my $mediator = Net::Mediator->new($remote_host,$remote_port,$local_port,$forward_translate,$back_translate);
    $mediator->go();

new_translator( translations )

Creates a new translator for the given translations.

It should not normally be necessary to call these methods directly.

Parameters

  • translations - a hash table of from/to translations. Each 'from' should be a string which will be used as a regular expression. Each 'to' should be a string, which may rely on the regular expression having matched.

  • Returns - a new translator. The translator only has one method, translate().

Usage

For example:

    my %translations = { 'hello' => 'hi there', '(?<key>.+?)=(?<value>.+?)' => '<$+{key}>$+{value}</$+key>' };
    my $translator = Net::Mediator->new_translator(\%translations);
    say $translator->translate('hello'); # prints "hello"
    say $translator->translate('a=b');   # prints "<a>b</a>"

Translations are tested in effectively random order, and translation stops after the first match. If there are no matches, undef is returned.

Exports

Package does not export any functions or variables.

AUTHOR

Ben AVELING, <ben dot aveling at optusnet dot com dot au>

BUGS

Please report any bugs or feature requests to bug-Net-MitM at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-MitM. 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 Package::Package

You can also look for information at:

ACKNOWLEDGEMENTS

I'd like to acknowledge someone I haven't acknowledge in any other package I've yet written.

ALTERNATIVES

Another Package, if any.

LICENSE AND COPYRIGHT

Copyleft 2013 Ben AVELING.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0

Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.

If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.

This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.

This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, have, hold and cherish, use, offer to use, sell, offer to sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.

Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SO THERE.