Toby Inkster > Acme-Constructor-Pythonic-0.002 > Acme::Constructor::Pythonic

Download:
Acme-Constructor-Pythonic-0.002.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.002   Source  

NAME ^

Acme::Constructor::Pythonic - import Python-style constructor functions

SYNOPSIS ^

    use Acme::Constructor::Pythonic qw(
        LWP::UserAgent
        JSON
        HTTP::Request
    );
    
    my $json = JSON();
    my $ua   = UserAgent();
    my $req  = Request( GET => 'http://www.example.com/foo.json' );
    
    my $data = $json->decode( $ua->request($req)->content )

DESCRIPTION ^

In Python you import classes like this:

    import BankAccount from banking

And you instantiate them with something looking like a function call:

    acct = BankAccount(9.99)

This module allows Python-like object instantiation in Perl. The example in the SYNOPSIS creates three functions UserAgent, JSON and <Request> each of which just pass through their arguments to the real object constructors.

Options

Each argument to the Acme::Constructor::Pythonic is a Perl module name and may be followed by a hashref of options:

    use Acme::Constructor::Pythonic
        'A::Module',
        'Another::Module' => \%some_options,
        'Yes::Another::Module',
    ;

BUGS ^

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Acme-Constructor-Pythonic.

SEE ALSO ^

aliased.

AUTHOR ^

Toby Inkster <tobyink@cpan.org>.

(Though it was SSCAFFIDI's idea.)

COPYRIGHT AND LICENCE ^

This software is copyright (c) 2012, 2014 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTIES ^

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

syntax highlighting: