BTRIEVE::SAVE

Perl extension to manipulate BTRIEVE SAVE records
Download

BTRIEVE::SAVE Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Derek Lane
  • Publisher web site:
  • http://search.cpan.org/~dlane/

BTRIEVE::SAVE Tags


BTRIEVE::SAVE Description

Perl extension to manipulate BTRIEVE SAVE records BTRIEVE::SAVE is a Perl module for reading in, manipulating, and outputting Pervasive's save file format for its Btrieve products.BTRIEVE::SAVE uses BTRIEVE::SAVE::REC which abstracts an individual record in the entire file.You must have a config file for your save file: this allows BTRIEVE::SAVE::REC to analyse the fixed parts and find the variable parts of each BTRIEVE::SAVE record.SYNOPSIS use BTRIEVE::SAVE my $btr = BTRIEVE::SAVE->new('cc057.std','cc057.dar'); $btr->parse_file(); my $recs = $btr->{'array'}; for (@$recs) { my($rhfixed,$rfixed,$rvar)=@{$_->{values}}; print $rhfixed->{'Title'}."\n"; } # Often the first record is some kind of header. Generally one # treats header records differently from those that follow. E.g., # they often have counts of the following records that must be # adjusted if we are gonna kill or add records. Here we leave it # alone. my $output = ""; $header=shift @$recs; my $data = $header->fixed.$header->var; $output .= $header->counted_rec($data); foreach my $rec (@$recs) { my($rhfixed,$rfixed,$rvar)=@{$rec->{values}}; $rhfixed->{'Title'} =~s/^\s*the/The/; $output .=$rec->counted_rec_hash(); } $output .="\cZ"; # now $output is a legal Btrieve save record. # For large records, one may want to do everything incrementally. open OUT,">>cc057.das" or die "Could not open cc057.das for append: $!\n"; binmode OUT; my $incbtr = BTRIEVE->new('cc057.std','cc057.dar'); my $header = $incbtr->next_rec(); my $data = $header->fixed.$header->var; print OUT $header->counted_rec($data); while (defined( my $rec=$incbtr->next_rec) ) { my($rhfixed,$rfixed,$rvar)=@{$rec->{values}}; $rhfixed->{'Title'} =~s/^\s*the/The/; print OUT $rec->counted_rec_hash(); } print OUT "\cZ"; close OUT or die "Could not close cc057.das: $!\n"; Requirements: · Perl


BTRIEVE::SAVE Related Software