NAME

Tie::Anon - tie anonymous array, hash, etc. and return it

SYNOPSIS

use Tie::Anon qw(tiea);
use Tie::File;

for my $line (@{tiea('Tie::File', "hoge.dat")}) {
    print $line;
}

DESCRIPTION

When I feel extremely lazy, I don't want to write

my $tied_arrayref = do {
    tie my @a, "Tie::File", "hoge.dat";
    \@a;
};

With Tie::Anon, you can do the same by

my $tied_arrayref = tiea("Tie::File", "hoge.dat");

EXPORTABLE FUNCTIONS

None of these functions are exported by default. You must import them explicitly.

$tied_arrayref = tiea($class, @args)

Create an anonymous array-ref, tie that array to the $class with @args, and return it.

If tie() fails, it returns undef.

$tied_hashref = tieh($class, @args)

Create an anonymous hash-ref, tie that hash to the $class with @args, and return it.

If tie() fails, it returns undef.

$tied_scalarref = ties($class, @args)

Create an anonymous scalar-ref, tie that scalar to the $class with @args, and return it.

If tie() fails, it returns undef.

SEE ALSO

REPOSITORY

https://github.com/debug-ito/Tie-Anon

BUGS AND FEATURE REQUESTS

Please report bugs and feature requests to my Github issues https://github.com/debug-ito/Tie-Anon/issues.

Although I prefer Github, non-Github users can use CPAN RT https://rt.cpan.org/Public/Dist/Display.html?Name=Tie-Anon. Please send email to bug-Tie-Anon at rt.cpan.org to report bugs if you do not have CPAN RT account.

AUTHOR

Toshio Ito, <toshioito at cpan.org>

LICENSE AND COPYRIGHT

Copyright 2014 Toshio Ito.

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.