[Catalyst] Audio Debug Logs for Catalyst: Catalyst::TraitFor::Log::Audio

Russell Jurney russell.jurney at gmail.com
Wed Jul 1 09:15:39 GMT 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.

Russell Jurney
russell.jurney at gmail.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090701/cc0e258e/attachment.htm


More information about the Catalyst mailing list