Skip to content

Commit

Permalink
@_, not $@, is used to get subroutine arguments.
Browse files Browse the repository at this point in the history
Prints out the authenticated user's tags now.
  • Loading branch information
mynnx committed Nov 6, 2010
1 parent bb59337 commit 5c3f9a6
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions lib/QuietReader.pm
@@ -1,14 +1,15 @@
package QuietReader;
use Dancer ':syntax';
use Data::Dumper;
use Dancer::Session;
use WebService::Google::Reader;

sub make_reader {
my ($user, $pass) = $@;
my ($user, $pass) = @_;
my $reader = WebService::Google::Reader->new(
username => $user,
password => $pass,
#debug => 1,
debug => 0,
);
return $reader;
}
Expand All @@ -26,17 +27,19 @@ post '/tags' => sub {
session pass => params->{password};
my $user = session->{user};
my $pass = session->{pass};
debug "About to log in as $user with password $pass";

my $rv = "";
my $reader = make_reader($user, $pass);
debug "About to log in as $user with password $pass";
debug "error: ${reader->error}" if $reader->error;
my $tags = $reader->tags;
debug "tags fetched: $tags";
my $rv = "";
foreach my $tag (@$tags) {
$rv += $tag->id if $tag;

my @tags = $reader->tags;
foreach my $tag (@tags) {
my $id = $tag->id;
my $name = $id;
$name =~ s|.+/.+/label/(.+)|$1|;
$name =~ s|.+/.+/state/.+/(.+)|$1|;
$rv .= $name . '<br>';
}
mark_tags_read(('noisy'));
return $rv;
};

Expand Down

0 comments on commit 5c3f9a6

Please sign in to comment.