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