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 feature "say"; > use warnings; > > my $foo = Foo->new; > > for my $attr ("num", "str") { > say "$attr is of type: ", > $foo->meta->get_attribute($attr)->type_constraint->name; > } > > See http://search.cpan.org/dist/Moose/lib/Moose/Meta/Class.pm > > On Thu, Sep 29, 2016 at 3:34 PM Klaus Jantzen <k.d.jant...@mailbox.org > <mailto:k.d.jant...@mailbox.org>> wrote: > > 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.org > <mailto:beginners-unsubscr...@perl.org> > For additional commands, e-mail: beginners-h...@perl.org > <mailto:beginners-h...@perl.org> > http://learn.perl.org/ > >
Thank you for your help. K.D.J. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/