The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

ScopeSession::Flyweight - Attach light-weight instance creation for ScopeSession

VERSION

Version 0.01

SYNOPSIS

work as factory

    use ScopeSession::Flyweight;
    my $flyweight
        = ScopeSession::Flyweight->acquire( q|Test::Object| => ( id => 10 ) );
    my $flyweight2
        = ScopeSession::Flyweight->acquire( q|Test::Object| => ( id => 10 ) );

work as role

    package Test::Object;
    use ScopeSession::Flyweight acquire => 1;
    sub identifier {
        my ( $class, %args ) = @_;
        return $args{id};
    }
    sub new {
        my ( $class, %args ) = @_;
        return bless {%args} => $class;
    }
    my $flyweight  = Test::Object->acquire( id => 10 );
    my $flyweight2 = Test::Object->acquire( id => 10 );

METHODS

acquire

get a same identifier instance

AUTHOR

Daichi Hiroki, <hirokidaichi<AT>gmail.com>

BUGS

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

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2009 Daichi Hiroki.

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

See http://dev.perl.org/licenses/ for more information.