forked from rafl/moosex-declare
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clean now warns in autoclean namespaces, tests and batteries included
- Loading branch information
Showing
4 changed files
with
143 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package MooseX::Declare::StackItem; | ||
|
||
use Moose; | ||
|
||
use namespace::clean -except => 'meta'; | ||
use overload '""' => 'as_string', fallback => 1; | ||
|
||
has identifier => ( | ||
is => 'rw', | ||
isa => 'Str', | ||
required => 1, | ||
); | ||
|
||
has handler => ( | ||
is => 'ro', | ||
required => 1, | ||
default => '', | ||
); | ||
|
||
has is_dirty => ( | ||
is => 'ro', | ||
isa => 'Bool', | ||
); | ||
|
||
has namespace => ( | ||
is => 'ro', | ||
isa => 'Str|Undef', | ||
|
||
); | ||
|
||
sub as_string { | ||
my ($self) = @_; | ||
return $self->identifier; | ||
} | ||
|
||
sub serialize { | ||
my ($self) = @_; | ||
return sprintf '%s->new(%s)', | ||
ref($self), | ||
join ', ', map { defined($_) ? "q($_)" : 'undef' } | ||
'identifier', $self->identifier, | ||
'handler', $self->handler, | ||
'is_dirty', ( $self->is_dirty ? 1 : 0 ), | ||
'namespace', $self->namespace, | ||
; | ||
} | ||
|
||
__PACKAGE__->meta->make_immutable; | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters