summaryrefslogtreecommitdiff
path: root/lib/Getopt/Dakkar/Stash.pm
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2018-07-13 13:09:26 +0100
committerdakkar <dakkar@thenautilus.net>2018-07-13 13:09:26 +0100
commit7fce4340deb0b6337bbd7ef6071ee42529db222d (patch)
tree3761e50b1c592ad816e5c7782f2183aeae5a6ca9 /lib/Getopt/Dakkar/Stash.pm
parentstyle (diff)
downloadGetopt-Dakkar-7fce4340deb0b6337bbd7ef6071ee42529db222d.tar.gz
Getopt-Dakkar-7fce4340deb0b6337bbd7ef6071ee42529db222d.tar.bz2
Getopt-Dakkar-7fce4340deb0b6337bbd7ef6071ee42529db222d.zip
vaguely parse commands
Diffstat (limited to 'lib/Getopt/Dakkar/Stash.pm')
-rw-r--r--lib/Getopt/Dakkar/Stash.pm23
1 files changed, 23 insertions, 0 deletions
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;
+}