Changeset 5

Show
Ignore:
Timestamp:
08/19/09 01:56:33 (5 years ago)
Author:
jesus
Message:

allow validation of input -- per leon

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/perl/lib/Cornea.pm

    r4 r5  
    1313  $class = ref($class) ? ref $class : $class; 
    1414  bless {}, $class; 
     15} 
     16 
     17sub submit { 
     18  my $self = shift; 
     19  my $input = shift; 
     20  my ($serviceId,$assetId) = @_; 
     21 
     22  my $rt = Cornea::RecallTable->new(); 
     23  my $repinfo = $rt->repInfo($serviceId, 0); 
     24  $repinfo->validate($serviceId, $input); 
     25  return $self->store($input, $serviceId, $assetId, 0); 
    1526} 
    1627 
  • trunk/perl/lib/Cornea/RepresentationInfo.pm

    r3 r5  
    5454} 
    5555 
     56sub validate { 
     57  my $self = shift; 
     58  my ($serviceId, $input) = @_; 
     59  my $cls = $self->transformClass; 
     60  eval "use $cls;"; 
     61  die $@ if($@); 
     62  my $t = eval "$cls->new();"; 
     63  return $t->validate($serviceId, $input); 
     64} 
     65 
    56661;