Questions tagged [moose]

Moose is a postmodern object system for Perl 5 that takes the tedium out of writing object-oriented Perl. It borrows all the best features from Perl 6, CLOS (Lisp), Smalltalk, Java, BETA, OCaml, Ruby and more, while still keeping true to its Perl 5 roots.

Moose is an extension of the Perl 5 object system. The main goal of Moose is to make Perl 5 object-oriented programming (OOP) easier, more consistent and less tedious. With Moose you can think more about what you want to do and less about the mechanics of OOP.

Moose links

See Also

sources: moose.perl.org

609 questions
0
votes
1 answer

What are 'weak references' in KiokuDB?

What exactly are the weak references that KiokuDB tutorial mentions? How do they differ from 'normal' references?
David B
  • 29,258
  • 50
  • 133
  • 186
0
votes
2 answers

Perl + moose: Can't call method "x" on an undefined value

I'm just trying to do this: http://modernperlbooks.com/mt/2011/08/youre-already-using-dependency-injection.html. Really not deviating too much at all from that example code. Here's what I've got: package M; use Moose; use Exporter; use…
user6818959
0
votes
3 answers

perl Moose accessor madness - can't define only a reader or writer accessor!

So I'm just trying to do a very simple thing: define a custom reader accessor for a moose attribute. So I try this: has 'compiled_regex' => ( isa => 'RegexpRef', is => 'rw', reader => 'get_compiled', ); but get_compiled never gets…
ennuikiller
  • 46,381
  • 14
  • 112
  • 137
0
votes
1 answer

Can't locate IPC::SysV in Windows or Log::Log4perl::Appender::Synchronized

I am getting an error in my Perl project Here is a screenshot of the problem I installed the Log::Log4perl module using CPAN and when I installed the IPC::SysV module in the same way it shows that the OS is unsupported. I am stuck at that point.…
Dhruv Tyagi
  • 814
  • 1
  • 9
  • 28
0
votes
1 answer

Moose attribute set order difficulty

I'm having difficulty with attribute initialization order in the following: driver.pl my $foo = MyApp::Boom->new( configfile => "/home/todd/text.cfg" ); MyApp::Boom has configfile => ( is => 'ro', isa => 'Str', required => 1 ); has conf =>…
Todd
  • 698
  • 6
  • 19
0
votes
1 answer

MooseX::Declare and Perl EPIC (Eclipse IDE)?

How can I get support for jumping to Moose methods using Eclipse with the EPIC plugin? (Using F3) They're declared like class Point { method getDistance { ... } }
PBJ
  • 757
  • 8
  • 21
0
votes
1 answer

Child classes implement a MooseX::Interface with MooseX::ABC (Abstract Base Class)

I am trying to force all child classes of an Abstract Base Class to implement an interface. When I try add with '' to the ABC, it requires me to implement the required methods immediately and add sub {} for each interface…
0
votes
1 answer

How can one attribute's default sub access another attribute with Moose?

############################################################################### # Attributes ############################################################################### has 'primary_cluster' => ( is => 'ro', isa => 'Str', required…
Takkun
  • 6,131
  • 16
  • 52
  • 69
0
votes
1 answer

Not Able to Set Class' Attributes in Role

First off, I'm not really sure how much information is necessary to include because I'm having a really hard time tracing the origin of this problem. I have a Moose role with a subroutine that (along with a few other things) tries to set the…
Ryan
  • 672
  • 1
  • 6
  • 16
0
votes
1 answer

Using the perl MooseX extention in silent mode?

I have perl 5.10.1 installed on my ubuntu machine. I wanted to install the Moose and MooseX extentions, so I did install the packages with the aptitude package manager. Here are all the packages I have installed: $ sudo apt-cache pkgnames | grep…
Jean-François Beaulieu
  • 4,305
  • 22
  • 74
  • 107
0
votes
1 answer

Writing a builder for a MooseX::ClassAttribute in a Moose::Role

I want to define a Role with a Class attribute and a builder. This fails whatever I've tried. I found two workaround: not using a class attribute but a plain attribute. It is problematic in my situation because I would like to modify the attribute…
Vincent
  • 57
  • 6
0
votes
2 answers

How do you name a class/package/module like

How would you name a package who's sole purpose was to extend another module so you could apply roles to it? I need a package that extends (sub classes) Template::Context with Moose So I can then create roles and traits to apply to it, but I don't…
xenoterracide
  • 16,274
  • 24
  • 118
  • 243
0
votes
1 answer

Can Build function in moose return false?

I want to apply some roles dynamically to a moose class. I am writing that logic inside BUILD function. If there are any failures while applying role, I want to return FALSE. What will be the impact of that return value. How can I handle failure in…
rahulv21
  • 187
  • 2
  • 3
  • 15
0
votes
1 answer

Force coercion in Moose

I want to modify an attribute's value every time it is set, no matter if it is done within constructor or by a 'writer'(i don't use 'builder' or 'default' in that case). Basically the attribute(not necessary 'Str' type) is passed to the constructor…
roland16
  • 27
  • 4
0
votes
2 answers

Creating attribute defaults by calling a wrapped object

I have WrapperClass object that has an InnerClass object as an attribute. The InnerClass object has a weight attribute. My WrapperClass object also has a weight attribute and I want its default value to be whatever the value of the InnerClass…
tcn
  • 65
  • 8