Imported Upstream version 3.2.0
[debian/amanda] / perl / Amanda / Cmdline.pod
1 /*
2  * Copyright (c) 2009, 2010 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::Cmdline - utilities for handling command lines
26
27 =head1 SYNOPSIS
28
29   use Amanda::Cmdline;
30
31   my $spec = Amanda::Cmdline::dumpspec_t->new($host, $disk, $datestamp, $level, $write_timestamp);
32   print "host: $spec->{'host'}; disk: $spec->{'disk'}\n";
33
34   my @specs = Amanda::Cmdline::parse_dumpspecs(["host", "disk", "date"],
35                             $Amanda::Cmdline::CMDLINE_PARSE_DATESTAMP);
36
37 =head1 Amanda::Cmdline::dumpspec_t Objects
38
39 Note that this class was called C<Amanda::Cmdline::dumpspec_t> in older versions;
40 that name will still work, but is deprecated.
41
42 =head2 Keys
43
44 Each key contains a match expression, in the form of a string, or undef.  Note
45 that the values of these keys are read-only.
46
47 =over
48
49 =item C<< $ds->{'host'} >>
50
51 Hostname
52
53 =item C<< $ds->{'disk'} >>
54
55 Disk name
56
57 =item C<< $ds->{'datestamp'} >>
58
59 Dump timestamp.
60
61 =item C<< $ds->{'level'} >>
62
63 Dump level
64
65 =item C<< $ds->{'write_timestamp'} >>
66
67 Timestamp when the dump is written to storage media.
68
69 =back
70
71 =head2 Methods
72
73 =over
74
75 =item C<< $ds->format() >>
76
77 Format the dumpspec as a string.
78
79 =back
80
81 =head1 Package Functions
82
83 =over
84
85 =item C<format_dumpspec_components($host, $disk, $datestamp, $level)>
86
87 This function returns a string representing the formatted form of the
88 given dumpspec.  This formatting is the same as performed by
89 C<< $ds->format() >>, but does not need a C<Dumpspec>.
90
91 =item C<parse_dumpspecs([@cmdline], $flags)>
92
93 This function parses C<@cmdline> into a list of C<Dumpspec> objects,
94 according to C<$flags>, which is a logical combination of zero or more
95 of
96
97  $CMDLINE_PARSE_DATESTAMP - recognize datestamps
98  $CMDLINE_PARSE_LEVEL - recognize levels
99  $CMDLINE_EMPTY_TO_WILDCARD - if @cmdline is empty, make a wildcard dumpspec
100
101 These constants are available in export tag C<:constants>.  The command-line
102 format is
103
104   [host [disk [datestamp [level [host [..]]]]]]
105
106 Note that there is no facility for specifying C<write_timestamp> on the command
107 line.
108
109 =item C<header_matches_dumpspecs($hdr, [@dumpspecs])>
110
111 This function compares a header to a list of dumpspecs, returning true if the
112 header matches at least one dumpspec.  If C<@dumpspecs> is empty, the function
113 returns false.
114
115 =back
116
117 =head1 SEE ALSO
118
119 L<Amanda::Config> handles C<-o> options itself, through
120 C<config_overrides>.
121
122 =cut
123
124
125 %}