DBD-XBase
view release on metacpan or search on metacpan
lib/XBase.pm view on Meta::CPAN
a row. The method can have parameters in a form of a hash with the
following keys:
=over 4
=item rs
Record separator, string, newline by default.
=item fs
Field separator, string, one colon by default.
=item fields
Reference to a list of names of the fields to print. By default it's
undef, meaning all fields.
=item undef
What to print for undefined (NULL) values, empty string by default.
=back
Example of use is
use XBase;
my $table = new XBase "table" or die XBase->errstr;
$table->dump_records("fs" => " | ", "rs" => " <-+\n",
"fields" => [ "id", "msg" ]);'
Also note that there is a script dbfdump(1) that does the printing.
=head2 Errors and debugging
If the method fails (returns false or null list), the error message
can be retrieved via B<errstr> method. If the B<new> or B<create>
method fails, you have no object so you get the error message using
class syntax C<XBase-E<gt>errstr()>.
The method B<header_info> returns (not prints) string with
information about the file and about the fields.
Module XBase::Base(3) defines some basic functions that are inherited
by both XBase and XBase::Memo(3) module.
=head1 DATA TYPES
The character fields are returned "as is". No charset or other
translation is done. The numbers are converted to Perl numbers. The
date fields are returned as 8 character string of the 'YYYYMMDD' form
and when inserting the date, you again have to provide it in this
form. No checking for the validity of the date is done. The datetime
field is returned in the number of (possibly negative) seconds since
1970/1/1, possibly with decimal part (since it allows precision up to
1/1000 s). To get the fields, use the gmtime (or similar) Perl function.
If there is a memo field in the dbf file, the module tries to open
file with the same name but extension dbt, fpt or smt. It uses module
XBase::Memo(3) for this. It reads and writes this memo field
transparently (you do not know about it) and returns the data as
single scalar.
=head1 INDEX, LOCKS
B<New:> A support for ndx, ntx, mdx, idx and cdx index formats is
available with alpha status for testing. Some of the formats are
already rather stable (ndx). Please read the XBase::Index(3) man page
and the eg/use_index file in the distribution for examples and ideas.
Send me examples of your data files and suggestions for interface if
you need indexes.
General locking methods are B<locksh>, B<lockex> and B<unlock> for
shared lock, exclusive lock and unlock. They call flock but you can
redefine then in XBase::Base package.
=head1 INFORMATION SOURCE
This module is built using information from and article XBase File
Format Description by Erik Bachmann, URL
http://www.clicketyclick.dk/databases/xbase/format/
Thanks a lot.
=head1 VERSION
1.08
=head1 AVAILABLE FROM
http://www.adelton.com/perl/DBD-XBase/
=head1 AUTHOR
(c) 1997--2017 Jan Pazdziora.
All rights reserved. This package is free software; you can
redistribute it and/or modify it under the same terms as Perl itself.
Contact the author at jpx dash perl at adelton dot com.
=head1 THANKS
Many people have provided information, test files, test results and
patches. This project would not be so great without them. See the
Changes file for (I hope) complete list. Thank you all, guys!
Special thanks go to Erik Bachmann for his great page about the
file structures; to Frans van Loon, William McKee, Randy Kobes and
Dan Albertsson for longtime cooperation and many emails we've
exchanged when fixing and polishing the modules' behaviour; and to
Dan Albertsson for providing support for the project.
=head1 SEE ALSO
perl(1); XBase::FAQ(3); DBD::XBase(3) and DBI(3) for DBI interface;
dbfdump(1)
=cut
( run in 1.553 second using v1.01-cache-2.11-cpan-39bf76dae61 )