| Dicop-Server documentation | Contained in the Dicop-Server distribution. |
Dicop::Data::Result - a result for a job
use Dicop::Data::Result;
perl5.005, Exporter, Dicop, Dicop::Item
Exports nothing on default.
For a description of fields a result has, see doc/Objects.pod.
Return a field of the object as an ASCII string suitable for HTML output:
$result->get_as_string('client_name');
Return a field of the object as an hexified string, or as a fallback, as normal string via get_as_string. The hexify happens only for certain special fields, all other are returned as simple strings:
$result->get_as_hex('client_name');
Return the value of a specified field of the object:
$result->geT('client_name');
Change a field's value after checking that the field can be changed (via can_change) and checking the new value. If the new value does not conform to the expected format, it will be silently modifed (f.i. invalid characters might be removed) and then the change will happen:
$object->change('foo','bar'); # will change $object->{foo} to bar
# if foo can be changed
Return true if the field's value can be changed.
die ("Can not change field $field\n") if !$object->can_change($field);
None known yet.
(c) Bundesamt fuer Sicherheit in der Informationstechnik 1998-2006
DiCoP is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
See http://www.bsi.de/ for more information.
| Dicop-Server documentation | Contained in the Dicop-Server distribution. |
############################################################################# # Dicop/Data/Result.pm -- a result for a job # # (c) Bundesamt fuer Sicherheit in der Informationstechnik 1998-2006 # # DiCoP is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License version 2 as published by the Free # Software Foundation. # # See the file LICENSE or L<http://www.bsi.de/> for more information. ############################################################################# package Dicop::Data::Result; use vars qw($VERSION); $VERSION = 1.03; # Current version of this package use base Dicop::Item; use strict; use Dicop::Base qw/h2a/; ############################################################################# # public stuff sub _init { my $self = shift; $self->SUPER::_init(@_); # store the time the result was created, since _modified will not be stored $self->{time} = $self->{_modified} unless $self->{time}; $self; } BEGIN { *get_as_hex = \&get_as_string; } sub get_as_string { my ($self,$key) = @_; die ('Undefined key in get_as_string') if !defined $key; # fake key result_ascii return h2a($self->{result_hex}) if $key eq 'result_ascii'; return localtime($self->{$key}) if $key eq 'time'; $self->{$key}; } 1; __END__ #############################################################################