/[webpac2]/trunk/lib/WebPAC/Input.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/lib/WebPAC/Input.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3 - (show annotations)
Sat Jul 16 11:07:38 2005 UTC (18 years, 9 months ago) by dpavlin
File size: 2845 byte(s)
moved implementation of lookups from older code-base

1 package WebPAC::Input;
2
3 use warnings;
4 use strict;
5
6 =head1 NAME
7
8 WebPAC::Input - core module for input file format
9
10 =head1 VERSION
11
12 Version 0.01
13
14 =cut
15
16 our $VERSION = '0.01';
17
18 =head1 SYNOPSIS
19
20 This module will load particular loader module and execute it's functions.
21
22 Perhaps a little code snippet.
23
24 use WebPAC::Input;
25
26 my $db = WebPAC::Input->new(
27 format => 'NULL',
28 config => $config,
29 );
30
31 $db->open('/path/to/database');
32 print "database size: ",$db->size,"\n";
33 while (my $row = $db->fetch) {
34 ...
35 }
36 $db->close;
37
38 =head1 FUNCTIONS
39
40 =head2 new
41
42 Create new input database object.
43
44 my $db = new WebPAC::Input( format => 'NULL' );
45
46 This function will load needed wrapper module and
47
48 =cut
49
50 sub new {
51 my $class = shift;
52 my $self = {@_};
53 bless($self, $class);
54
55 $self ? return $self : return undef;
56 }
57
58 =head2 open
59
60 =cut
61
62 sub open {
63 }
64
65 =head2 function2
66
67 =cut
68
69 sub function2 {
70 }
71
72
73
74 =head1 MEMORY USAGE
75
76 C<low_mem> options is double-edged sword. If enabled, WebPAC
77 will run on memory constraint machines (which doesn't have enough
78 physical RAM to create memory structure for whole source database).
79
80 If your machine has 512Mb or more of RAM and database is around 10000 records,
81 memory shouldn't be an issue. If you don't have enough physical RAM, you
82 might consider using virtual memory (if your operating system is handling it
83 well, like on FreeBSD or Linux) instead of dropping to L<DBM::Deep> to handle
84 parsed structure of ISIS database (this is what C<low_mem> option does).
85
86 Hitting swap at end of reading source database is probably o.k. However,
87 hitting swap before 90% will dramatically decrease performance and you will
88 be better off with C<low_mem> and using rest of availble memory for
89 operating system disk cache (Linux is particuallary good about this).
90 However, every access to database record will require disk access, so
91 generation phase will be slower 10-100 times.
92
93 Parsed structures are essential - you just have option to trade RAM memory
94 (which is fast) for disk space (which is slow). Be sure to have planty of
95 disk space if you are using C<low_mem> and thus L<DBM::Deep>.
96
97 However, when WebPAC is running on desktop machines (or laptops :-), it's
98 highly undesireable for system to start swapping. Using C<low_mem> option can
99 reduce WecPAC memory usage to around 64Mb for same database with lookup
100 fields and sorted indexes which stay in RAM. Performance will suffer, but
101 memory usage will really be minimal. It might be also more confortable to
102 run WebPAC reniced on those machines.
103
104
105 =head1 AUTHOR
106
107 Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >>
108
109 =head1 COPYRIGHT & LICENSE
110
111 Copyright 2005 Dobrica Pavlinusic, All Rights Reserved.
112
113 This program is free software; you can redistribute it and/or modify it
114 under the same terms as Perl itself.
115
116 =cut
117
118 1; # End of WebPAC::Input

  ViewVC Help
Powered by ViewVC 1.1.26