NAME

Class::Phrasebook::Simple - make Class::Phrasebook even simpler than it already is.


SYNOPSIS

 
 # In xpath.xml :
 <phrasebook>
  <dictionary name="article">
   <phrase name="title">child::node()[name() = 'title']</phrase>
  </dictionary>
 </phrasebook>
 # In My::Phrasebook.pm :
 package My::Phrasebook;
 use base qw (Class::Phrasebook::Simple);
 use constant PATH_PHRASEBOOK_XPATH => "/path/to/my/xpath.xml";
 return 1;
 # In your program :
 package main;
 use My::Phrasebook qw (:xpath); 
 print My::Phrasebook->xpath("article","title");
 # prints (for example) :
 child::node()[name() = 'title']


DESCRIPTION

Make Class::Phrasebook even simpler than it already is.


PACKAGE METHODS

Package methods are generated at runtime based on the the value(s) passed when the package is loaded. Values must begin with a colon and contain only the letters a-z. (lowercase)

The package's import method will strip the colon and look for a local constant named PATH_PHRASEBOOK_ + value (uppercase)

The value of the constant should be the path to a valid Class::Phrasebook XML file.

For example...

  package main;
  use My::Phrasebook qw (:xpath);
  package My::Phrasebook;
  use base qw (Class::Phrasebook::Simple);
  use constant PATH_PHRASEBOOK_XPATH => "/phrases/xpath.xml";

...will cause an xpath package method to be inserted in to My::Phrasebook's symbol table.

Each method takes (2) arguments:

For example:

  my $value = My::Phrasebook->xpath("article","title");


VERSION

0.1


DATE

$Date: 2003/06/13 00:34:10 $


AUTHOR

Aaron Straup Cope


SEE ALSO

the Class::Phrasebook manpage


LICENSE

Copyright (c) 2003, Aaron Straup Cope. All Rights Reserved.

This is free software, you may use it and distribute it under the same terms as Perl itself.