if (blessed $@ && $@->isa('Net::Twitter::Lite::Error')) {
warn $@->error;
if ($@->twitter_error) {
- my %twitter_error = %{$@->twitter_error};
- map {
- $twitter_error{"$_ => "} = $twitter_error{$_} . "\n";
- delete $twitter_error{$_}
- } keys %twitter_error;
- warn join("", %twitter_error);
+ my $twitter_error = $@->twitter_error;
+ if (defined $twitter_error->{errors}) {
+ foreach my $error (@{$twitter_error->{errors}}) {
+ warn "code => " , $error->{code}, "\n";
+ warn "message => ", $error->{message}, "\n";
+ }
+ }
+ else {
+ # unknown HASH structure
+ use Data::Dumper;
+ warn Dumper $twitter_error;
+ }
}
}
else {
if (blessed $@ && $@->isa('Net::Twitter::Lite::Error')) {
warn $@->error;
if ($@->twitter_error) {
- my %twitter_error = %{$@->twitter_error};
- map {
- $twitter_error{"$_ => "} = $twitter_error{$_} . "\n";
- delete $twitter_error{$_}
- } keys %twitter_error;
- warn join("", %twitter_error);
+ my $twitter_error = $@->twitter_error;
+ if (defined $twitter_error->{errors}) {
+ foreach my $error (@{$twitter_error->{errors}}) {
+ warn "code => " , $error->{code}, "\n";
+ warn "message => ", $error->{message}, "\n";
+ }
+ }
+ else {
+ # unknown HASH structure
+ use Data::Dumper;
+ warn Dumper $twitter_error;
+ }
}
}
else {
if (blessed $@ && $@->isa('Net::Twitter::Lite::Error')) {
warn $@->error;
if ($@->twitter_error) {
- my %twitter_error = %{$@->twitter_error};
- map {
- $twitter_error{"$_ => "} = $twitter_error{$_} . "\n";
- delete $twitter_error{$_}
- } keys %twitter_error;
- warn join("", %twitter_error);
+ my $twitter_error = $@->twitter_error;
+ if (defined $twitter_error->{errors}) {
+ foreach my $error (@{$twitter_error->{errors}}) {
+ warn "code => " , $error->{code}, "\n";
+ warn "message => ", $error->{message}, "\n";
+ }
+ }
+ else {
+ # unknown HASH structure
+ use Data::Dumper;
+ warn Dumper $twitter_error;
+ }
}
}
else {
if (blessed $@ && $@->isa('Net::Twitter::Lite::Error')) {
warn $@->error;
if ($@->twitter_error) {
- my %twitter_error = %{$@->twitter_error};
- map {
- $twitter_error{"$_ => "} = $twitter_error{$_} . "\n";
- delete $twitter_error{$_}
- } keys %twitter_error;
- warn join("", %twitter_error);
+ my $twitter_error = $@->twitter_error;
+ if (defined $twitter_error->{errors}) {
+ foreach my $error (@{$twitter_error->{errors}}) {
+ warn "code => " , $error->{code}, "\n";
+ warn "message => ", $error->{message}, "\n";
+ }
+ }
+ else {
+ # unknown HASH structure
+ use Data::Dumper;
+ warn Dumper $twitter_error;
+ }
}
}
else {