Questions tagged [moops]
Moops is a meta-framework for object-oriented programming in the Perl programming language.
11
questions
0
votes
1answer
281 views
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 ...
0
votes
1answer
47 views
Generic tracing mock class
I am trying to construct a convenient mocking class using moops:
#!/usr/bin/env perl
use Modern::Perl '2014';
use Moops;
use Test::More;
class aClass {
method m {}
method l {}
};
class ...
11
votes
1answer
379 views
Moops lexical_has and default values
I am trying to understand how lexical_has attributes work in Moops. This feature comes from Lexical::Accessor and, as I understand it, the lexical_has function is able to generate a CODE reference to ...
3
votes
1answer
68 views
How can I overload methods in Moops?
I would like to overload some methods in Moops.
I have the tried the following code:
method setIdNum() {
print "Please enter ID number: ";
chomp (my $input = <STDIN>);
$self-&...
1
vote
1answer
113 views
Can someone please explain how to implement and utilize privately-scoped arrays in Moops?
I am trying to learn Moops and I can't quite grasp how to use populate and iterate over lexical_has arrayRefs. Can you demonstrate their usage here with code please?
I wrote the following:
...
1
vote
2answers
92 views
class_has for Moops
Is there something like MooseX::ClassAttribute for Moops?
Note, that I want static/class attributes using the Moo backend, as I do not want to bring in the Moose backend.
3
votes
1answer
149 views
Import functions/subroutine into subclass
I'm using Moops and I'd like something like this to work:
use Moops;
class A {
fun f {
print "yay,f!\n";
}
}
class B extends A {
fun g {
f();
}
}
B->g(); # should print 'yay, f!'
...
8
votes
2answers
314 views
ctags support for moops
Moops enhances the perl syntax by constructs such as:
class MyPkg::MyClass {
# ...
}
and adds the possibility to declare signatures for member functions by introducing the new keywords fun and ...
2
votes
1answer
157 views
Use MooseX meta attributes with Moops
Is it possible to use MooseX meta attributes with Moops?
Consider this Moose sample code:
use v5.14;
use strict;
use warnings;
package TraitTest;
use Moose;
with 'MooseX::Getopt';
has opt1 => (
...
1
vote
1answer
126 views
Attribute accessor not satisfying role requirement when using Moops and Moose
Consider the following code sample:
use Moops;
role RoleA
using Moose {
requires 'm1';
method m2() {
$self->m1." World!\n";
}
}
role RoleB
using Moose {
has 'm1' => ( accessor =&...
6
votes
1answer
158 views
Can I instantiate an object in Dancer to return a value to display?
I have the following code in my Dancer app module:
package Deadlands;
use Dancer ':syntax';
use Dice;
our $VERSION = '0.1';
get '/' => sub {
my ($dieQty, $dieType);
$dieQty = param('...