Questions tagged [moo]

Moo is a minimal object-oriented programming library for the Perl programming language.

Moo is a minimal object-oriented programming library for the Perl programming language.

  • For the similarly named Java object-object mapping tool, see object-object-mapping.
  • For the the CodeIgniter plugin image-moo, see codeigniter.
  • For object-oriented MUD programming, see mud.
  • For the MooTools Javascript framework, see mootools.
56 questions
1
vote
2 answers

How do I mock a method defined in a Moo Role?

Given the following Role: package MyRole; use Moo::Role; sub foo { return 'blah'; } And the following consuming class: package MyClass; use Moo; with 'MyRole'; around foo = sub { my ($orig, $self) = @_; return 'bak' if $self->$orig…
Aurelia Peters
  • 2,169
  • 1
  • 20
  • 34
1
vote
1 answer

using a subroutine in the new() method using perl Moo

My question is the following: I want to use a subroutine to construct an array when I call the new() method to create an object using perl Moo. Please see the following example. package Customer; use DBI; use 5.010; use Data::Dumper; use Moo; use…
the_ccalderon
  • 2,006
  • 2
  • 13
  • 24
1
vote
1 answer

Is it possible to make an attribute configuration dependent on another attribute in Moo?

I have read various tutorials and the Moo documentation but I cannot find anything that describes what I want to do. What I want to do is something like the following: has 'status' => ( is => 'ro', isa => Enum[qw(pending waiting…
harleypig
  • 1,264
  • 8
  • 25
1
vote
1 answer

Moo: Attempt to reload Role aborted

I have a module which use a number of (stand-alone) modules, and all those modules have the same attribute (a handle to a localization object). Instead of adding that attribute to all classes, I moved that attribute to a Role, which is then consumed…
PerC
  • 429
  • 3
  • 11
0
votes
1 answer

understanding nearley with moo resulting datastructure

I have this grammar: let lexer = moo.compile({ comment: { match: /[\/\/.*?$|][^\n]+/, value: (s:string) => s.slice(1).trim() }, newline: { match: /[\n]+/, lineBreaks: true } }); %} @lexer lexer main -> element | main %newline…
sveri
  • 1,372
  • 1
  • 13
  • 28
0
votes
1 answer

Image_moo & CodeIgniter framework won't generate thumbnails

Attempting to generate thumbnails with Image_moo & CodeIgniter framework. Image_moo does not output any errors, however, thumbnail images are never generated. dir structure app - controllers/ Admin.php ... - libraries/ …
0
votes
1 answer

roles and code readability

The improvement of using roles (Moo::Role or Role::Tiny or whatever) with qw( Some::Role Some::Other::Role ); ... some_roles_method(); over just explicitly importing the function from the mixin class use Some::Role…
Kevin G.
  • 1,424
  • 1
  • 13
  • 22
0
votes
1 answer

Changing writer prefix when (is => “rwp”)

If I want to change write protected attribute ie. use Moops; class foo { has attr => (is => "rwp"); } one have to use _set_attr(). Is it possible to change that to _attr() without using explicit writer? Tried use MooseX::::AttributeShortcuts…
mpapec
  • 50,217
  • 8
  • 67
  • 127
0
votes
1 answer

Moo handles => 'Role' not working

For the life of me I can't figure out why this is not working the way the documentation says it should. I have Googled the problem SO searched, looked at the source, etc. Is this a bug or am I doing something wrong that I just can't see. Here is the…
jshy
  • 111
  • 6
0
votes
2 answers

Can't locate Moo.pm in @INC

I am trying to run a .pm program in dzsoft perl editor. but i got this error Can't locate Moo.pm in @INC (@INC contains: C:\Users\123\Desktop\ C:/Perl64/site/lib C:/Perl64/lib .) at UniNE.pm line 5. My interpertor is…
user3496654
  • 101
  • 1
  • 3
  • 12
0
votes
1 answer

Wrapping Web Services with Moo

I recently took over the maintenance of a Perl client that wraps a Shipping web service. The project in its initial state uses Moo objects that map directly to object of the web service, for instance there are classes Parcel, Address, and Label. In…
Hunter McMillen
  • 59,865
  • 24
  • 119
  • 170
1 2 3
4