Codex

Glib::OptionGroup

Section: User Contributed Perl Documentation (3pm)

Updated: 2014-08-29

Index?action=index Return to Main Contents


NAME

Glib::OptionGroup - group of options for command line option parsing

SYNOPSIS

HIERARCHY

METHODS

optioncontext = Glib::OptionContext->new ($parameter_string)

(string):

optiongroup = Glib::OptionGroup->new (key => value, ...)

Creates a new option group from the given key-value pairs. The valid keys are name, description, help_description, and entries. The first three specify strings while the last one, entries, specifies an array reference of option entries. Example:

An option entry is a hash reference like this:

Of those keys only long_name, arg_type, and arg_value are required. So this is a valid option entry too:

For convenience, option entries can also be specified as array references containing long_name, short_name, arg_type, and arg_value:

If you don't want an option to have a short name, specify undef for it:

$context->add_group ($group)

(Glib::OptionGroup):

$context->add_main_entries ($entries, $translation_domain)

(scalar) reference to an array of option entries:
(string):

boolean = $context->get_help_enabled

$context->set_help_enabled ($help_enabled)

(boolean):

boolean = $context->get_ignore_unknown_options

$context->set_ignore_unknown_options ($ignore_unknown)

(boolean):

optiongroup = $context->get_main_group

$context->set_main_group ($group)

(Glib::OptionGroup):

boolean = $context->parse

This method works directly on @ARGV.

May croak with a Glib::Error in $@ on failure.

$group->set_translate_func ($func, $data=undef)

(scalar):
(scalar):

$group->set_translation_domain ($domain)

(string):

ENUMS AND FLAGS

enum Glib::OptionArg

'none' / 'G_OPTION_ARG_NONE':
'string' / 'G_OPTION_ARG_STRING':
'int' / 'G_OPTION_ARG_INT':
'callback' / 'G_OPTION_ARG_CALLBACK':
'filename' / 'G_OPTION_ARG_FILENAME':
'string-array' / 'G_OPTION_ARG_STRING_ARRAY':
'filename-array' / 'G_OPTION_ARG_FILENAME_ARRAY':
'double' / 'G_OPTION_ARG_DOUBLE':
'int64' / 'G_OPTION_ARG_INT64':

flags Glib::OptionFlags

'hidden' / 'G_OPTION_FLAG_HIDDEN':
'in-main' / 'G_OPTION_FLAG_IN_MAIN':
'reverse' / 'G_OPTION_FLAG_REVERSE':
'no-arg' / 'G_OPTION_FLAG_NO_ARG':
'filename' / 'G_OPTION_FLAG_FILENAME':
'optional-arg' / 'G_OPTION_FLAG_OPTIONAL_ARG':
'noalias' / 'G_OPTION_FLAG_NOALIAS':

SEE ALSO

Glib, Glib::Boxed

COPYRIGHT

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Glib for a full notice.


Index

NAME

SYNOPSIS

HIERARCHY

METHODS

optioncontext = Glib::OptionContext->new ($parameter_string)

optiongroup = Glib::OptionGroup->new (key => value, ...)

$context->add_group ($group)

$context->add_main_entries ($entries, $translation_domain)

boolean = $context->get_help_enabled

$context->set_help_enabled ($help_enabled)

boolean = $context->get_ignore_unknown_options

$context->set_ignore_unknown_options ($ignore_unknown)

optiongroup = $context->get_main_group

$context->set_main_group ($group)

boolean = $context->parse

$group->set_translate_func ($func, $data=undef)

$group->set_translation_domain ($domain)

ENUMS AND FLAGS

enum Glib::OptionArg

flags Glib::OptionFlags

SEE ALSO

COPYRIGHT