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 | |
---|
1 | package Epoll::DB::ImportV; |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | use YAML; |
---|
6 | |
---|
7 | sub 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 | |
---|
19 | sub auth_type { |
---|
20 | my ($self) = @_; |
---|
21 | ((ref $self) =~ /::([^:]+)$/)[0]; |
---|
22 | } |
---|
23 | |
---|
24 | sub load_web_params { |
---|
25 | my ($self, $c) = @_; |
---|
26 | $self->{params} = { %{ $c->req->params || {} } }; |
---|
27 | } |
---|
28 | |
---|
29 | sub xml_params { dump_params(@_) } |
---|
30 | |
---|
31 | sub dump_params { |
---|
32 | my ($self) = @_; |
---|
33 | YAML::Dump($self->{params}); |
---|
34 | } |
---|
35 | |
---|
36 | sub load_xml_params { load_dump_params(@_) } |
---|
37 | |
---|
38 | sub load_dump_params { |
---|
39 | my ($self, $data) = @_; |
---|
40 | $self->{params} = YAML::Load($data); |
---|
41 | 1; |
---|
42 | } |
---|
43 | |
---|
44 | sub can_authenticate { |
---|
45 | my ($self) = @_; |
---|
46 | $self->can('authenticate'); |
---|
47 | } |
---|
48 | |
---|
49 | =head2 fetch_voters |
---|
50 | |
---|
51 | Must 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 | |
---|
65 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.