MooseX::GlobRef(3pm)

πŸ“¦
version 0.0701 Β· 2 versions
, in fedora 43

✨ 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 at Moose::Exporter for 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