/usr/lib/amanda/perl/Amanda/Application.pm is in amanda-common 1:3.3.6-4.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
package Amanda::Application;
use base qw(Exporter);
use base qw(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 = ();
=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, $config, $foo) = @_;
my $self = $class->SUPER::new($config);
$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);
=head1 INTERFACE
=head2 write_magic_block
$self->write_magic_block($type)
Write a 512 bytes magic block to STDOUT.
=head2 read_magic_bloc
$type = $self->read_magic_block()
Read the 512 bytes magic block from STDIN and return the type.
=cut
push @ISA, qw(Amanda::Script_App);
require Amanda::Script_App;
use strict;
use warnings;
use IO::Handle;
use Amanda::Config qw( :init :getconf config_dir_relative );
sub new {
my $class = shift @_;
my $config_name = shift @_;
my $self = Amanda::Script_App::new($class, "client", "application", $config_name);
$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);
}
sub default_validate {
my $self = shift;
my $buffer;
do {
sysread STDIN, $buffer, 1048576;
} while (defined $buffer and length($buffer) > 0);
}
sub write_magic_block {
my $self = shift;
my $type = shift;
my $dump_str = pack("a512", $type);
print STDOUT $dump_str;
}
sub read_magic_block {
my $self = shift;
my $magic_block = Amanda::Util::full_read(0, 512);
#remove '\0' bytes
$magic_block =~ /^([^\0]*)/;
my $type = $1;
return $type;
}
sub _set_mesgout {
my $self = shift;
my $mesgout = IO::Handle->new();
$mesgout->fdopen(3,"a") || die("Can't open mesgout_fd: $!");
$mesgout->autoflush(1);
$self->{mesgout} = $mesgout;
}
1;
|