Create an Account
username: password:
 
  MemeStreams Logo

MemeStreams Discussion

search


This page contains all of the posts and discussion on MemeStreams referencing the following web page: Audio Debug Logs for Catalyst: Catalyst::TraitFor::Log::Audio. You can find discussions on MemeStreams as you surf the web, even if you aren't a MemeStreams member, using the Threads Bookmarklet.

Audio Debug Logs for Catalyst: Catalyst::TraitFor::Log::Audio
by Lost at 5:24 am EDT, Jul 1, 2009

I just created a simple trait for the Catalyst::Log that uses OS X's 'say' utility to log error messages to audio, such that the computer will say them to you. My eyes tire of reading through 100s of lines of debug output, so now sometimes I will have the computer simply talk to me.

Its not in CPAN yet, but its simple enough:

-------

package Catalyst::TraitFor::Log::Audio;

use Moose::Role;

sub speak
{
my ($self, $txt) = @_;

return unless $txt;

system("say $txt &") if $ENV{'SPEAK'};
}

1;

-----

In MyApp.pm, after setup():

Moose::Util::apply_all_roles(MyApp->log, 'Catalyst::TraitFor::Log::Audio');

----

In a controller: $foo='bar'; $c->log->speak('Hello world, the value of foo is $foo');

---

If ENV 'SPEAK' is set, it will talk to you. Works like a charm. mst/t0m told me how to do it. Will get around to CPAN'ing it this week. Anyone aware of a cross platform library that will do this kind of speech stuff? There is no reason to stop here if this is useful to people - could play tones depending on state, warnings, etc.


 
 
Powered By Industrial Memetics