Imported Upstream version 3.3.2
[debian/amanda] / perl / Amanda / Application.pod
1 /*
2  * Copyright (c) 2009-2012 Zmanda, Inc.  All Rights Reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 as published
6  * by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11  * for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16  *
17  * Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
18  * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
19  */
20
21 %perlcode %{
22
23 =head1 NAME
24
25 Amanda::Application - perl utility functions for Applications.
26
27 =head1 SYNOPSIS
28
29   package Amanda::Application::my_application;
30   use base qw(Amanda::Application);
31
32   sub new {
33     my ($class, $config, $foo) = @_;
34     my $self = $class->SUPER::new($config);
35
36     $self->{'foo'} = $foo;
37     $self->{'bar'} = $bar;
38
39     return $self;
40   }
41
42   # Define all command_* subs that you need, e.g.,
43   sub command_support {
44     my $self = shift;
45     # ...
46   }
47
48   package main;
49
50   # .. parse arguments ..
51
52   my $application = Amanda::Application::my_application->new($opt_foo, $opt_bar);
53   $application->do($cmd);
54
55 =head1 INTERFACE
56
57 =head2 write_magic_block
58
59   $self->write_magic_block($type)
60
61 Write a 512 bytes magic block to STDOUT.
62
63 =head2 read_magic_bloc
64
65   $type = $self->read_magic_block()
66
67 Read the 512 bytes magic block from STDIN and return the type.
68
69 =cut
70
71 %}