/[Search-Estraier]/trunk/Estraier.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/Estraier.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations)
Wed Jan 4 13:11:43 2006 UTC (18 years, 2 months ago) by dpavlin
File size: 2598 byte(s)
begin work on pure perl implementation of HyperEstraier module
1 package Search::Estraier;
2
3 use 5.008;
4 use strict;
5 use warnings;
6
7 require Exporter;
8
9 our @ISA = qw(Exporter);
10
11 our %EXPORT_TAGS = ( 'all' => [ qw(
12 ) ] );
13
14 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
15
16 our @EXPORT = qw(
17 );
18
19 our $VERSION = '0.00';
20
21 use Carp;
22
23 =head1 NAME
24
25 Search::Estraier - pure perl module to use Hyper Estraier search engine
26
27 =head1 SYNOPSIS
28
29 use Search::Estraier;
30 my $est = new Search::Estraier();
31
32 =head1 DESCRIPTION
33
34 This module is implementation of node API of Hyper Estraier. Since it's
35 perl-only module with dependencies only on standard perl modules, it will
36 run on all platforms on which perl runs. It doesn't require compilation
37 or Hyper Estraier development files on target machine.
38
39 It is implemented as multiple packages which closly resamble Ruby
40 implementation. It also includes methods to manage nodes.
41
42 =cut
43
44 package Search::Estraier::Document;
45
46 =head1 Search::Estraier::Document
47
48 Document for HyperEstraier
49
50 =head2 new
51
52 my $doc = new Search::HyperEstraier::Document;
53
54 =cut
55
56 sub new {
57 my $class = shift;
58 my $self = {@_};
59 bless($self, $class);
60
61 $self ? return $self : return undef;
62 }
63
64 =head2 add_attr
65
66 $doc->add_attr( name => 'value' );
67
68 =cut
69
70 sub add_attr {
71 my $self = shift;
72 my $attrs = {@_};
73
74 while (my ($name, $value) = each %{ $attrs }) {
75 $name =~ s/\s\s+/ /gs;
76 $value =~ s/\s\s+/ /gs;
77 push @{$self->{$name}}, $value;
78 }
79 }
80
81
82
83 package Search::Estraier::Master;
84
85 use Carp;
86
87 =head1 Search::Estraier::Master
88
89 Controll node master. This requires user with administration priviledges.
90
91 =cut
92
93 {
94 package RequestAgent;
95 @ISA = qw(LWP::UserAgent);
96
97 sub new {
98 my $self = LWP::UserAgent::new(@_);
99 $self->agent("Search-Estraier/$Search::Estraer::VERSION");
100 $self;
101 }
102
103 sub get_basic_credentials {
104 my($self, $realm, $uri) = @_;
105 # return ($user, $password);
106 }
107 }
108
109
110
111 =head2 new
112
113 Create new connection to node master.
114
115 my $master = new Search::Estraier::Master(
116 url => 'http://localhost:1978',
117 user => 'admin',
118 passwd => 'admin',
119 );
120
121 =cut
122
123 sub new {
124 my $class = shift;
125 my $self = {@_};
126 bless($self, $class);
127
128 foreach my $p (qw/url user passwd/) {
129 croak "need $p" unless ($self->{$p});
130 }
131
132 $self ? return $self : return undef;
133 }
134
135
136
137 ###
138
139 =head1 EXPORT
140
141 Nothing.
142
143 =head1 SEE ALSO
144
145 L<http://hyperestraier.sourceforge.net/>
146
147 Hyper Estraier Ruby interface on which this module is based.
148
149 =head1 AUTHOR
150
151 Dobrica Pavlinusic, E<lt>dpavlin@rot13.orgE<gt>
152
153
154 =head1 COPYRIGHT AND LICENSE
155
156 Copyright (C) 2005 by Dobrica Pavlinusic
157
158 This library is free software; you can redistribute it and/or modify
159 it under the GPL v2 or later.
160
161 =cut
162
163 1;

  ViewVC Help
Powered by ViewVC 1.1.26