| Oryx documentation | Contained in the Oryx distribution. |
Oryx::DBM::Util - Oryx DBM utilities
The following methods are defined to manipulate a DBM::Deep database schema.
Returns a true value if the table named $table exists within $dbm.
Creates a table named $table in $dbm.
Drops the table named $table in $dbm.
Richard Hundt <richard NO SPAM AT protea-systems.com>
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
Copyright (c) 2005 Richard Hundt.
This library is free software and may be used under the same terms as Perl itself.
| Oryx documentation | Contained in the Oryx distribution. |
package Oryx::DBM::Util; use File::Spec; use DBM::Deep; sub new { my $class = shift; return bless { }, $class; } sub table_exists { my ($self, $dbm, $table) = @_; return -e File::Spec->catfile($dbm->datapath, $table); } sub table_create { my ($self, $dbm, $table) = @_; my $filename = File::Spec->catfile($dbm->datapath, $table); $dbm->catalog->put( $table, { file => $filename, type => DBM::Deep::TYPE_ARRAY, autoflush => 1, locking => 1, }); } sub table_drop { my ($self, $dbm, $table) = @_; my $meta = $dbm->catalog->get( $table ); return unless $meta; # not defined for link tables unlink $meta->{file}; $dbm->catalog->delete( $table ); } 1; __END__