| 1 | package XML::NewsML_G2::Product; | ||
| 2 | |||
| 3 | 20 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 20 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 20 | has 'name', isa => 'Str', is => 'ro', lazy => 1, builder => '_build_name'; | |
| 7 | 20 | has 'isbn', isa => 'Str', is => 'rw'; | |
| 8 | 20 | has 'ean', isa => 'Str', is => 'rw'; | |
| 9 | 20 | has 'name_template', isa => 'Str', is => 'ro', default => 'Product %d'; | |
| 10 | |||
| 11 | { | ||
| 12 | 20 | my $product_count = 0; | |
| 13 | |||
| 14 | 11 | ▶ | sub _build_name { |
|
Subroutine
_build_name: called CC=1 SCAR=0.0
| |||
| 15 | 11 | my $self = shift; | |
| 16 | 11 | return sprintf $self->name_template, ++$product_count; | |
| 17 | } | ||
| 18 | } | ||
| 19 | |||
| 20 | 20 | __PACKAGE__->meta->make_immutable; | |
| 21 | |||
| 22 | 20 | 1; | |
| 23 | __END__ | ||