Create an Account
username: password:
 
  MemeStreams Logo

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

search

Lost
Picture of Lost
My Blog
My Profile
My Audience
My Sources
Send Me a Message

sponsored links

Lost's topics
Arts
Business
Games
Health and Wellness
Home and Garden
Miscellaneous
Current Events
Recreation
Local Information
Science
Society
Sports
Technology

support us

Get MemeStreams Stuff!


 
Audio Debug Logs for Catalyst: Catalyst::TraitFor::Log::Audio
Topic: Technology 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.

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



 
 
Powered By Industrial Memetics
RSS2.0