Hints::Base - Perl extension for hints program storage databases


SchemaView-Plus documentation Contained in the SchemaView-Plus distribution.

Index


Code Index:

NAME

Top

Hints::Base - Perl extension for hints program storage databases

SYNOPSIS

Top

	use Hints::Base;

	my $hints = new Hints::Base 'program';

	print $hints->random();

DESCRIPTION

Top

Specialized version of Hints(3) extension. This variant can be used for internal program storage database of hints. Descendant contents databases, this module implement loading of databases from internal data storage.

THE HINTS::BASE CLASS

Top

init

Loading data storage between __DATA__ and __END__ or EOF tags. Using default separator.

VERSION

Top

0.02

AUTHOR

Top

(c) 2001 Milan Sorm, sorm@pef.mendelu.cz at Faculty of Economics, Mendel University of Agriculture and Forestry in Brno, Czech Republic.

This module was needed for making SchemaView Plus (svplus) for making user-friendly interface.

SEE ALSO

Top

perl(1), svplus(1), Hints(3), Hints::Base::svplus(3).


SchemaView-Plus documentation Contained in the SchemaView-Plus distribution.
package Hints::Base;

use strict;
use Hints;
use IO::Handle;
use vars qw/$VERSION @ISA/;

$VERSION = '0.02';
@ISA = qw/Hints/;

sub init {
	my $obj = shift;
	my $next = shift;
	if ($next) {
		my $nextname = "Hints::Base::$next";
		eval "package Hints::Base::_safe; require $nextname;";
		unless ($@) {	# database
			$nextname->import();
			return $nextname->new(@_);
		}
	}
	my @data = ();
	my $sourcepkg = ref $obj;
	no strict 'refs';
	my $fh = \*{"${sourcepkg}::DATA"};
	use strict 'refs';
	while (<$fh>) {
		last if /^__END__$/;
		push @data,$_;
	}
	$obj->load_from_file(\@data);
	$obj;
}

1;

__DATA__
__END__