[Bps-public-commit] r18283 - in Net-Google-Code/branches/write: .

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Feb 9 01:47:53 EST 2009


Author: sunnavy
Date: Mon Feb  9 01:47:52 2009
New Revision: 18283

Modified:
   Net-Google-Code/branches/write/   (props changed)
   Net-Google-Code/branches/write/lib/Net/Google/Code/Role/Authentication.pm

Log:
 r19687 at sunnavys-mb:  sunnavy | 2009-02-09 09:43:32 +0800
 added signed_in method, also alias signin and signout to sign_in and sign_out, respectively


Modified: Net-Google-Code/branches/write/lib/Net/Google/Code/Role/Authentication.pm
==============================================================================
--- Net-Google-Code/branches/write/lib/Net/Google/Code/Role/Authentication.pm	(original)
+++ Net-Google-Code/branches/write/lib/Net/Google/Code/Role/Authentication.pm	Mon Feb  9 01:47:52 2009
@@ -46,6 +46,9 @@
     return 1;
 }
 
+*sign_in = \&signin;
+*sign_out = \&signout;
+
 sub ask_password {
     my $self = shift;
     while ( !defined $self->password or $self->password eq '' ) {
@@ -55,6 +58,15 @@
     }
 }
 
+
+sub signed_in {
+    my $self = shift;
+    return 1
+      if $self->mech->uri =~ m!https?://[-\w]+\.google\.com/!
+          && $self->mech->content =~ /Sign Out/;
+    return;
+}
+
 no Moose::Role;
 
 1;
@@ -71,13 +83,19 @@
 
 
 =head2 signin
+=head2 sign_in
 
 sign in
 
 =head2 signout
+=head2 sign_out
 
 sign out
 
+=head2 signed_in
+
+return 1 if already signed in, return undef elsewise.
+
 =head2 ask_password
 
 ask user to input password



More information about the Bps-public-commit mailing list