Guest User

Untitled

a guest
May 18th, 2018
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. use strict;
  2. use warnings;
  3.  
  4. use WebService::Google::Reader;
  5. use Net::Growl;
  6. use Getopt::Long;
  7. use FindBin;
  8. use YAML::Tiny;
  9. use Data::Dumper;
  10.  
  11. $XML::Atom::ForceUnicode = 1;
  12.  
  13. my $AppName = "GoogleReader Growler";
  14.  
  15. my $path = File::Spec->catfile($FindBin::Bin, 'config.yaml');
  16. GetOptions('--config=s', \$path);
  17.  
  18. my $config = get_preferences($path);
  19.  
  20. Net::Growl::register(
  21. host => 'localhost',
  22. application => $AppName,
  23. password => $config->{growl}->{password},
  24. );
  25.  
  26. my $reader = WebService::Google::Reader->new(
  27. username => $config->{google}->{username},
  28. password => $config->{google}->{password},
  29. );
  30.  
  31. foreach my $entry ($reader->unread(count => 10)->entries) {
  32. Net::Growl::notify(
  33. application => $AppName,
  34. title => $entry->title,
  35. description => $entry->content->body,
  36. password => $config->{growl}->{password},
  37. );
  38. }
  39.  
  40. sub get_preferences {
  41. YAML::Tiny::LoadFile(shift);
  42. }
Add Comment
Please, Sign In to add comment