line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::TraitFor::Log::Audio; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Catalyst::TraitFor::Log::Audio - Audible debug messages for Catalyst. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Version 0.01 |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
1044
|
use 5.008001; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
In MyApp.pm, after calling __PACKAGE__setup(): |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Moose::Util::apply_all_roles(MyApp->log, 'Catalyst::TraitFor::Log::Audio'); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
In your shell environment: |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
SPEAK=1, or export SPEAK=1 |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
In your controllers thereafter: |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$c->log->speak("The value of foo is $foo"); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 DESCRIPTION |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Very simple role for Catalyst::Log that enables debug output to go to OS X's |
34
|
|
|
|
|
|
|
'say' command via $c->log->speak(); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
At the moment, as computers are fast - multiple speaks will pile up. I will fix |
37
|
|
|
|
|
|
|
this soon, so they queue. May also work with tonal debugging in the future. Now |
38
|
|
|
|
|
|
|
uses say on darwin/OS X, and espeak on Linux. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
This module shows the potential and handiness of roles for Catalyst. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Requires Catalyst (CataMoose) 5.8+ |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
1
|
|
477
|
use Moose::Role; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 speak |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Given text as an argument, send it to OS X's say(1), or Linux's espeak |
51
|
|
|
|
|
|
|
command. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub speak |
56
|
|
|
|
|
|
|
{ |
57
|
|
|
|
|
|
|
my ($self, $txt) = @_; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
return unless $txt; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
if($ENV{'SPEAK'}) |
62
|
|
|
|
|
|
|
{ |
63
|
|
|
|
|
|
|
if($^O eq 'darwin') |
64
|
|
|
|
|
|
|
{ |
65
|
|
|
|
|
|
|
system("say $txt &"); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
elsif($^O eq 'linux') |
68
|
|
|
|
|
|
|
{ |
69
|
|
|
|
|
|
|
system("espeak $txt &"); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SEE ALSO |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
L<Catalyst::Log>, L<Moose::Role> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 BUGS |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SUPPORT |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 AUTHOR |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Russell Jurney, C << <rjurney at cloudstenography.com> >> |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This library is free software. You can redistribute it and/or modify it under |
93
|
|
|
|
|
|
|
the same terms as Perl itself. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
no Moose::Role; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |