| File | /usr/lib/perl5/vendor_perl/5.10.1/Epoll/DB/Poll/BSubmit.pm |
| Statements Executed | 10 |
| Statement Execution Time | 1.22ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 52µs | 77µs | Epoll::DB::Poll::BSubmit::BEGIN@5 |
| 1 | 1 | 1 | 33µs | 90µs | Epoll::DB::Poll::BSubmit::BEGIN@6 |
| 1 | 1 | 1 | 31µs | 731µs | Epoll::DB::Poll::BSubmit::BEGIN@7 |
| 0 | 0 | 0 | 0s | 0s | Epoll::DB::Poll::BSubmit::add_item |
| 0 | 0 | 0 | 0s | 0s | Epoll::DB::Poll::BSubmit::set_voter |
| 0 | 0 | 0 | 0s | 0s | Epoll::DB::Poll::BSubmit::submit |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Epoll::DB::Poll::BSubmit; | ||||
| 2 | |||||
| 3 | # $Id: BSubmit.pm 319 2010-06-01 08:48:29Z nanardon $ | ||||
| 4 | |||||
| 5 | 3 | 100µs | 2 | 102µs | # spent 77µs (52+25) within Epoll::DB::Poll::BSubmit::BEGIN@5 which was called
# once (52µs+25µs) by Epoll::DB::Poll::BEGIN@16 at line 5 # spent 77µs making 1 call to Epoll::DB::Poll::BSubmit::BEGIN@5
# spent 25µs making 1 call to strict::import |
| 6 | 3 | 85µs | 2 | 146µs | # spent 90µs (33+57) within Epoll::DB::Poll::BSubmit::BEGIN@6 which was called
# once (33µs+57µs) by Epoll::DB::Poll::BEGIN@16 at line 6 # spent 90µs making 1 call to Epoll::DB::Poll::BSubmit::BEGIN@6
# spent 57µs making 1 call to warnings::import |
| 7 | 3 | 1.03ms | 2 | 1.43ms | # spent 731µs (31+700) within Epoll::DB::Poll::BSubmit::BEGIN@7 which was called
# once (31µs+700µs) by Epoll::DB::Poll::BEGIN@16 at line 7 # spent 731µs making 1 call to Epoll::DB::Poll::BSubmit::BEGIN@7
# spent 700µs making 1 call to base::import |
| 8 | |||||
| 9 | =head1 NAME | ||||
| 10 | |||||
| 11 | Epoll::Model::Vote - Catalyst Model | ||||
| 12 | |||||
| 13 | =head1 DESCRIPTION | ||||
| 14 | |||||
| 15 | Catalyst Model. | ||||
| 16 | |||||
| 17 | =cut | ||||
| 18 | |||||
| 19 | sub set_voter { | ||||
| 20 | my ($self, $voter, $referal) = @_; | ||||
| 21 | $self->{voter} = $voter; | ||||
| 22 | $self->{referal} = $referal; | ||||
| 23 | } | ||||
| 24 | |||||
| 25 | sub add_item { | ||||
| 26 | my ($self, $value, $weight) = @_; | ||||
| 27 | $value =~ s/^\s+//; | ||||
| 28 | $value =~ s/\s+$//; | ||||
| 29 | $value =~ s/\s+/ /g; | ||||
| 30 | $value = lc($value); | ||||
| 31 | $self->{data}{content}{$value} = $weight; | ||||
| 32 | } | ||||
| 33 | |||||
| 34 | sub submit { | ||||
| 35 | my ($self) = @_; | ||||
| 36 | |||||
| 37 | for (0..2) { # 3 try | ||||
| 38 | # First we register voting has voted | ||||
| 39 | $self->poll->_register_signing($self->{voter}, $self->{referal}) or return; # TODO error ? | ||||
| 40 | |||||
| 41 | # registring choices | ||||
| 42 | if ($self->_store_crypted()) { | ||||
| 43 | last; | ||||
| 44 | } else { | ||||
| 45 | $self->rollback; | ||||
| 46 | next; | ||||
| 47 | } | ||||
| 48 | |||||
| 49 | } | ||||
| 50 | # everything went fine, saving! | ||||
| 51 | $self->commit; | ||||
| 52 | |||||
| 53 | $self->uid | ||||
| 54 | } | ||||
| 55 | |||||
| 56 | |||||
| 57 | =head1 AUTHOR | ||||
| 58 | |||||
| 59 | Thauvin Olivier | ||||
| 60 | |||||
| 61 | =head1 LICENSE | ||||
| 62 | |||||
| 63 | This library is free software, you can redistribute it and/or modify | ||||
| 64 | it under the same terms as Perl itself or CeCILL. | ||||
| 65 | |||||
| 66 | =cut | ||||
| 67 | |||||
| 68 | 1 | 8µs | 1; |