dr_death has asked for the wisdom of the Perl Monks concerning the following question:
Hello all,
I am pretty new to OOP programming and am trying to learn how to use Moose and I cant seem to find an example/explanation of what I need to do, although I am learning a lot reading through trying to find it.
What I am trying to do is create a new object like below and then have that return an ID from a DB.
get_id->new( email => 'test@test.com' );I have something like the below already;
has 'email' => ( is => 'rw', isa => 'Str', required => 1, clearer => 'clear_email', predicate => 'has_email', );
I've seen 'default => sub', but I'm not entirely sure if it's appropriate or how the inheritance works using it.
Is there someway I can call a sub or method and have it return the ID? If so, could you please tell me where I can find it in the documentation?
Thanks for your help!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I process then return something in Moose?
by 1nickt (Canon) on Feb 07, 2017 at 12:57 UTC |