Filename | /home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/site_perl/5.13.5/Hailo/Role/Storage.pm |
Statements | Executed 22 statements in 390µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 43µs | 126µs | BEGIN@9 | Hailo::Role::Storage::
1 | 1 | 1 | 20µs | 20µs | BEGIN@2 | Hailo::Role::Storage::
1 | 1 | 1 | 13µs | 1.45ms | BEGIN@11 | Hailo::Role::Storage::
1 | 1 | 1 | 12µs | 82µs | BEGIN@9.10 | Hailo::Role::Storage::
1 | 1 | 1 | 12µs | 399µs | BEGIN@10 | Hailo::Role::Storage::
1 | 1 | 1 | 5µs | 5µs | BEGIN@5 | Hailo::Role::Storage::
0 | 0 | 0 | 0s | 0s | save | Hailo::Role::Storage::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Hailo::Role::Storage; | ||||
2 | # spent 20µs within Hailo::Role::Storage::BEGIN@2 which was called:
# once (20µs+0s) by Mouse::Util::_try_load_one_class at line 4 | ||||
3 | 1 | 7µs | $Hailo::Role::Storage::AUTHORITY = 'cpan:AVAR'; | ||
4 | 1 | 24µs | 1 | 20µs | } # spent 20µs making 1 call to Hailo::Role::Storage::BEGIN@2 |
5 | # spent 5µs within Hailo::Role::Storage::BEGIN@5 which was called:
# once (5µs+0s) by Mouse::Util::_try_load_one_class at line 7 | ||||
6 | 1 | 5µs | $Hailo::Role::Storage::VERSION = '0.57'; | ||
7 | 1 | 19µs | 1 | 5µs | } # spent 5µs making 1 call to Hailo::Role::Storage::BEGIN@5 |
8 | |||||
9 | 4 | 73µs | 3 | 278µs | use 5.010; # spent 126µs making 1 call to Hailo::Role::Storage::BEGIN@9
# spent 82µs making 1 call to Hailo::Role::Storage::BEGIN@9.10
# spent 70µs making 1 call to feature::import |
10 | 2 | 31µs | 2 | 787µs | # spent 399µs (12+387) within Hailo::Role::Storage::BEGIN@10 which was called:
# once (12µs+387µs) by Mouse::Util::_try_load_one_class at line 10 # spent 399µs making 1 call to Hailo::Role::Storage::BEGIN@10
# spent 387µs making 1 call to Any::Moose::import |
11 | 2 | 161µs | 2 | 2.88ms | # spent 1.45ms (13µs+1.43) within Hailo::Role::Storage::BEGIN@11 which was called:
# once (13µs+1.43ms) by Mouse::Util::_try_load_one_class at line 11 # spent 1.45ms making 1 call to Hailo::Role::Storage::BEGIN@11
# spent 1.43ms making 1 call to namespace::clean::import |
12 | |||||
13 | 1 | 4µs | 1 | 45µs | has brain => ( # spent 45µs making 1 call to Mouse::Role::has |
14 | isa => 'Str', | ||||
15 | is => 'rw', | ||||
16 | ); | ||||
17 | |||||
18 | 1 | 4µs | 1 | 30µs | has order => ( # spent 30µs making 1 call to Mouse::Role::has |
19 | isa => 'Int', | ||||
20 | is => 'rw', | ||||
21 | ); | ||||
22 | |||||
23 | 1 | 3µs | 1 | 32µs | has hailo => ( # spent 32µs making 1 call to Mouse::Role::has |
24 | isa => 'HashRef', | ||||
25 | is => 'ro', | ||||
26 | documentation => "Miscellaneous private callbacks that Hailo provides to communicate with it", | ||||
27 | ); | ||||
28 | |||||
29 | 1 | 3µs | 1 | 29µs | has tokenizer_class => ( # spent 29µs making 1 call to Mouse::Role::has |
30 | isa => 'Str', | ||||
31 | is => 'rw', | ||||
32 | ); | ||||
33 | |||||
34 | 1 | 4µs | 1 | 80µs | requires 'ready'; # spent 80µs making 1 call to Mouse::Role::requires |
35 | 1 | 3µs | 1 | 52µs | requires 'initialized'; # spent 52µs making 1 call to Mouse::Role::requires |
36 | 1 | 3µs | 1 | 61µs | requires 'save'; # spent 61µs making 1 call to Mouse::Role::requires |
37 | 1 | 3µs | 1 | 51µs | requires 'start_learning'; # spent 51µs making 1 call to Mouse::Role::requires |
38 | 1 | 3µs | 1 | 54µs | requires 'stop_learning'; # spent 54µs making 1 call to Mouse::Role::requires |
39 | 1 | 3µs | 1 | 53µs | requires 'start_training'; # spent 53µs making 1 call to Mouse::Role::requires |
40 | 1 | 3µs | 1 | 53µs | requires 'stop_training'; # spent 53µs making 1 call to Mouse::Role::requires |
41 | |||||
42 | sub save { | ||||
43 | # does nothing by default | ||||
44 | return; | ||||
45 | } | ||||
46 | |||||
47 | 1 | 12µs | 1; | ||
48 | |||||
49 | =encoding utf8 | ||||
50 | |||||
51 | =head1 NAME | ||||
52 | |||||
53 | Hailo::Role::Storage - A role representing a L<Hailo|Hailo> storage backend | ||||
54 | |||||
55 | =head1 ATTRIBUTES | ||||
56 | |||||
57 | =head2 C<ready> | ||||
58 | |||||
59 | Ask the storage backend if it considers itself ready to go. E.g. a | ||||
60 | storage that requires a C<brain> would return false if it wasn't | ||||
61 | passed one. | ||||
62 | |||||
63 | =head2 C<initialized> | ||||
64 | |||||
65 | If you're connecting to an existing storage that already has a | ||||
66 | populated schema and is ready to go this'll return true. | ||||
67 | |||||
68 | =head2 C<order> | ||||
69 | |||||
70 | The Markov order (chain length) being used. | ||||
71 | |||||
72 | =head2 C<brain> | ||||
73 | |||||
74 | The name of the resource (file name, database name) to use as storage. | ||||
75 | |||||
76 | =head1 METHODS | ||||
77 | |||||
78 | =head2 C<new> | ||||
79 | |||||
80 | This is the constructor. It accept the attributes specified in | ||||
81 | L</ATTRIBUTES>. | ||||
82 | |||||
83 | =head2 C<save> | ||||
84 | |||||
85 | Saves the current state. | ||||
86 | |||||
87 | =head2 C<learn_tokens> | ||||
88 | |||||
89 | Learns from a sequence of tokens. Takes an array reference of strings. | ||||
90 | |||||
91 | =head2 C<make_reply> | ||||
92 | |||||
93 | Takes an (optional) array reference of tokens and returns a reply (arrayref | ||||
94 | of tokens) that might be relevant. | ||||
95 | |||||
96 | =head2 C<token_total> | ||||
97 | |||||
98 | Takes no arguments. Returns the number of tokens the brain knows. | ||||
99 | |||||
100 | =head2 C<expr_total> | ||||
101 | |||||
102 | Takes no arguments. Returns the number of expressions the brain knows. | ||||
103 | |||||
104 | =head2 C<start_learning> | ||||
105 | |||||
106 | Takes no arguments. This method is called by L<Hailo|Hailo> right before learning | ||||
107 | begins. | ||||
108 | |||||
109 | =head2 C<stop_learning> | ||||
110 | |||||
111 | Takes no arguments. This method is called by L<Hailo|Hailo> right after learning | ||||
112 | finishes. | ||||
113 | |||||
114 | =head2 C<start_training> | ||||
115 | |||||
116 | Takes no arguments. This method is called by L<Hailo|Hailo> right before training | ||||
117 | begins. | ||||
118 | |||||
119 | =head2 C<stop_training> | ||||
120 | |||||
121 | Takes no arguments. This method is called by L<Hailo|Hailo> right after training | ||||
122 | finishes. | ||||
123 | |||||
124 | =head1 AUTHOR | ||||
125 | |||||
126 | Hinrik E<Ouml>rn SigurE<eth>sson, hinrik.sig@gmail.com | ||||
127 | |||||
128 | =head1 LICENSE AND COPYRIGHT | ||||
129 | |||||
130 | Copyright 2010 Hinrik E<Ouml>rn SigurE<eth>sson | ||||
131 | |||||
132 | This program is free software, you can redistribute it and/or modify | ||||
133 | it under the same terms as Perl itself. | ||||
134 | |||||
135 | 1 | 22µs | 1 | 4.43ms | =cut # spent 4.43ms making 1 call to B::Hooks::EndOfScope::__ANON__[B/Hooks/EndOfScope.pm:26] |