moose Questions

1

For any given result class MySchema::Result::Foo (built from default schema loader generated syntax which uses Moose/MooseX::nonmoose) If I add a BUILDARGS method wrapper to sanitize the construc...
Flinger asked 7/12, 2010 at 14:28

5

Solved

So I was going about my Moosey business and I thought hey might be nice to use a constant in these places where I'm using numbers, to make it clear what these numbers mean or in case they change la...
Poppy asked 19/10, 2011 at 16:53

2

Solved

Many standard modules are all using straight up perl -- problem is these guys arent using Moosey stuff, so I catch myself wrapping them with Moose or reinventing some simple functions in bigger lib...
Lenity asked 14/10, 2011 at 22:42

1

Solved

Since Perl/Moose always calls the base class' BUILD function before it calls the subclass BUILD function, there is a new instance of the base class everytime you instantiate a subclass. How do I g...
Mahratta asked 28/9, 2011 at 17:28

3

Solved

I'm brand new to Moose. Up until today our environments have been on Perl 5.8.2 which would not support Moose. I'm working through some examples, and I thought that the "required => 1" setting on ...
Whether asked 19/4, 2011 at 18:11

2

Solved

I have a class where I want to apply string overloading on its id attribute. However, Moose doesn't allow string overloading on attribute accessors. For example: package Foo; use Moose; use overlo...
Thanksgiving asked 29/8, 2011 at 12:49

11

Solved

I'm still relatively new to Perl Programming, but I know how Perl 5 OO basically works. However, I have never created any project with Perl 5 OO, so I'm quite sure I will run into many pitfal...
Backward asked 11/6, 2009 at 12:13

2

Solved

Are there any Perl web-development frameworks other than Catalyst that are: written with Moose natively written for PSGI (not with some PSGI-emulation) Unicode ready/safe - so Perl 5.10+ small, e...
Orchardman asked 29/7, 2011 at 8:54

3

Solved

Consider this simple class: package Foo; use Moose; has foo => ( is => 'rw', isa => 'Int' ); And then this code: use Try::Tiny; use Foo; my $f = try { Foo->new( foo => 'Not an I...
Tawanda asked 11/2, 2010 at 0:19

2

Solved

I've just started working with Moose and have run into an odd problem that I cannot figure out. The following code: #!/usr/bin/env perl use strict; use warnings; use Try::Tiny; { package Foo; u...
Ballroom asked 16/6, 2011 at 0:8

2

Solved

Can I do this in Moose? package SomeClass; use Moose; has start => ( isa => 'Int', is => 'ro', lazy => 1, default => sub { $_[0]->end }, ); has end => ( isa => 'Int'...
Anana asked 12/2, 2011 at 0:52

1

Solved

Using __PACKAGE__->meta->get_attribute('foo'), you can access the foo attribute definitions in a given class, which can be useful. #!perl package Bla; use Moose; has bla => is => 'ro',...
Casefy asked 3/6, 2011 at 16:4

3

Solved

Moose types are great, but sometimes you need to be more specific. You all know these data type rules: that parameter may only be 'A', 'B' or 'C', or only a currency symbol, or must conform to some...
Fingerboard asked 28/4, 2011 at 17:30

1

Solved

Moose is very tolerant by default. You can have a class named Cucumber and pass an undeclared attribute (like wheels) to the constructor. Moose won't complain about that by default. But I might pre...
Murielmurielle asked 28/4, 2011 at 12:56

1

Solved

This is a basic question, I fear. Take a look at the following code. I'd like to know whether there is a way to declare the slices attribute in such a way as to avoid the boilerplate of get_slices ...
Bullough asked 28/4, 2011 at 10:7

2

Solved

I am going through the Moose recipes and I still cannot see if I can create private variables and functions using it? Is it possible? If yes how to create them with Moose?
Judicature asked 13/4, 2011 at 6:40

1

Solved

Normally I would finalize a class at compilation via __PACKAGE__->meta->make_immutable at the end of the class. However, when should I be making a class immutable that composes roles into its...
Pulchi asked 28/3, 2011 at 17:9

2

Solved

Perl's Moose is different from other object systems, so it's not always clear how to translate an example known from other languages into Moose lingo. Consider the following Java example of Rectang...
Shermanshermie asked 19/3, 2011 at 16:51

1

Solved

I can do this: package Foo; use Moose; has 'time' => ( is => 'rw', isa => 'DateTime' ); package main; use DateTime; my $a = Foo->new(time => DateTime->now); But not th...
Hypostyle asked 4/3, 2011 at 16:9

1

Solved

I have a Moose class that is intended to be subclassed, and every subclass has to implement an "execute" method. However, I would like to put apply a method modifier to the execute method in my cla...
Tonettetoney asked 11/2, 2011 at 2:56

5

This is more of a use-case type of question... but also generic enough to be more broadly applicable: In short, I'm working on a module that's more or less a command-line wrapper; OO naturally. Wi...
Antefix asked 12/6, 2010 at 16:33

5

Solved

Is there a way to wrap methods in other methods transparently in C#? I want to achieve what is done by Moose's around functionality: http://search.cpan.org/perldoc?Moose::Manual::MethodModifiers E...
Sovereignty asked 1/2, 2011 at 21:28

2

Solved

What strategies have Perl people used when mocking Moose objects that they will inject into other Moose objects as type-constrained attributes? Test::MockObject::Extends doesn't seem to play well ...
Endoplasm asked 2/9, 2009 at 2:27

2

Solved

I would like to have a non-required Moose attribute that can be set only once. If I use is => 'ro' I must set the attribute upon creation of the object, but I want to be able to add it afterwar...
Gertrudgertruda asked 12/11, 2010 at 13:29

2

Solved

Sorry for the Java jargon, but how can I overload Moose constructors? Suppose I'm representing a segment. I can either take a start point and and point, or a start point and length, or end point a...
Chapen asked 23/10, 2010 at 11:33

© 2022 - 2024 — McMap. All rights reserved.