Imported Upstream version 2.6.1
[debian/amanda] / perl / Amanda / Application.pm
diff --git a/perl/Amanda/Application.pm b/perl/Amanda/Application.pm
new file mode 100644 (file)
index 0000000..9fa02a0
--- /dev/null
@@ -0,0 +1,126 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 1.3.35
+#
+# Don't modify this file, modify the SWIG interface instead.
+
+package Amanda::Application;
+require Exporter;
+require DynaLoader;
+@ISA = qw(Exporter DynaLoader);
+package Amanda::Applicationc;
+bootstrap Amanda::Application;
+package Amanda::Application;
+@EXPORT = qw( );
+
+# ---------- BASE METHODS -------------
+
+package Amanda::Application;
+
+sub TIEHASH {
+    my ($classname,$obj) = @_;
+    return bless $obj, $classname;
+}
+
+sub CLEAR { }
+
+sub FIRSTKEY { }
+
+sub NEXTKEY { }
+
+sub FETCH {
+    my ($self,$field) = @_;
+    my $member_func = "swig_${field}_get";
+    $self->$member_func();
+}
+
+sub STORE {
+    my ($self,$field,$newval) = @_;
+    my $member_func = "swig_${field}_set";
+    $self->$member_func($newval);
+}
+
+sub this {
+    my $ptr = shift;
+    return tied(%$ptr);
+}
+
+
+# ------- FUNCTION WRAPPERS --------
+
+package Amanda::Application;
+
+*run_calcsize_C = *Amanda::Applicationc::run_calcsize_C;
+
+# ------- VARIABLE STUBS --------
+
+package Amanda::Application;
+
+
+@EXPORT_OK = ();
+%EXPORT_TAGS = ();
+
+push @ISA, qw(Amanda::Script_App);
+require Amanda::Script_App;
+
+use strict;
+use warnings;
+
+=head1 NAME
+
+Amanda::Application - perl utility functions for Applications.
+
+=head1 SYNOPSIS
+
+  package Amanda::Application::my_application;
+  use base qw(Amanda::Application);
+
+  sub new {
+    my $class = shift;
+    my ($foo, $bar) = @_;
+    my $self = $class->SUPER::new();
+
+    $self->{'foo'} = $foo;
+    $self->{'bar'} = $bar;
+
+    return $self;
+  }
+
+  # Define all command_* subs that you need, e.g.,
+  sub command_support {
+    my $self = shift;
+    # ...
+  }
+
+  package main;
+
+  # .. parse arguments ..
+
+  my $application = Amanda::Application::my_application->new($opt_foo, $opt_bar);
+  $application->do($cmd);
+
+=cut
+
+sub new {
+    my $class = shift;
+
+    my $self = Amanda::Script_App::new($class, "client", "application", @_);
+
+    $self->{known_commands} = {
+        support   => 1,
+        selfcheck => 1,
+        estimate  => 1,
+        backup    => 1,
+        restore   => 1,
+        validate  => 1,
+    };
+    return $self;
+}
+
+sub run_calcsize {
+    my $self = shift;
+    my $program = shift;
+
+    run_calcsize_C($self->{config}, $program, $self->{disk}, $self->{device}, $self->{level}, undef, undef);
+
+}
+1;