package Getopt::Dakkar::Parameter; use Getopt::Dakkar::Style qw(class); use Getopt::Dakkar::Argument; with 'Getopt::Dakkar::Role::Piece'; # VERSION # ABSTRACT: a (positional) parameter # this will need to be generalised and depend on the type has is_slurpy => ( is => 'ro', isa => Bool, default => 0 ); sub match($self,$arg) { # this may need to throw if the type is wrong? return 1; } sub parse($self,$args,$stash) { if ($self->is_slurpy) { my $value = [ $args->@* ]; $args->@* = (); return Getopt::Dakkar::Argument->new({ name => $self->name, value => $value, }); } else { return Getopt::Dakkar::Argument->new({ name => $self->name, value => (shift $args->@*), }); } }