| 1 | package Kwiki::Email; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Kwiki::Plugin '-Base'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use Email::Valid; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | our $VERSION = '0.02'; | |||||||||
| 7 | |||||||||||
| 8 | 1 | const class_id => 'email'; | |||||||||
| 9 | |||||||||||
| 10 | 0 | ▶ | sub register { | ||||||||
|
Subroutine
register: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 11 | 0 | my $registry = shift; | |||||||||
| 12 | 0 | $registry->add( | |||||||||
| 13 | preference => 'email', | ||||||||||
| 14 | object => $self->email, | ||||||||||
| 15 | ); | ||||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | sub email { | ||||||||
|
Subroutine
email: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 19 | 0 | my $p = $self->new_preference('email'); | |||||||||
| 20 | 0 | $p->query('Enter your email address.'); | |||||||||
| 21 | 0 | $p->type('input'); | |||||||||
| 22 | 0 | $p->size(30); | |||||||||
| 23 | 0 | $p->edit('check_email'); | |||||||||
| 24 | 0 | $p->default(''); | |||||||||
| 25 | 0 | return $p; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 0 | ▶ | sub check_email { | ||||||||
|
Subroutine
check_email: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 29 | 0 | my $preference = shift; | |||||||||
| 30 | 0 | my $value = $preference->new_value; | |||||||||
| 31 | 0 | ▶ | return unless length $value; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | ▶ | $preference->error('Invalid Email Adress.') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | unless Email::Valid->address($value); | ||||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 1 | 1; | |||||||||
| 37 | |||||||||||
| 38 | 1 | __DATA__ | |||||||||