source: trunk/lib/Epoll/DB/ImportV.pm @ 319

Last change on this file since 319 was 319, checked in by nanardon, 14 years ago
  • support of several poll type
  • remove static result storage
  • Property svn:keywords set to Id
File size: 1019 bytes
Line 
1package Epoll::DB::ImportV;
2
3use strict;
4use warnings;
5use YAML;
6
7sub new {
8    my ($class, $type) = @_;
9
10    my $ctype = ucfirst(lc($type));
11   
12    eval "require Epoll::DB::ImportV::$ctype;";
13    if ($@) { return; }
14    else {
15        return bless({}, "Epoll::DB::ImportV::$ctype");
16    }
17}
18
19sub auth_type {
20    my ($self) = @_;
21    ((ref $self) =~ /::([^:]+)$/)[0];
22}
23
24sub load_web_params {
25    my ($self, $c) = @_;
26    $self->{params} = { %{ $c->req->params || {} } };
27} 
28
29sub xml_params { dump_params(@_) }
30
31sub dump_params {
32    my ($self) = @_;
33    YAML::Dump($self->{params});
34}
35
36sub load_xml_params { load_dump_params(@_) }
37
38sub load_dump_params {
39    my ($self, $data) = @_;
40    $self->{params} = YAML::Load($data);
41    1;
42}
43
44sub can_authenticate {
45    my ($self) = @_;
46    $self->can('authenticate');
47}
48
49=head2 fetch_voters
50
51Must return an array of arrayref with for each item:
52
53=over4
54
55=item Email of the voters
56
57=item Name of the voters
58
59=item The UID/login to use over the remote system
60
61=back
62
63=cut
64
651;
Note: See TracBrowser for help on using the repository browser.