1SVK::Command(3)       User Contributed Perl Documentation      SVK::Command(3)
2
3
4

NAME

6       SVK::Command - Base class and dispatcher for SVK commands
7

SYNOPSIS

9           use SVK::Command;
10           my $xd = SVK::XD->new ( ... );
11           my $cmd = 'checkout';
12           my @args = qw( file1 file2 );
13           open my $output_fh, '>', 'svk.log' or die $!;
14           SVK::Command->invoke ($xd, $cmd, $output_fh, @args);
15

DESCRIPTION

17       This module resolves alias for commands and dispatches them, usually
18       with the "invoke" method.  If the command invocation is incorrect,
19       usage information is displayed instead.
20

METHODS

22       Class Methods
23
24       invoke ($xd, $cmd, $output_fh, @args)
25
26       Takes a SVK::XD object, the command name, the output scalar reference,
27       and the arguments for the command. The command name is translated with
28       the %alias map.
29
30       On Win32, after @args is parsed for named options, the remaining posi‐
31       tional arguments are expanded for shell globbing with "bsd_glob".
32
33       getopt ($argv, %opt)
34
35       Takes a arrayref of argv for run getopt for the command, with addi‐
36       tional %opt getopt options.
37
38       Instance Methods
39
40       "SVK::Command->invoke" loads the corresponding class "SVK::Com‐
41       mand::$name", so that's the class you want to implement the following
42       methods in:
43
44       options ()
45
46       Returns a hash where the keys are Getopt::Long specs and the values are
47       a string that will be the keys storing the parsed option in $self.
48
49       Subclasses should override this to add their own options.  Defaults to
50       an empty list.
51
52       opt_recursive
53
54       Defines if the command needs the recursive flag and its default.  The
55       value will be stored in "recursive".
56
57       parse_arg (@args)
58
59       This method is called with the remaining arguments after parsing named
60       options with "options" above.  It should use the "arg_*" methods to
61       return a list of parsed arguments for the command's "lock" and "run"
62       method to process.  Defaults to return a single "undef".
63
64       lock (@parse_args)
65
66       Calls the "lock_*" methods to lock the SVK::XD object. The arguments
67       will be what is returned from "parse_arg".
68
69       run (@parsed_args)
70
71       Actually process the command. The arguments will be what is returned
72       from "parse_arg".
73
74       Returned undef on success. Return a string message to notify the caller
75       errors.
76
77       Utility Methods
78
79       Except for "arg_depotname", all "arg_*" methods below returns a
80       SVK::Path object, which consists of a hash with the following keys:
81
82       cinfo
83       copath
84       depotpath
85       path
86       repos
87       repospath
88       report
89       targets
90
91       The hashes are handy to pass to many other functions.
92
93       arg_condensed (@args)
94
95       Argument is a number of checkout paths.
96
97       arg_uri_maybe ($arg, $no_new_mirror)
98
99       Argument might be a URI or a depotpath.  If it is a URI, try to find it
100       at or under one of currently mirrored paths.  If not found, prompts the
101       user to mirror and sync it.
102
103       arg_co_maybe ($arg, $no_new_mirror)
104
105       Argument might be a checkout path or a depotpath. If argument is URI
106       then handles it via "arg_uri_maybe".
107
108       arg_copath ($arg)
109
110       Argument is a checkout path.
111
112       arg_depotpath ($arg)
113
114       Argument is a depotpath, including the slashes and depot name.
115
116       arg_depotroot ($arg)
117
118       Argument is a depot root, or a checkout path that needs to be resolved
119       into a depot root.
120
121       arg_depotname ($arg)
122
123       Argument is a name of depot. such as '' or 'test' that is being used
124       normally between two slashes.
125
126       arg_path ($arg)
127
128       Argument is a plain path in the filesystem.
129
130       apply_revision($target)
131
132       Apply the given revision from command line to $target.
133
134       parse_revlist ()
135
136       Parse -c or -r to a list of [from, to] pairs.
137
138       lock_target ($target)
139
140       XXX Undocumented
141
142       lock_coroot ($target)
143
144       XXX Undocumented
145
146       brief_usage ($file)
147
148       Display an one-line brief usage of the command object.  Optionally, a
149       file could be given to extract the usage from the POD.
150
151       filename
152
153       Return the filename for the command module.
154
155       usage ($want_detail)
156
157       Display usage.  If $want_detail is true, the "DESCRIPTION" section is
158       displayed as well.
159
160       Error Handling
161
162       handle_error ($error)
163
164       XXX Undocumented
165
166       add_handler ($error, $handler)
167
168       XXX Undocumented
169
170       msg_handler ($error, $message)
171
172       XXX Undocumented
173
174       msg_handler ($error)
175
176       XXX Undocumented
177
178       command ($cmd, \%args)
179
180       Construct a command object of the $cmd subclass and return it.
181
182       The new object will share the "xd" from the calling command object;
183       contents in %args is also assigned into the new object.
184
185       rebless ($cmd, \%args)
186
187       Like "command" above, but modifies the calling object instead of creat‐
188       ing a new one.  Useful for a command object to recast itself into
189       another command class.
190
191       run_command_recursively($target, $code)
192
193       Traverse $target and and invoke $code with each node.
194

SEE ALSO

196       SVK, SVK::XD, "SVK::Command::*"
197
198
199
200perl v5.8.8                       2006-12-28                   SVK::Command(3)
Impressum