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.jur...@gmail.com
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to