The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Religion::Bible::Reference - canonicalize shorthand bible references

VERSION

version 0.016

SYNOPSIS

 use Religion::Bible::Reference;

 my $quote = bibref("jn8:32");

 print "($quote)";   # (John 8:32)
 print $quote->book; # John

DESCRIPTION

This module converts simple text descriptions of bible references and ranges into objects that stringify into a canonical form.

WARNING! This module is mostly an idea and not so much a guaranteed interface or well-tested implementation. If you're interested in either of those existing, you should let me know.

METHODS

new

  my $ref = Religion::Bible::Reference->new($ref_string)

This method acts just like the exported bibref function.

stringify

  $self->stringify

This method returns a string representing the reference, using the canonical book name.

stringify_short

  my $str = $self->stringify_short

This method returns a string representing the reference, using the short book name.

In other words, John 8:32 would be Jn 8:32. All short forms should safely round-trip back via parsing.

canonicalize_book

  my $book = $class->canonicalize_book($book_abbrev)

If possible, this method returns the canonical name of the book whose abbreviation was passed.

validate_verse

  $class->validate_verse($book, $chapter, $verse)

This method returns true if the given book, chapter, and verse exists; otherwise it returns false.

iterator

  my $iterator = $bibref->iterator;

  while (my $verse = $iterator->next) {
    my $text = retrieve($verse);
    print "$text\n";
  }

FUNCTIONS

bibref

  my $ref = bibref($ref_string)

This function is exported by default, and constructs a new Religion::Bible::Reference

Reference strings must be a book followed by a list of chapters, verses, or ranges. The following are all valid ranges:

  Pro 23:12, 23:15-17
  st.jn8:32
  Song of Solomon 8:7-8
  2 John 1

TODO

  • allow Text::Abbrev instead of registered abbrevs

  • clean up regex/lists

  • make public the interface to load modules of books and abbreviations

  • make an interface to unload modules

AUTHOR

Ricardo SIGNES <rjbs@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2005 by Ricardo SIGNES.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.