~ubuntu-branches/ubuntu/lucid/perl-tk/lucid

« back to all changes in this revision

Viewing changes to pod/CmdLine.pod

  • Committer: Bazaar Package Importer
  • Author(s): Colin Tuckley
  • Date: 2008-02-15 13:56:59 UTC
  • mfrom: (1.1.3 upstream) (4.1.1 hardy)
  • Revision ID: james.westby@ubuntu.com-20080215135659-ru2oqlykuju20fav
Tags: 1:804.028-1
* New Upstream Release (Closes: #463080).
* Update to Debhelper v5.
* Build with XFT=1 (Closes: #411129).

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
for command line options and arguments. All applications written with the
29
29
X Toolkit Intrinsics automatically accept the following options: ...".
30
30
This module processes these command line options for perl/Tk applications
31
 
using the C<SetArguments> function.
 
31
using the C<SetArguments>() function.
32
32
 
33
33
This module can optionally be used to load initial resources explicitly via
34
 
function C<SetResources>, or from specified files (default: the standard X11
35
 
application-specific resource files) via function C<LoadResources>.
 
34
function C<SetResources>(), or from specified files (default: the standard X11
 
35
application-specific resource files) via function C<LoadResources>().
36
36
 
37
37
=head2 Command Line Options
38
38
 
134
134
=item System Application Defaults Files
135
135
 
136
136
System application defaults files may be specified via environment variable
137
 
$C<XFILESEARCHPATH> which, if set, contains a colon-separated list of file
138
 
patterns.
 
137
$C<XFILESEARCHPATH> which, if set, contains a list of file patterns
 
138
(joined using the OS-dependent path delimiter, e.g. colon on B<UNIX>).
139
139
 
140
140
=item User Application Defaults Files
141
141
 
148
148
 
149
149
=over 4
150
150
 
151
 
=item B<SetArguments>
 
151
=item B<SetArguments> - Tk::CmdLine::SetArguments([@argument])
152
152
 
153
153
Extract the X11 options contained in a specified array (@ARGV by default).
154
154
 
162
162
 
163
163
By default, command line options are extracted from @ARGV the first time
164
164
a MainWindow is created. The Tk::MainWindow constructor indirectly invokes
165
 
C<SetArguments> to do this.
166
 
 
167
 
=item B<cget>
168
 
 
169
 
Get the value of a configuration option specified via C<SetArguments>.
170
 
(C<cget> first invokes C<SetArguments> if it has not already been invoked.)
 
165
C<SetArguments>() to do this.
 
166
 
 
167
=item B<GetArguments> - Tk::CmdLine::GetArguments()
 
168
 
 
169
Get a list of the X11 options that have been processed by C<SetArguments>().
 
170
(C<GetArguments>() first invokes C<SetArguments>() if it has not already been invoked.)
 
171
 
 
172
=item B<cget> - Tk::CmdLine::cget([$option])
 
173
 
 
174
Get the value of a configuration option specified via C<SetArguments>().
 
175
(C<cget>() first invokes C<SetArguments>() if it has not already been invoked.)
171
176
 
172
177
  Tk::CmdLine::cget([$option])
173
178
 
174
179
The valid options are: B<-class>, B<-name>, B<-screen> and B<-title>.
175
180
If no option is specified, B<-class> is implied.
176
181
 
177
 
A typical use of C<cget> might be to obtain the application class in order
178
 
to define the name of a resource file to be loaded in via C<LoadResources>.
 
182
A typical use of C<cget>() might be to obtain the application class in order
 
183
to define the name of a resource file to be loaded in via C<LoadResources>().
179
184
 
180
185
  my $class = Tk::CmdLine::cget(); # process command line and return class
181
186
 
182
 
=item B<SetResources>
 
187
=item B<SetResources> - Tk::CmdLine::SetResources((\@resource | $resource) [, $priority])
183
188
 
184
189
Set the initial resources.
185
190
 
193
198
as defined in L<option|Tk::option>, to be associated with the resources
194
199
(default: I<userDefault>).
195
200
 
196
 
Note that C<SetResources> first invokes C<SetArguments> if it has not already
 
201
Note that C<SetResources>() first invokes C<SetArguments>() if it has not already
197
202
been invoked.
198
203
 
199
 
=item B<LoadResources>
 
204
=item B<LoadResources> - Tk::CmdLine::LoadResources([%options])
200
205
 
201
206
Load initial resources from one or more files.
202
207
 
207
212
      [ -echo     => $fileHandle ] );
208
213
 
209
214
[ B<-symbol> =E<gt> $symbol ] specifies the name of an environment variable
210
 
that, if set, defines a colon-separated list of one or more directories and/or
211
 
file patterns. $C<XUSERFILESEARCHPATH> is a special case.
 
215
that, if set, defines a list of one or more directories and/or file patterns
 
216
(joined using the OS-dependent path delimiter, e.g. colon on B<UNIX>).
 
217
$C<XUSERFILESEARCHPATH> is a special case.
212
218
If $C<XUSERFILESEARCHPATH> is not set, $C<XAPPLRESDIR> is checked instead.
213
219
If $C<XAPPLRESDIR> is not set, $C<HOME> is checked instead.
214
220
 
236
242
printed to the corresponding FileHandle (default: \*STDOUT) everytime a file
237
243
is examined / loaded.
238
244
 
239
 
If no B<-symbol> or B<-file> options are specified, C<LoadResources>
 
245
If no B<-symbol> or B<-file> options are specified, C<LoadResources>()
240
246
processes symbol $C<XFILESEARCHPATH> with priority I<startupFile> and
241
247
$C<XUSERFILESEARCHPATH> with priority I<userDefault>.
242
248
(Note that $C<XFILESEARCHPATH> and $C<XUSERFILESEARCHPATH> are supposed to
243
249
contain only patterns. $C<XAPPLRESDIR> and $C<HOME> are supposed to be a single
244
 
directory. C<LoadResources> does not check/care whether this is the case.)
 
250
directory. C<LoadResources>() does not check/care whether this is the case.)
245
251
 
246
 
For each set of FileSpecs, C<LoadResources> examines each FileSpec to
 
252
For each set of FileSpecs, C<LoadResources>() examines each FileSpec to
247
253
determine if the file exists and is readable. The first file that meets this
248
 
criteria is read in and C<SetResources> is invoked.
 
254
criteria is read in and C<SetResources>() is invoked.
249
255
 
250
 
Note that C<LoadResources> first invokes C<SetArguments> if it has not already
 
256
Note that C<LoadResources>() first invokes C<SetArguments>() if it has not already
251
257
been invoked.
252
258
 
253
259
=back
257
263
This module is an object-oriented module whose methods can be invoked as object
258
264
methods, class methods or regular functions. This is accomplished via an
259
265
internally-maintained object reference which is created as necessary, and which
260
 
always points to the last object used. C<SetArguments>, C<SetResources> and
261
 
C<LoadResources> return the object reference.
 
266
always points to the last object used. C<SetArguments>(), C<SetResources>() and
 
267
C<LoadResources>() return the object reference.
262
268
 
263
269
=head1 EXAMPLES
264
270
 
280
286
 
281
287
@ARGV is processed by Tk::CmdLine before MainWindow creation.
282
288
An @ARGV of (--geometry=100x100 -opt1 a b c -bg red)
283
 
is equal to (-opt1 a b c) after C<SetArguments> is invoked.
 
289
is equal to (-opt1 a b c) after C<SetArguments>() is invoked.
284
290
 
285
291
  use Tk;
286
292
 
388
394
 
389
395
=item B<XFILESEARCHPATH> (optional)
390
396
 
391
 
Colon-separated list of FileSpec patterns used in defining
392
 
system application defaults files.
 
397
List of FileSpec patterns
 
398
(joined using the OS-dependent path delimiter, e.g. colon on B<UNIX>)
 
399
used in defining system application defaults files.
393
400
 
394
401
=item B<XUSERFILESEARCHPATH> (optional)
395
402
 
396
 
Colon-separated list of FileSpec patterns used in defining
397
 
user application defaults files.
 
403
List of FileSpec patterns
 
404
(joined using the OS-dependent path delimiter, e.g. colon on B<UNIX>)
 
405
used in defining user application defaults files.
398
406
 
399
407
=item B<XAPPLRESDIR> (optional)
400
408
 
424
432
(previously the X11 options could not be specified in POSIX format and had to be
425
433
at the beginning of the array).
426
434
 
427
 
Added the C<SetResources> and C<LoadResources> functions to allow the definition
 
435
Added the C<SetResources>() and C<LoadResources>() functions to allow the definition
428
436
of resources prior to MainWindow creation.
429
437
 
 
438
=item *
 
439
 
 
440
2000.08.31 Ben Pavon E<lt>ben.pavon@hsc.hac.comE<gt>
 
441
 
 
442
Added the C<GetArguments>() method which returns the list of arguments that
 
443
have been processed by C<SetArguments>().
 
444
 
 
445
Modified C<LoadResources>() to split the symbols using the OS-dependent
 
446
path delimiter defined in the B<Config> module.
 
447
 
 
448
Modified C<LoadResources>() to eliminate a warning message when processing
 
449
patterns B<%l>, B<%C>, B<%S>.
 
450
 
430
451
=back
431
452
 
432
453
=cut
 
454