The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

LotusNotes::LoadExport - A module to automate the processing of LotusNotes text export files

SYNOPSIS

 #! perl -w
 use strict;
 use LotusNotes::LoadExport;
 use Data::Dumper;
 $Data::Dumper::Indent = 1;

 my @labels = (qw{ VersionLic AppName Version UserID WorkstationID });
 # Here application_license.txt is a LotusNotes export (see DESCRIPTION below)
 my $ln     = LotusNotes::LoadExport->new(filename => 'application_license.txt', fieldnames => \@labels);

 # Get ALL the data (you may not want to do this - see next below)
 my $data   = $ln->load();
 print Dumper($data), "\n";
 exit;

 # Iterator based data access
 while (my $data = $ln->get_next())
 {
     # Do something with each record
     print Dumper($data), "\n";
 }


 Example output:

 $VAR1 = [
  {
    'AppName' => 'ABC Flowcharter',
    'Version' => '7.0',
    'WorkstationID' => 'PC-1234',
    'UserID' => 'tom.smith',
    'VersionLic' => '7.0'
  },
  {
    'AppName' => 'MS-Access',
    'Version' => '2007',
    'WorkstationID' => 'PC-3043',
    'UserID' => 'sally.jones'
  }
 ];

DESCRIPTION

This module is designed to read text files generated from a LotusNotes 'Structured Text' export. Normally the 'Word wrap within documents' entry (as part of the export) is set to 999 characters (as many 9's as you can enter in the field). The 'Separator between documents' is assumed to be linefeed (the export default).

Load records from a Lotus Notes database export.

Expects an array reference of fields to extract.

Returns an array reference of hashes where each hash represents a record

METHODS

new

Create the LotusNotes::LoadExport object. There are two reqired named arguments: filename and fieldnames. The filename is the name of the 'Lotus Notes' export file. fieldnames is an array reference to a list of the labels from the 'Lotus Notes' export file that you are interested in. See synopsis above.

get_next

The method get_next is an iterator, returning the next record until all records are processed at which point undef is returned. This is more efficent then the load() method

load

This method returns all records in one hit, which has the disadvantage of allocating more memory compared with the iterator get_next()

KNOWN ISSUES

Currently multi line records are not supported - you only get the first line.

Calling load() returns ALL the data for the fields specified, using get_next() an iterator method may be a better alternative

SAMPLE DATA

### Below is a typical export record (not the \f as the record separator) RefNo: 2 AppName: ABC Flowcharter Version: 7.0 AppNameLic: ABC Flowcharter VersionLic: 7.0 UserGroup: Tar Pit UserName: Gavin Sticky UserID: g.sticky WorkstationID: BB10202 LicenceProof: Purchase Order PONumber: AXS0311062 LastEditor: Road Runner TimesModified: 0 PastAuthors: Road Runner PastEditDates: 29/01/99 16:30:58 CreatedBy: Road Runner CreatedDate: 29/01/1999 05:29:49 PM Business: Acme Ownership: Head Honcho $UpdatedBy: CN=Road Runner/OU=AU/OU=ITS/O=Acme,CN=Acme Template Designer/O=Acme $Revisions: 29/01/1999 05:29:49 PM,29/01/1999 05:30:58 PM,11/03/1999 02:50:25 PM

RefNo: 7 AppName: ABC Flowcharter Version: 7.0 AppNameLic: ABC Flowcharter VersionLic: 7.0 UserGroup: Acme Glue UserName: Marcus Scrooge UserID: m.scrooge WorkstationID: BB38484 LicenceProof: Purchase Order PONumber: AXS0311062 LastEditor: Road Runner TimesModified: 0 PastAuthors: Road Runner PastEditDates: 29/01/99 16:30:58 CreatedBy: Road Runner CreatedDate: 29/01/1999 05:29:50 PM Business: Acme Ownership: Head Honcho $UpdatedBy: CN=Road Runner/OU=AU/OU=ITS/O=Acme,CN=Acme Template Designer/O=Acme $Revisions: 29/01/1999 05:29:49 PM,29/01/1999 05:30:58 PM,11/03/1999 02:50:25 PM

RefNo: 8 AppName: ABC Flowcharter Version: 7.0 AppNameLic: ABC Flowcharter VersionLic: 7.0 UserGroup: Acme Glue UserName: Mark Tube UserID: m.tube WorkstationID: BB93932 LicenceProof: Purchase Order PONumber: AXS0311062 LastEditor: Road Runner TimesModified: 0 PastAuthors: Road Runner PastEditDates: 29/01/99 16:30:58 CreatedBy: Road Runner CreatedDate: 29/01/1999 05:29:50 PM Business: Acme Ownership: Head Honcho $UpdatedBy: CN=Road Runner/OU=AU/OU=ITS/O=Acme,CN=Acme Template Designer/O=Acme $Revisions: 29/01/1999 05:29:49 PM,29/01/1999 05:30:58 PM,11/03/1999 02:50:25 PM

CVS ID

 $Id: LoadExport.pm,v 1.1 2009/06/20 08:22:53 Greg Exp $

CVS LOG

 $Log: LoadExport.pm,v $
 Revision 1.1  2009/06/20 08:22:53  Greg
 - Initial development

 Revision 1.2  2008/12/15 05:55:24  gxg6
 - Change to allow handling of last record without a \f to finish

AUTHOR

 Greg George, IT Technology Solutions P/L,
 Mobile: 0404-892-159, Email: gng@cpan.org

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc LotusNotes::LoadExport

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2009 Greg George, all rights reserved.

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