/usr/share/perl5/Prophet/Web/Field.pm is in libprophet-perl 0.750-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | package Prophet::Web::Field;
use Any::Moose;
has name => ( isa => 'Str', is => 'rw' );
has record => ( isa => 'Prophet::Record', is => 'rw' );
has prop => ( isa => 'Str', is => 'rw' );
has value => ( isa => 'Str', is => 'rw' );
has label => ( isa => 'Str', is => 'rw', default => sub {''});
has id => ( isa => 'Str|Undef', is => 'rw' );
has class => ( isa => 'Str|Undef', is => 'rw' );
has value => ( isa => 'Str|Undef', is => 'rw' );
has type => ( isa => 'Str|Undef', is => 'rw', default => 'text');
sub _render_attr {
my $self = shift;
my $attr = shift;
my $value = $self->$attr() || return '';
Prophet::Util::escape_utf8(\$value);
return $attr . '="' . $value . '"';
}
sub render_name {
my $self = shift;
$self->_render_attr('name');
}
sub render_id {
my $self = shift;
$self->_render_attr('id');
}
sub render_class {
my $self = shift;
$self->_render_attr('class');
}
sub render_value {
my $self = shift;
$self->_render_attr('value');
}
sub render {
my $self = shift;
my $output = <<EOF;
<label @{[$self->render_name]} @{[$self->render_class]}>@{[$self->label]}</label>
@{[$self->render_input]}
EOF
return $output;
}
sub render_input {
my $self = shift;
if ($self->type eq 'textarea') {
my $value = $self->value() || '';
Prophet::Util::escape_utf8(\$value);
return <<EOF;
<textarea @{[$self->render_name]} @{[$self->render_id]} @{[$self->render_class]} >@{[$value]}</textarea>
EOF
} else {
return <<EOF;
<input type="@{[$self->type]}" @{[$self->render_name]} @{[$self->render_id]} @{[$self->render_class]} @{[$self->render_value]} />
EOF
}
}
__PACKAGE__->meta->make_immutable;
no Any::Moose;
1;
|