Browse Source

single word responses are still key\tvalue. value simply doesnt exist. very silly. correct handling of single word responses

sungo 11 years ago
parent
commit
dc1a2a4dbc
2 changed files with 5 additions and 5 deletions
  1. 2 2
      etc/probe.pl
  2. 3 3
      lib/Net/Dropbox.pm

+ 2 - 2
etc/probe.pl

@@ -10,8 +10,8 @@ use YAML qw(Dump);
 my $nd = Net::Dropbox->new();
 
 my $res = $nd->_send_and_fetch(
-	"get_dropbox_globals",
-	{ keys => "icon_state" }
+	"get_folder_tag",
+	{ path => '/home/sungo/Dropbox/Home' }
 );
 
 say Dump $res;

+ 3 - 3
lib/Net/Dropbox.pm

@@ -133,9 +133,9 @@ sub _parse_response { #{{{
 		$res->{ok} = 1;
 
 		foreach my $line (@lines) {
-			if($line !~ /\t/) {
-				# single word response
-				$res->{$line} = 1;
+			if($line =~ /^(.+?)\t$/) {
+				# single word response. Mark it as defined but empty
+				$res->{$1} = '';
 				next;
 			}