File: setval.t

package info (click to toggle)
libcgi-untaint-perl 1.26-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 112 kB
  • ctags: 21
  • sloc: perl: 302; makefile: 6
file content (30 lines) | stat: -rw-r--r-- 486 bytes parent folder | download | duplicates (8)
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
#!/usr/bin/perl -w

use strict;
use Test::More;
use CGI;
use CGI::Untaint;

plan tests => 2;

package CGI::Untaint::bigint;

use base 'CGI::Untaint::integer';
use Math::BigInt;

sub is_valid    { 
	my $self = shift;
	$self->value(Math::BigInt->new($self->value));
}

package main;

my $q = CGI->new( { num => 6091 });

my $h = CGI::Untaint->new($q->Vars);

my $val = $h->extract(-as_bigint => "num");

ok $val == 6091, "Extract a big int";
isa_ok $val, "Math::BigInt", "as an object";