On 09/29/2016 09:54 PM, Chas. Owens wrote:
> This is what the meta object is for:
>
> #!/usr/bin/perl
>
> { package Foo;
> use Moose;
> use warnings;
>
> has num => ( is => "rw", isa => "Int" );
> has str => ( is => "rw", isa => "Str" );
> }
>
> use strict;
> use fea
Hi, claus!
Actually, I can't understand the question.
You can (and should) define type constraint for attribute via Moose
predefined types, Types::Standart module or your own type system.
use Types::Standard -all;
use Moose;
has 'attr_name' => (
'is' => 'ro',
'isa' => InstanceOf['
On 09/29/2016 03:52 PM, Aaron Wells wrote:
Hi Klaus,
Have you tried this?
ref $some_obj; # should give your class name as a string
Doubtless Uri will find something wrong with this 😋
glad you asked! :)
ref will return the class something is blessed into. reftype (in
Scalar::Util) will ret
This is what the meta object is for:
#!/usr/bin/perl
{ package Foo;
use Moose;
use warnings;
has num => ( is => "rw", isa => "Int" );
has str => ( is => "rw", isa => "Str" );
}
use strict;
use feature "say";
use warnings;
my $foo = Foo->new;
for my $attr ("num"
Hi Klaus,
Have you tried this?
ref $some_obj; # should give your class name as a string
Doubtless Uri will find something wrong with this 😋
On Thu, Sep 29, 2016, 12:34 PM Klaus Jantzen
wrote:
> Hello,
>
> I have defined Moose-classes with various attributes.
>
> During the execution of a progr
Hello,
I have defined Moose-classes with various attributes.
During the execution of a program that uses such a class I would like to
determine the data type of a specific attribute at the time I am using it.
How can I do that?
--
K.D.J.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl