DOKK / manpages / debian 12 / libgedcom-perl / Gedcom::Grammar.3pm.en
Gedcom::Grammar(3pm) User Contributed Perl Documentation Gedcom::Grammar(3pm)

Gedcom::Grammar - a module to manipulate GEDCOM grammars

Version 1.22 - 15th November 2019

  use Gedcom::Grammar;
  my $st = $grammar->structure("GEDCOM");
  my @sgr = $grammar->item("DATE");
  my @items = $grammar->valid_items;
  my $min = $grammar->min;
  my $max = $grammar->max;
  my @items = $grammar->items;

A selection of subroutines to handle the grammar of a GEDCOM file.

Derived from Gedcom::Item.

Some of the more important hash members are:

The top of the grammar tree.

A reference to a hash mapping the names of all structures to the grammar objects.

  my $st = $grammar->structure("GEDCOM");

Return the grammar item of the specified structure, if it exists, or undef.

  my @sgr = $grammar->item("DATE");

Return a list of the possible grammar items of the specified sub-item, if it exists.

  my $min = $grammar->min;

Return the minimum permissible number of $grammar items

  my $max = $grammar->max;

Return the maximum permissible number of $grammar items

  my @items = $grammar->items;

Return a list of tags of the grammar's sub-items

  my @items = $grammar->valid_items;

Return a hash detailing all the valid sub-items of the grammar item. The key is the tag of the sub-item and the value is an array of hashes with three members:

  grammar => the sub-item grammar
  min     => the minimum permissible number of these sub-items
  max     => the maximum permissible number of these sub-items
2022-10-16 perl v5.34.0