comparison _test/temp.pl @ 210:6adaeb86945d

added IMPL::Web::AutoLocator
author sergey
date Tue, 29 May 2012 20:07:22 +0400
parents a8db61d0ed33
children 77a9934a44af
comparison
equal deleted inserted replaced
209:a8db61d0ed33 210:6adaeb86945d
1 print "asd::asd" =~ /^[a-zA-Z]+(?:::[a-zA-Z]+)*$/; 1 #!/usr/bin/perl
2 use strict;
3
4 use Time::HiRes qw(gettimeofday tv_interval);
5
6 my $obj = {};
7 my @vals = qw(a b c d e f g h i j k);
8 my @names = qw(one two three four five six);
9
10 sub CreateMethod {
11 my ($dt) = @_;
12
13 $obj->{one} = $vals[1];
14 $obj->{two} = $vals[2];
15 $obj->{three} = $vals[3];
16 $obj->{four} = $vals[4];
17 $obj->{five} = $vals[5];
18 $obj->{six} = $vals[6];
19 }
20
21 my @pairs = map { [$names[$_],$_] } (1 .. $#names);
22
23 sub CreateMethodEval {
24 my ($dt) = @_;
25 my $i = 0;
26 map $obj->{$_} = $vals[$i++], @names;
27 }
28
29 my $t = [gettimeofday];
30
31
32
33 CreateMethod($_) foreach (1..1000000);
34
35 print "Build: ",tv_interval($t,[gettimeofday]),"\n";
36
37 $t = [gettimeofday];
38
39 CreateMethodEval($_) foreach (1..1000000);
40
41 print "Eval: ",tv_interval($t,[gettimeofday]),"\n";
42
43 use URI::Escape;
44
45 print uri_escape("/child///&?"), "\n";
46