⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.177
Server IP:
50.6.168.112
Server:
Linux server-617809.webnetzimbabwe.com 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.4.10
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
.cpan
/
build
/
AppConfig-1.71-0
/
t
/
View File Name :
cgi.t
#!/usr/bin/perl -w #======================================================================== # # t/cgi.t # # AppConfig::CGI test file. # # Written by Andy Wardley
# # Copyright (C) 1998 Canon Research Centre Europe Ltd. # All Rights Reserved. # # This is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # #======================================================================== use strict; use vars qw($loaded); BEGIN { $| = 1; print "1..9\n"; } END { ok(0) unless $loaded; } my $ok_count = 1; sub ok { shift or print "not "; print "ok $ok_count\n"; ++$ok_count; } use AppConfig qw(:argcount); use AppConfig::CGI; $loaded = 1; ok(1); #------------------------------------------------------------------------ # create new AppConfig::State and AppConfig::CGI objects # my $default = "
"; my $anon = "
"; my $user = "Fred Smith"; my $age = 42; my $notarg = "This is not an arg"; my $state = AppConfig::State->new({ GLOBAL => { DEFAULT => $default, ARGCOUNT => ARGCOUNT_ONE, } }, 'verbose' => { DEFAULT => 0, ARGCOUNT => ARGCOUNT_NONE, ALIAS => 'v', }, 'user' => { ALIAS => 'u|name|uid', DEFAULT => $anon, }, 'age' => { ALIAS => 'a', VALIDATE => '\d+', }); my $cfgcgi = AppConfig::CGI->new($state); #2 - #3: test the state and cfgargs got instantiated correctly ok( defined $state ); ok( defined $cfgcgi ); my $args = "v&u=$user&age=$age"; #4: process the args ok( $cfgcgi->parse($args) ); #5 - #7: check variables got updated ok( $state->verbose() == 1 ); ok( $state->user() eq $user ); ok( $state->age() == $age ); $age = $age * 2; #8 - #9: check args defaults to using $ENV{ QUERY_STRING } $ENV{ QUERY_STRING } = "v&u=$user=$user&age=$age"; ok( $cfgcgi->parse() ); ok( $state->age() == $age );