Glib::OptionContext(3p)

NAME
Glib::OptionContext

SYNOPSIS
  my ($verbose, $source, $filenames) = ('', undef, []);

  my $entries = [
    { long_name => 'verbose',
      short_name => 'v',
      arg_type => 'none',
      arg_value => \$verbose,
      description => 'be verbose' },

    { long_name => 'source',
      short_name => 's',
      arg_type => 'string',
      arg_value => \$source,
      description => 'set the source',
      arg_description => 'source' },

    [ 'filenames', 'f', 'filename-array', \$filenames ],
  ];

  my $context = Glib::OptionContext->new ('- urgsify your life');
  $context->add_main_entries ($entries, 'C');
  $context->parse ();

  # $verbose, $source, and $filenames are now updated according to the
  # command line options given

HIERARCHY
  Glib::Boxed
  +----Glib::OptionContext

METHODS

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

•   $parameter_string (string)

  $context->add_group ($group)

•   $group (Glib::OptionGroup)

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

•   $entries (scalar) reference to an array of option entries

•   $translation_domain (string)

  boolean = $context->get_help_enabled

  $context->set_help_enabled ($help_enabled)

•   $help_enabled (boolean)

  boolean = $context->get_ignore_unknown_options

  $context->set_ignore_unknown_options ($ignore_unknown)

•   $ignore_unknown (boolean)

  optiongroup = $context->get_main_group

  $context->set_main_group ($group)

•   $group (Glib::OptionGroup)

  boolean = $context->parse
This method works directly on @ARGV.

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

SEE ALSO
Glib, Glib::Boxed

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

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