package Jaipo::UI; use warnings; use strict; #~ use Smart::Comments; use base qw/Class::Accessor::Fast/; __PACKAGE__->mk_accessors (qw/core options trigger_name sp_id/); =encoding utf8 =head1 NAME Jaipo::UI - UI dispacher =head1 SYNOPSIS use Jaipo::UI; my $ui = Jaipo::UI->new("console"); =head1 FUNCTIONS =head2 new Return a UI object. =cut sub new { my $class = shift; my $self = {}; bless $self , $class; $self->init; return $self; } sub init { my $class = shift; $class->notifier( {} ); if( $^O =~ m/linux/i ) { $class->_init_linux; } elsif( $^O =~ m/darwin/i ) { $class->_init_osx; } } sub _init_linux { my $class = shift; use Jaipo::Notify::LibNotify; my $notify = Jaipo::Notify::LibNotify->new; $class->notifier( $notify ); print "Desktop::Notify Notifier Initialized\n"; } sub _init_osx { use Mac::Growl; Mac::Growl::RegisterNotifications( 'Jaipo', ['Updates' ] , [ 'Updates' ] ); print "Mac::Growl Notifier Initialized\n"; } sub create { my ( $class, $args ) = @_; if ( $^O =~ m/linux/i ) { $class->_create_linux($args); } elsif ( $^O =~ m/darwin/i ) { $class->_create_osx($args); } } sub _create_osx { my ($class,$args) = @_; Mac::Growl::PostNotification( 'Jaipo', 'Updates' , 'Jaipo', $args->{message} ); } sub _create_linux { my ($class,$args) = @_; $class->notifier->yell( $args->{message} ); } =head1 AUTHOR BlueT - Matthew Lien - 練喆明, C<< >> =head1 BUGS Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Jaipo::UI You can also look for information at: =over 4 =item * RT: CPAN's request tracker L =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * Search CPAN L =back =head1 ACKNOWLEDGEMENTS =head1 COPYRIGHT & LICENSE Copyright 2009 BlueT - Matthew Lien - 練喆明, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; # End of Jaipo::UI