Perl
- 5 ответов
- 0 вопросов
0
Вклад в тег
has 'page' => (is => 'rw', isa => 'Str');
has '_page' => (is => 'rw', isa => 'Str', lazy_build => 1);
sub _build__page {
my $self = shift;
return $self->{page} =~ s/^.+\/(.+)$/$1/r;
}
around 'page' => sub {
my $orig = shift;
my $self = shift;
if (@_) {
$self->$orig(@_);
$self->_clear_page;
}
return $self->_page;
};