1Glib::OptionContext(3)User Contributed Perl DocumentationGlib::OptionContext(3)
2
3
4

NAME

6       Glib::OptionContext
7

SYNOPSIS

9         my ($verbose, $source, $filenames) = ('', undef, []);
10
11         my $entries = [
12           { long_name => 'verbose',
13             short_name => 'v',
14             arg_type => 'none',
15             arg_value => \$verbose,
16             description => 'be verbose' },
17
18           { long_name => 'source',
19             short_name => 's',
20             arg_type => 'string',
21             arg_value => \$source,
22             description => 'set the source',
23             arg_description => 'source' },
24
25           [ 'filenames', 'f', 'filename-array', \$filenames ],
26         ];
27
28         my $context = Glib::OptionContext->new ('- urgsify your life');
29         $context->add_main_entries ($entries, 'C');
30         $context->parse ();
31
32         # $verbose, $source, and $filenames are now updated according to the
33         # command line options given
34

HIERARCHY

36         Glib::Boxed
37         +----Glib::OptionContext
38

METHODS

40   optioncontext = Glib::OptionContext->new ($parameter_string)
41       ·   $parameter_string (string)
42
43   $context->add_group ($group)
44       ·   $group (Glib::OptionGroup)
45
46   $context->add_main_entries ($entries, $translation_domain)
47       ·   $entries (scalar) reference to an array of option entries
48
49       ·   $translation_domain (string)
50
51   boolean = $context->get_help_enabled
52   $context->set_help_enabled ($help_enabled)
53       ·   $help_enabled (boolean)
54
55   boolean = $context->get_ignore_unknown_options
56   $context->set_ignore_unknown_options ($ignore_unknown)
57       ·   $ignore_unknown (boolean)
58
59   optiongroup = $context->get_main_group
60   $context->set_main_group ($group)
61       ·   $group (Glib::OptionGroup)
62
63   boolean = $context->parse
64       This method works directly on @ARGV.
65
66       May croak with a Glib::Error in $@ on failure.
67

SEE ALSO

69       Glib, Glib::Boxed
70
72       Copyright (C) 2003-2009 by the gtk2-perl team.
73
74       This software is licensed under the LGPL.  See Glib for a full notice.
75
76
77
78perl v5.12.1                      2010-07-07            Glib::OptionContext(3)
Impressum