neilwatson has asked for the wisdom of the Perl Monks concerning the following question:
has 'ip_address' => ( is => 'ro', isa => 'Str', lazy => 1, builder => 'get_ip_address', ... sub get_ip_address { my $self = shift; my $allclasses_file = $self->allclasses_file; my $ip_address; if ( $allclasses_file =~ m/_([^_]+$)/ ) { $ip_address = $1; return $ip_address; } }
This works. However, if the attribute is not correct the error messege is long and unhelpful. How can I make a custom more friendly messege when the ip_address attribute is incorrect?
Neil Watson
watson-wilson.ca
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Custom error messages and moose
by remiah (Hermit) on Sep 29, 2012 at 11:57 UTC | |
by neilwatson (Priest) on Sep 29, 2012 at 12:09 UTC | |
by remiah (Hermit) on Sep 29, 2012 at 15:21 UTC | |
|
Re: Custom error messages and moose
by tobyink (Canon) on Sep 29, 2012 at 15:00 UTC | |
|
Re: Custom error messages and moose
by irirgem (Novice) on Sep 29, 2012 at 04:04 UTC |