1MooseX::GlobRef::Role::UOsbejrecCto(n3t)ributed Perl DocMuomoesnetXa:t:iGolnobRef::Role::Object(3)
2
3
4

NAME

6       MooseX::GlobRef::Role::Object - An object role for MooseX::GlobRef
7

SYNOPSIS

9         Moose::Util::MetaRole::apply_base_class_roles(
10             for_class => $caller,
11             roles => [ 'MooseX::GlobRef::Role::Object' ],
12         );
13
14         package My::IO::File;
15
16         use Moose;
17
18         extends 'Moose::Object', 'IO::File';
19         with 'MooseX::GlobRef::Role::Object';
20
21         has 'file' => ( is => 'ro', isa => 'Str', required => 1 );
22         has 'mode' => ( is => 'ro', isa => 'Str', default => 'r' );
23
24         sub BUILD {
25             my ($fh) = @_;
26             $fh->open( $fh->file, $fh->mode );
27         };
28
29         sub slurp {
30           my ($fh) = @_;
31           local $/ = undef;
32           return $fh->getline;
33         };
34
35         my $io = My::IO::File->new( file => '/etc/passwd' );
36         print "::::::::::::::\n";
37         print $io->file, "\n";
38         print "::::::::::::::\n";
39         print $io->slurp;
40

DESCRIPTION

42       This is a role for Moose::Object which is applied by MooseX::GlobRef.
43       It allows to store Moose object in glob reference of file handle.
44
45       The MooseX::GlobRef package should be used instead for Moose classes
46       but the "MooseX::GlobRef::Role::Object" can be helpful if you want to
47       extend non-Moose classes like IO::File or File::Temp.
48

METHODS

50       <<around>> dump( maxdepth : Int = 1 ) : Array|Str
51           Dumps the object itself and also a hash slot of glob reference of
52           this object.  It returns an array or string depended on context.
53
54           See Moose::Object.
55

SEE ALSO

57       MooseX::GlobRef, Moose::Object, Moose::Role.
58

AUTHOR

60       Piotr Roszatycki <dexter@cpan.org>
61

LICENSE

63       Copyright (c) 2007, 2008, 2009, 2010 Piotr Roszatycki
64       <dexter@cpan.org>.
65
66       This is free software; you can redistribute it and/or modify it under
67       the same terms as perl itself.
68
69       See <http://dev.perl.org/licenses/artistic.html>
70
71
72
73perl v5.36.0                      2022-07-22  MooseX::GlobRef::Role::Object(3)
Impressum