NAME
MooseX::GlobRef::Meta::Instance - Instance metaclass for globref objects
SYNOPSIS
package My::IO;
use metaclass 'Moose::Meta::Class' => (
instance_metaclass => 'MooseX::GlobRef::Meta::Instance'
);
use Moose;
has 'file' => ( is => 'ro', isa => 'Str', required => 1 );
sub open {
my $fh = shift;
open $fh, $fh->file or confess "cannot open";
return $fh;
};
sub getlines {
my $fh = shift;
return readline $fh;
};
my $io = My::IO->new( file => '/etc/passwd' );
print "::::::::::::::\n";
print $io->file, "\n";
print "::::::::::::::\n";
$io->open;
print $io->getlines;
DESCRIPTION
This instance metaclass allows to store Moose object in glob reference of file handle. It can be used directly with metaclass pragma or with MooseX::GlobRef::Object base class.
Notice, that use metaclass
have to be before use Moose
.
INHERITANCE
extends Moose::Meta::Instance
extends Class::MOP::Instance
extends Class::MOP::Object
METHODS
- create_instance
- get_slot_value
- set_slot_value
- deinitialize_slot
- is_slot_initialized
- weaken_slot_value
- inline_create_instance
- inline_slot_access
-
The methods overridden by this class.
SEE ALSO
MooseX::GlobRef::Object, Moose::Meta::Instance, Moose, metaclass.
AUTHOR
Piotr Roszatycki <dexter@cpan.org>
LICENSE
Copyright (C) 2007, 2008, 2009 by Piotr Roszatycki <dexter@debian.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.