From 7fce4340deb0b6337bbd7ef6071ee42529db222d Mon Sep 17 00:00:00 2001 From: dakkar Date: Fri, 13 Jul 2018 13:09:26 +0100 Subject: vaguely parse commands --- lib/Getopt/Dakkar/Stash.pm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lib/Getopt/Dakkar/Stash.pm (limited to 'lib/Getopt/Dakkar/Stash.pm') diff --git a/lib/Getopt/Dakkar/Stash.pm b/lib/Getopt/Dakkar/Stash.pm new file mode 100644 index 0000000..2d0d568 --- /dev/null +++ b/lib/Getopt/Dakkar/Stash.pm @@ -0,0 +1,23 @@ +package Getopt::Dakkar::Stash; +use Getopt::Dakkar::Style qw(class); +# VERSION +# ABSTRACT: a stash + +has options => ( is => 'ro' ); +has arguments => ( is => 'ro' ); + +sub new_from_argpack($class,$argpack) { + return $class->new({ + options => $argpack->options, + arguments => $argpack->arguments, + }); +} + +sub merge_with_argpack($self,$argpack) { + for my $f (qw(options arguments)) { + my $this = $self->$f; + my $that = $argpack->$f; + $this->{$_} = $that->{$_} for keys $that->%*; + } + return $self; +} -- cgit v1.2.3