Subject: | Can't use string as a HASH ref |
Date: | Thu, 29 Oct 2009 14:47:30 -0400 |
To: | bug-WebService-Basecamp [...] rt.cpan.org |
From: | jason scott <jscott [...] fairport.org> |
Hello,
Thanks for putting the WebService::Basecamp module together. I think
this is going to help us quite a bit in working with BaseCamp.
I'm seeing an issue trying to walk our projects/todo-lists/items.
Below is the code I am using to explore the hashes your module
returns. For some reason, one project (well, actually, the project's
todo-lists) is throwing an error: "Can't use string ("false") as a
HASH ref while "strict refs" in use at ./wsbc.pl line 28." I have
checked this todo-list in BaseCamp and it functions properly. I can
edit todo items, add time, etc.
This code is running on:
Debian 5.0.3
Perl 5.10.0
WebService::BaseCamp 0.1.4
Thanks in advance for any insight.
jscott
== Begin Code ==
#!/usr/bin/perl
use strict;
use Data::Dumper;
use WebService::Basecamp;
my $username = 'user';
my $password = 'pass';
my $httpsurl = 'https://subdomain.basecamphq.com';
my $bc = WebService::Basecamp->new(
url => $httpsurl,
user => $username,
pass => $password
);
$bc->ping || die $bc->error();
my $projects = $bc->projects('name');
# Walk the hashrefs of projects/lists/data/items
foreach(sort keys %{$projects}) {
print Dumper($projects->{$_});
my $todo_lists = $bc->lists($projects->{$_}->{'id'}, 'false', 'name');
foreach(sort keys %{$todo_lists}) {
print Dumper($todo_lists->{$_});
my $listdata = $bc->list($todo_lists->{$_}->{'id'});
my $items = $listdata->{'todo-items'};
foreach(sort keys %{$listdata}) {
print Dumper($listdata->{$_});
}
foreach(sort keys %{$items}) {
print Dumper($items->{$_});
}
}
}
== End Code==