Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Tapper/Schema/TestrunDB/Result/Precondition.pm |
Statements | Executed 27 statements in 669µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 12µs | 12µs | BEGIN@2 | Tapper::Schema::TestrunDB::Result::Precondition::
1 | 1 | 1 | 11µs | 72µs | BEGIN@13 | Tapper::Schema::TestrunDB::Result::Precondition::
1 | 1 | 1 | 9µs | 46µs | BEGIN@12 | Tapper::Schema::TestrunDB::Result::Precondition::
1 | 1 | 1 | 9µs | 14µs | BEGIN@9 | Tapper::Schema::TestrunDB::Result::Precondition::
1 | 1 | 1 | 9µs | 26µs | BEGIN@10 | Tapper::Schema::TestrunDB::Result::Precondition::
0 | 0 | 0 | 0s | 0s | one_line | Tapper::Schema::TestrunDB::Result::Precondition::
0 | 0 | 0 | 0s | 0s | precondition_as_hash | Tapper::Schema::TestrunDB::Result::Precondition::
0 | 0 | 0 | 0s | 0s | quote | Tapper::Schema::TestrunDB::Result::Precondition::
0 | 0 | 0 | 0s | 0s | quote_and_one_line | Tapper::Schema::TestrunDB::Result::Precondition::
0 | 0 | 0 | 0s | 0s | to_string | Tapper::Schema::TestrunDB::Result::Precondition::
0 | 0 | 0 | 0s | 0s | update_content | Tapper::Schema::TestrunDB::Result::Precondition::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Tapper::Schema::TestrunDB::Result::Precondition; | ||||
2 | # spent 12µs within Tapper::Schema::TestrunDB::Result::Precondition::BEGIN@2 which was called:
# once (12µs+0s) by Class::C3::Componentised::ensure_class_loaded at line 4 | ||||
3 | 1 | 5µs | $Tapper::Schema::TestrunDB::Result::Precondition::AUTHORITY = 'cpan:AMD'; | ||
4 | 1 | 29µs | 1 | 12µs | } # spent 12µs making 1 call to Tapper::Schema::TestrunDB::Result::Precondition::BEGIN@2 |
5 | { | ||||
6 | 2 | 900ns | $Tapper::Schema::TestrunDB::Result::Precondition::VERSION = '0.001'; | ||
7 | } | ||||
8 | |||||
9 | 3 | 19µs | 2 | 18µs | # spent 14µs (9+4) within Tapper::Schema::TestrunDB::Result::Precondition::BEGIN@9 which was called:
# once (9µs+4µs) by Class::C3::Componentised::ensure_class_loaded at line 9 # spent 14µs making 1 call to Tapper::Schema::TestrunDB::Result::Precondition::BEGIN@9
# spent 4µs making 1 call to strict::import |
10 | 3 | 22µs | 2 | 43µs | # spent 26µs (9+17) within Tapper::Schema::TestrunDB::Result::Precondition::BEGIN@10 which was called:
# once (9µs+17µs) by Class::C3::Componentised::ensure_class_loaded at line 10 # spent 26µs making 1 call to Tapper::Schema::TestrunDB::Result::Precondition::BEGIN@10
# spent 17µs making 1 call to warnings::import |
11 | |||||
12 | 3 | 20µs | 2 | 83µs | # spent 46µs (9+37) within Tapper::Schema::TestrunDB::Result::Precondition::BEGIN@12 which was called:
# once (9µs+37µs) by Class::C3::Componentised::ensure_class_loaded at line 12 # spent 46µs making 1 call to Tapper::Schema::TestrunDB::Result::Precondition::BEGIN@12
# spent 37µs making 1 call to parent::import |
13 | 3 | 456µs | 2 | 132µs | # spent 72µs (11+60) within Tapper::Schema::TestrunDB::Result::Precondition::BEGIN@13 which was called:
# once (11µs+60µs) by Class::C3::Componentised::ensure_class_loaded at line 13 # spent 72µs making 1 call to Tapper::Schema::TestrunDB::Result::Precondition::BEGIN@13
# spent 60µs making 1 call to Exporter::import |
14 | |||||
15 | 1 | 11µs | 1 | 236µs | __PACKAGE__->load_components("Core"); # spent 236µs making 1 call to Class::C3::Componentised::load_components |
16 | 1 | 20µs | 1 | 440µs | __PACKAGE__->table("precondition"); # spent 440µs making 1 call to DBIx::Class::ResultSourceProxy::Table::table |
17 | 1 | 26µs | 1 | 641µs | __PACKAGE__->add_columns # spent 641µs making 1 call to DBIx::Class::ResultSourceProxy::add_columns |
18 | ( | ||||
19 | "id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 11, is_auto_increment => 1, }, | ||||
20 | "shortname", { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 255, }, | ||||
21 | "precondition", { data_type => "TEXT", default_value => undef, is_nullable => 1, }, | ||||
22 | "timeout", { data_type => "INT", default_value => undef, is_nullable => 1, size => 10, }, | ||||
23 | ); | ||||
24 | |||||
25 | 1 | 16µs | 1 | 58µs | __PACKAGE__->set_primary_key("id"); # spent 58µs making 1 call to DBIx::Class::ResultSourceProxy::set_primary_key |
26 | |||||
27 | 1 | 8µs | 1 | 173µs | __PACKAGE__->has_many ( child_pre_precondition => 'Tapper::Schema::TestrunDB::Result::PrePrecondition', { 'foreign.parent_precondition_id' => 'self.id' }); # spent 173µs making 1 call to DBIx::Class::Relationship::HasMany::has_many |
28 | 1 | 8µs | 1 | 165µs | __PACKAGE__->many_to_many ( child_preconditions => 'child_pre_precondition', 'child' ); # spent 165µs making 1 call to DBIx::Class::Relationship::ManyToMany::many_to_many |
29 | |||||
30 | 1 | 3µs | 1 | 98µs | __PACKAGE__->has_many ( parent_pre_precondition => 'Tapper::Schema::TestrunDB::Result::PrePrecondition', { 'foreign.child_precondition_id' => 'self.id' }); # spent 98µs making 1 call to DBIx::Class::Relationship::HasMany::has_many |
31 | 1 | 2µs | 1 | 133µs | __PACKAGE__->many_to_many ( parent_preconditions => 'parent_pre_precondition', 'parent' ); # spent 133µs making 1 call to DBIx::Class::Relationship::ManyToMany::many_to_many |
32 | |||||
33 | 1 | 4µs | 1 | 100µs | __PACKAGE__->has_many ( testrun_precondition => 'Tapper::Schema::TestrunDB::Result::TestrunPrecondition', { 'foreign.precondition_id' => 'self.id' }, { 'join_type' => 'INNER' }); # spent 100µs making 1 call to DBIx::Class::Relationship::HasMany::has_many |
34 | 1 | 1µs | 1 | 127µs | __PACKAGE__->many_to_many ( parent_testruns => 'testrun_precondition', 'testrun' ); # spent 127µs making 1 call to DBIx::Class::Relationship::ManyToMany::many_to_many |
35 | |||||
36 | 1 | 200ns | 1; | ||
37 | |||||
38 | # -------------------- methods in results -------------------- | ||||
39 | |||||
40 | |||||
41 | sub one_line { | ||||
42 | my ($str) = @_; | ||||
43 | |||||
44 | $str =~ s/\\/\\\\/msg; | ||||
45 | $str =~ s/\n/\\n/msg; | ||||
46 | $str; | ||||
47 | } | ||||
48 | |||||
49 | |||||
50 | sub quote { | ||||
51 | my ($str) = @_; | ||||
52 | |||||
53 | my $d = Data::Dumper->new([$str])->Terse(1)->Indent(0); | ||||
54 | $d->Dump; | ||||
55 | } | ||||
56 | |||||
57 | |||||
58 | sub quote_and_one_line { | ||||
59 | my ($str) = @_; | ||||
60 | |||||
61 | $str = quote($str); | ||||
62 | $str =~ s/\n/\\n/msg; | ||||
63 | $str; | ||||
64 | } | ||||
65 | |||||
66 | |||||
67 | sub to_string | ||||
68 | { | ||||
69 | my ($self, $opt) = @_; | ||||
70 | |||||
71 | my $str = ''; | ||||
72 | foreach (@{$self->result_source->{_ordered_columns} }) | ||||
73 | { | ||||
74 | my $val = $self->$_; | ||||
75 | if (defined $val) | ||||
76 | { | ||||
77 | if ( $opt->{quotevalues} && $opt->{nonewlines} ) { | ||||
78 | $val = quote_and_one_line($val); | ||||
79 | } else { | ||||
80 | $val = quote($val) if $opt->{quotevalues}; | ||||
81 | $val = one_line($val) if $opt->{nonewlines}; | ||||
82 | } | ||||
83 | } else | ||||
84 | { | ||||
85 | $val = $Tapper::Schema::TestrunDB::NULL; | ||||
86 | } | ||||
87 | $str .= $val . $Tapper::Schema::TestrunDB::DELIM; | ||||
88 | } | ||||
89 | return $str; | ||||
90 | } | ||||
91 | |||||
92 | |||||
93 | sub precondition_as_hash { | ||||
94 | Load(shift->precondition); | ||||
95 | } | ||||
96 | |||||
97 | |||||
98 | sub update_content { | ||||
99 | my ($self, $condition) = @_; | ||||
100 | |||||
101 | my $yaml_error = Tapper::Schema::TestrunDB::_yaml_ok($condition); | ||||
102 | die Tapper::Exception::Param->new($yaml_error) if $yaml_error; | ||||
103 | |||||
104 | my $cond_hash = Load($condition); | ||||
105 | |||||
106 | $self->shortname( $cond_hash->{shortname} ) if $cond_hash->{shortname}; | ||||
107 | $self->precondition( $condition ); | ||||
108 | $self->timeout( $cond_hash->{timeout} ) if $cond_hash->{timeout}; | ||||
109 | $self->update; | ||||
110 | |||||
111 | return $self->id; | ||||
112 | } | ||||
113 | |||||
114 | 1 | 18µs | 1; | ||
115 | |||||
- - | |||||
118 | __END__ |