• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

lib/H28-Jan-2015-4,8112,748

t/H03-May-2022-275182

ChangesH A D28-Jan-20153.3 KiB11473

LICENSEH A D27-Oct-201418 KiB380292

MANIFESTH A D28-Jan-2015939 4039

MANIFEST.SKIPH A D28-Jan-2015328 3634

META.jsonH A D28-Jan-20152 KiB7776

META.ymlH A D28-Jan-2015880 3332

Makefile.PLH A D28-Jan-20154.5 KiB120108

READMEH A D27-Oct-20143.5 KiB12086

README

1README FILE FOR PERL MODULE -- AnyData
2
3WHY USE IT?
4
5The AnyData modules provide simple and uniform access to data from
6many sources -- perl arrays, local files, remote files retrievable via
7http or ftp -- and in many formats including flat files (CSV, Fixed
8Length, Tab Delimited, etc), standard format files (Web Logs,
9Passwd files, etc.),  structured files (XML, HTML Tables) and binary
10files with parseable headers (mp3s, jpgs, pngs, etc).
11
12There are two separate modules, each providing a different interface:
13AnyData.pm provides a simple tied hash interface and DBD::AnyData
14provides a DBI/SQL interface.  You can use either or both depending on
15your needs.
16
17Here are a few examples of the tied hash interface:
18
19  # FIND A USER'S HOME DIRECTORY IN A PASSWD FILE
20  #
21  my $users = adTie( 'Passwd', '/etc/passwd' );
22  print $users->{jdoe}->{homedir};
23
24  # DELETE A PLAYER FROM A PIPE DELIMITED GAMES DATABASE
25  #
26  my $players = adTie( 'Pipe', 'games.db', 'u' );
27  delete $players->{jdoe};
28
29  # RECURSIVELY LIST THE ARTISTS FOR ALL REGGAE MP3s
30  # IN A SPECIFIED DIRECTORY TREE
31  #
32  my $music = adTie( 'Mp3', ['c:/My Music/'] );
33  while ( my $song = each %$music ) {
34      print $song->{artist},"\n" if $song->{genre} eq 'Reggae';
35  }
36
37  # RETRIEVE A CSV FILE FROM AN FTP SERVER
38  # AND PRINT IT TO THE SCREEN AS AN HTML TABLE
39  #
40  # print adConvert( 'CSV', 'ftp://foo.edu/pub/bar.csv', 'HTMLtable' );
41
42  # COUNT THE NUMBER OF HITS FOR A SPECIFIED PAGE IN A WEB LOG
43  #
44  my $hits = adTie( 'Weblog', 'access.log');
45  print adCount( $hits , request => 'mypage.html' );
46
47  # CREATE A CGI POP-UP MENU FROM A LISTING
48  # OF THE VALUES OF A TABLE COLUMN
49  #
50  my $game = adTie( 'Pipe','games.db' );
51  my @players  = adColumn( $game, 'player' );
52  print CGI::popup_menu( 'players', \@players );
53
54  # SELECT OR MODIFY MULTIPLE ROWS BASED ON COMPLEX CRITERIA
55  # (this deletes all North American males over age 30)
56  #
57  my $data = adTie( 'Tab', 'mydb.tab');
58  delete $data->{{ country => qr/us|mx|ca/,
59                   gender  => 'eq m',
60                   age     => '> 30',
61                }};
62
63WHAT ELSE DO I NEED?
64
65     * Perl
66
67     * Additional modules are required for some advanced features,
68       see 'perldoc AnyData'.
69
70HOW DO I INSTALL IT?
71
72     1.  Install Perl if not already installed
73
74     2.  Unpack the compressed files.
75         (AnyData-version.tar.gz or AnyData-version.zip)
76
77     3a. If you are not familiar with the standard Perl
78         makefile method, you can simply copy the files
79
80     3b. If you are familiar with the standard Perl make
81         installation, just do as always (perl Makefile.PL;
82         make; make test; make install) this should also
83         work with dmake or nmake.
84
85HOW DO I USE IT?
86
87     First you might like to try this simple script which
88     creates a database and inserts the string "hello new world"
89     into a record  and then retrieves the record and prints it:
90
91     #!perl -w
92     use strict;
93     use AnyData;
94     my $table = adTie ('CSV','test.db','o',{cols=>'id,phrase'});
95     $table->{1} = {phrase=>'hello new world'};
96     print $table->{1}->{phrase}.
97
98WHERE CAN I GET MORE INFO?
99
100     After installing the module, type "perldoc AnyData" at
101     the command prompt, or just read the documentation at
102     the bottom of the AnyData.pm file.
103
104WHO DUNNIT?
105
106  Jeff Zucker <jeff@vpservices.com>
107
108  Feel free to email me comments and suggestions, but please
109  post questions requiring a response to the comp.lang.perl.modules
110  newsgroup.
111
112READ MORE AND GRAB THE MODULE AT
113
114   http://www.vpservices.com/jeff/programs/AnyData/
115
116Enjoy!
117
118
119
120