The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

XTM::AsTMa - Topic Map Parsing of AsTMa instances.

SYNOPSIS

  # reading a topic map description from a file/url
  $atm = new XTM::AsTMa (file => 'mymap.atm');
  $tm  = $atm->sync_in();

DESCRIPTION

This package provides parsing functionality for AsTMA instances as described in the package documentation (doc directory) or at

http://topicmaps.bond.edu.au/astma/

Currently, only AsTMa= is supported, with the following constraints/additions:

no macro support (deprecated in the language).
following directives are supported:
%cancel

Cancels the parse process on this very line and ignores the rest of the AsTMa instance. Useful for debugging faulty maps. There is an appropriate line written to STDERR.

%log [ message ]

Writes a line to STDERR reporting the line number and an optional message. Useful for debugging.

A directive can be inserted anywhere in the document.

INTERFACE

Constructor

The constructor expects a hash as parameter containing one of the following fields:

url:

If given, then the AsTMa instance will be read from this url.

file:

If given, then the AsTMa data will be read from this file (This is just a convenience function as it will be mapped to url).

text:

If given, then the AsTMa instance will be read directly from this text. (See method text how to retrieve the current value).

auto_complete

If set to 0, the AsTMa loader will NOT try to automatically generate topics which have been mentioned without being declared.

If several fields (file, url, text) are specified, it is undefined which one will be taken.

Examples:

   $atm = new XTM::AsTMa (file => 'here.atm');
   $atm = new XTM::AsTMa (url  => 'file:here.atm',  # the same
                          auto_complete => 0);      # but with auto_completion turned off
   $atm = new XTM::AsTMa (text => '# this is AsTMa');

Methods

last_mod

returns the UNIX time when the resource has been modified last. undef is returned if the result cannot be determined.

sync_in

loads an AsTMa instance and returns a XTM::Memory object. Note that that all undefined topics will be defined automatically, unless auto_complete is set to 0.

sync_out

is not implemented.

SEE ALSO

XTM

AUTHOR INFORMATION

Copyright 2001, 2002, Robert Barta <rho@telecoma.net>, All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. http://www.perl.com/perl/misc/Artistic.html