MooseX::GlobRef(3pm)
β¨ MooseX::GlobRef β¨
okay so bestie, this is a page from the User Contributed Perl Documentation and it's literally about MooseX::GlobRef π
π NAME π
MooseX::GlobRef β store a Moose object in a glob reference. yes. in a glob. iykyk π
πΈ SYNOPSIS πΈ
package My::IO;
use Moose;
use MooseX::GlobRef;
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;
like look at that. she's a Moose class AND a filehandle. main character energy fr fr π
π DESCRIPTION π
okay so here's the whole vibe: this module lets you stash a Moose object inside the glob reference of a file handle. π¦
the class attributes get stored in the hash slot that's associated with that glob reference. and why do we care?? because it means you can build a whole Moose version of IO::Handle β¨ slay.
you can get at the attributes directly with this expression:
my $hashref = \%{*$self};
print $hashref->{key};
or the shorter version, if you're feeling lazy (same):
print *$self->{key};
but ngl bestie, use the standard accessors instead, they're right there:
print $self->key;
π no cap: those raw glob-hash pokes are giving "i know what i'm doing" energy. the accessors are the move.
π«Ά METHODS π«Ά
init_meta( args : Hash ) : Moose::Meta::Classβ go peek atMoose::Exporterfor the deets on this one π
π SEE ALSO π
<http://github.com/dex4er/perl-MooseX-GlobRef>, and also Moose. π¦
π AUTHOR π
Piotr Roszatycki <dexter@cpan.org> π the icon who built this.
β LICENSE β
Copyright (c) 2007, 2008, 2009, 2010 Piotr Roszatycki <dexter@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as perl itself.
See <http://dev.perl.org/licenses/artistic.html>
okay that's the whole page, bestie π and for the cute sign-off: this one's riding along with perl v5.42.0, dated 2025-07-25, and it says MooseX::GlobRef(3pm) at the top and bottom of the original β iconic, obsessed, periodt π
β¨πΈ
π¦ where this page comes from
- fedora 43: perl-MooseX-GlobRef 0.0701-41.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms