Xu Xiaodong avatar Xu Xiaodong committed 2ea3817

add config file support

Comments (0)

Files changed (3)

 # author:    Xu Xiaodong <xxdlhy@gmail.com>
 # license:   GPL
 # created:   2011 Feb  7
-# modified:  2011 Apr 13
+# modified:  2011 Apr 27
 #
 
 use Modern::Perl;
+use Config::Tiny;
 use LWP::UserAgent;
 use HTTP::Cookies;
 
-my $username = '';
-my $password = '';
+my $conf = Config::Tiny->read("$ENV{HOME}/.gaccountrc");
+
+my $username = $conf->{gad}->{user};
+my $password = $conf->{gad}->{pass};
 
 my $ua = LWP::UserAgent->new( cookie_jar => HTTP::Cookies->new() );
 
 # author:    Xu Xiaodong <xxdlhy@gmail.com>
 # license:   GPL
 # created:   2011 Feb  7
-# modified:  2011 Apr 13
+# modified:  2011 Apr 27
 #
 
 use strict;
 use warnings;
 
+use Config::Tiny;
 use Mail::IMAPClient;
 
+my $conf = Config::Tiny->read("$ENV{HOME}/.gaccountrc");
+
 # Account information
-my $user = '';
-my $pass = '';
+my $user = $conf->{gmail}->{user};
+my $pass = $conf->{gmail}->{pass};
 
 # Gmail unread count
 my $imap = Mail::IMAPClient->new(
 # author:    Xu Xiaodong <xxdlhy@gmail.com>
 # license:   GPL
 # created:   2011 Feb  7
-# modified:  2011 Apr 13
+# modified:  2011 Apr 27
 #
 
 use strict;
 use warnings;
 
+use Config::Tiny;
 use WebService::Google::Reader;
 
-my $user = '';
-my $pass = '';
+my $conf = Config::Tiny->read("$ENV{HOME}/.gaccountrc");
+
+my $user = $conf->{gmail}->{user};
+my $pass = $conf->{gmail}->{pass};
 
 my $gr = WebService::Google::Reader->new(
     username => $user,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.