App-Easer
view release on metacpan or search on metacpan
my ($title) = $path->lines({count => 1});
($title // '') =~ s{\A\s+|\s+\z}{}grmxs;
}
sub list_category ($self, $category) {
my $dir = $self->basedir->child($category);
return reverse sort { $a cmp $b } $dir->children;
}
sub move_task ($self) {
my $category = (caller(1))[3] =~ s{\A cmd_}{}rmxs;
my $child = $self->resolve;
my $parent = $child->parent;
if ($parent->basename eq $category) {
$self->notice("task is already $category");
return 0;
}
my $dest = $parent->sibling($category)->child($child->basename);
$self->add_file($dest, $child->slurp_utf8);
$child->remove;
return 0;
my ($title) = $path->lines({count => 1});
($title // '') =~ s{\A\s+|\s+\z}{}grmxs;
}
sub list_category ($self, $category) {
my $dir = $self->basedir->child($category);
return reverse sort { $a cmp $b } $dir->children;
}
sub move_task ($self) {
my $category = (caller(1))[3] =~ s{\A cmd_}{}rmxs;
my $child = $self->resolve;
my $parent = $child->parent;
if ($parent->basename eq $category) {
$self->notice("task is already $category");
return 0;
}
my $dest = $parent->sibling($category)->child($child->basename);
$self->add_file($dest, $child->slurp_utf8);
$child->remove;
return 0;
lib/App/Easer/V2.pm view on Meta::CPAN
sub slot ($self) { return $self->{blessed($self)} //= {} }
# This is a poor man's way to easily define attributes in a single line
# Corinna will be a blessing eventually
sub _rwn ($self, $name, @newval) {
my $vref = \$self->slot->{$name};
$$vref = $newval[0] if @newval;
return $$vref;
}
sub _rw ($s, @n) { $s->_rwn((caller(1))[3] =~ s{.*::}{}rmxs, @n) }
sub _rwa ($self, @n) {
my $aref = $self->_rwn((caller(1))[3] =~ s{.*::}{}rmxs, @n);
Carp::confess() unless defined $aref;
return $aref->@*;
}
sub _rwad ($self, @n) {
my $aref = $self->_rwn((caller(1))[3] =~ s{.*::}{}rmxs, @n) // [];
return wantarray ? $aref->@* : [$aref->@*];
}
sub _rw_prd ($self, @n) {
my $slot = $self->slot;
my $name = (caller(1))[3] =~ s{.*::}{}rmxs;
if (@n) {
$slot->{$name} = $n[0];
}
elsif (ref(my $ref_to_default = $slot->{$name})) {
my $parent = $self->parent;
$slot->{$name} = $parent ? $parent->$name : $$ref_to_default;
}
return $slot->{$name};
}
( run in 0.293 second using v1.01-cache-2.11-cpan-cc502c75498 )