Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="prev" href="module-pipes.html" /> | |
13 | <link rel="parent" href="module-pipes.html" /> | |
14 | <link rel="next" href="module-posixfile.html" /> | |
15 | <meta name='aesop' content='information' /> | |
16 | <title>8.12.1 Template Objects </title> | |
17 | </head> | |
18 | <body> | |
19 | <DIV CLASS="navigation"> | |
20 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
21 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
22 | <tr> | |
23 | <td class='online-navigation'><a rel="prev" title="8.12 pipes " | |
24 | href="module-pipes.html"><img src='../icons/previous.png' | |
25 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
26 | <td class='online-navigation'><a rel="parent" title="8.12 pipes " | |
27 | href="module-pipes.html"><img src='../icons/up.png' | |
28 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
29 | <td class='online-navigation'><a rel="next" title="8.13 posixfile " | |
30 | href="module-posixfile.html"><img src='../icons/next.png' | |
31 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
32 | <td align="center" width="100%">Python Library Reference</td> | |
33 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
34 | href="contents.html"><img src='../icons/contents.png' | |
35 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
36 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
37 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
38 | <td class='online-navigation'><a rel="index" title="Index" | |
39 | href="genindex.html"><img src='../icons/index.png' | |
40 | border='0' height='32' alt='Index' width='32' /></A></td> | |
41 | </tr></table> | |
42 | <div class='online-navigation'> | |
43 | <b class="navlabel">Previous:</b> | |
44 | <a class="sectref" rel="prev" href="module-pipes.html">8.12 pipes </A> | |
45 | <b class="navlabel">Up:</b> | |
46 | <a class="sectref" rel="parent" href="module-pipes.html">8.12 pipes </A> | |
47 | <b class="navlabel">Next:</b> | |
48 | <a class="sectref" rel="next" href="module-posixfile.html">8.13 posixfile </A> | |
49 | </div> | |
50 | <hr /></div> | |
51 | </DIV> | |
52 | <!--End of Navigation Panel--> | |
53 | ||
54 | <H2><A NAME="SECTION00101210000000000000000"></A><A NAME="template-objects"></A> | |
55 | <BR> | |
56 | 8.12.1 Template Objects | |
57 | </H2> | |
58 | ||
59 | <P> | |
60 | Template objects following methods: | |
61 | ||
62 | <P> | |
63 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
64 | <td><nobr><b><tt id='l2h-3032' xml:id='l2h-3032' class="method">reset</tt></b>(</nobr></td> | |
65 | <td><var></var>)</td></tr></table></dt> | |
66 | <dd> | |
67 | Restore a pipeline template to its initial state. | |
68 | </dl> | |
69 | ||
70 | <P> | |
71 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
72 | <td><nobr><b><tt id='l2h-3033' xml:id='l2h-3033' class="method">clone</tt></b>(</nobr></td> | |
73 | <td><var></var>)</td></tr></table></dt> | |
74 | <dd> | |
75 | Return a new, equivalent, pipeline template. | |
76 | </dl> | |
77 | ||
78 | <P> | |
79 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
80 | <td><nobr><b><tt id='l2h-3034' xml:id='l2h-3034' class="method">debug</tt></b>(</nobr></td> | |
81 | <td><var>flag</var>)</td></tr></table></dt> | |
82 | <dd> | |
83 | If <var>flag</var> is true, turn debugging on. Otherwise, turn debugging | |
84 | off. When debugging is on, commands to be executed are printed, and | |
85 | the shell is given <code>set -x</code> command to be more verbose. | |
86 | </dl> | |
87 | ||
88 | <P> | |
89 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
90 | <td><nobr><b><tt id='l2h-3035' xml:id='l2h-3035' class="method">append</tt></b>(</nobr></td> | |
91 | <td><var>cmd, kind</var>)</td></tr></table></dt> | |
92 | <dd> | |
93 | Append a new action at the end. The <var>cmd</var> variable must be a valid | |
94 | bourne shell command. The <var>kind</var> variable consists of two letters. | |
95 | ||
96 | <P> | |
97 | The first letter can be either of <code>'-'</code> (which means the command | |
98 | reads its standard input), <code>'f'</code> (which means the commands reads | |
99 | a given file on the command line) or <code>'.'</code> (which means the commands | |
100 | reads no input, and hence must be first.) | |
101 | ||
102 | <P> | |
103 | Similarly, the second letter can be either of <code>'-'</code> (which means | |
104 | the command writes to standard output), <code>'f'</code> (which means the | |
105 | command writes a file on the command line) or <code>'.'</code> (which means | |
106 | the command does not write anything, and hence must be last.) | |
107 | </dl> | |
108 | ||
109 | <P> | |
110 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
111 | <td><nobr><b><tt id='l2h-3036' xml:id='l2h-3036' class="method">prepend</tt></b>(</nobr></td> | |
112 | <td><var>cmd, kind</var>)</td></tr></table></dt> | |
113 | <dd> | |
114 | Add a new action at the beginning. See <tt class="method">append()</tt> for explanations | |
115 | of the arguments. | |
116 | </dl> | |
117 | ||
118 | <P> | |
119 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
120 | <td><nobr><b><tt id='l2h-3037' xml:id='l2h-3037' class="method">open</tt></b>(</nobr></td> | |
121 | <td><var>file, mode</var>)</td></tr></table></dt> | |
122 | <dd> | |
123 | Return a file-like object, open to <var>file</var>, but read from or | |
124 | written to by the pipeline. Note that only one of <code>'r'</code>, | |
125 | <code>'w'</code> may be given. | |
126 | </dl> | |
127 | ||
128 | <P> | |
129 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
130 | <td><nobr><b><tt id='l2h-3038' xml:id='l2h-3038' class="method">copy</tt></b>(</nobr></td> | |
131 | <td><var>infile, outfile</var>)</td></tr></table></dt> | |
132 | <dd> | |
133 | Copy <var>infile</var> to <var>outfile</var> through the pipe. | |
134 | </dl> | |
135 | ||
136 | <DIV CLASS="navigation"> | |
137 | <div class='online-navigation'> | |
138 | <p></p><hr /> | |
139 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
140 | <tr> | |
141 | <td class='online-navigation'><a rel="prev" title="8.12 pipes " | |
142 | href="module-pipes.html"><img src='../icons/previous.png' | |
143 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
144 | <td class='online-navigation'><a rel="parent" title="8.12 pipes " | |
145 | href="module-pipes.html"><img src='../icons/up.png' | |
146 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
147 | <td class='online-navigation'><a rel="next" title="8.13 posixfile " | |
148 | href="module-posixfile.html"><img src='../icons/next.png' | |
149 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
150 | <td align="center" width="100%">Python Library Reference</td> | |
151 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
152 | href="contents.html"><img src='../icons/contents.png' | |
153 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
154 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
155 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
156 | <td class='online-navigation'><a rel="index" title="Index" | |
157 | href="genindex.html"><img src='../icons/index.png' | |
158 | border='0' height='32' alt='Index' width='32' /></A></td> | |
159 | </tr></table> | |
160 | <div class='online-navigation'> | |
161 | <b class="navlabel">Previous:</b> | |
162 | <a class="sectref" rel="prev" href="module-pipes.html">8.12 pipes </A> | |
163 | <b class="navlabel">Up:</b> | |
164 | <a class="sectref" rel="parent" href="module-pipes.html">8.12 pipes </A> | |
165 | <b class="navlabel">Next:</b> | |
166 | <a class="sectref" rel="next" href="module-posixfile.html">8.13 posixfile </A> | |
167 | </div> | |
168 | </div> | |
169 | <hr /> | |
170 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
171 | </DIV> | |
172 | <!--End of Navigation Panel--> | |
173 | <ADDRESS> | |
174 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
175 | </ADDRESS> | |
176 | </BODY> | |
177 | </HTML> |