summaryrefslogtreecommitdiff
path: root/lib/Getopt/Dakkar/Stash.pm
diff options
context:
space:
mode:
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;
+}