WWW-StreamSend

 view release on metacpan or  search on metacpan

lib/WWW/StreamSend/Response.pm  view on Meta::CPAN

package WWW::StreamSend::Response;

use strict;
use warnings;

sub new {
    my ($class, $params) = @_;
    my $self = {
        data    => $params->{data},
        xml     => $params->{xml},
    };
    bless $self => $class;
    return $self;
}

sub as_xml {
    my ($self) = @_;
    return $self->{xml};
}

sub fields {
    my ($self) = @_;
    my @out = ();
    foreach my $key (keys %{$self->{data}}) {
        next if (ref $self->{data}{$key}[0] ne ref {});
        next unless ($self->{data}{$key}[0]{content});
        $key=~s/-/_/g;
        push @out, $key;
    }
    return @out;
}

# all unknown methods are accessors
sub UNIVERSAL::AUTOLOAD {
    my ($self) = @_;
    my ($methodname) = $UNIVERSAL::AUTOLOAD =~ /.*::(.*)/;
    return if $methodname eq 'DESTROY';
    $methodname=~s/_/-/g;
    return (exists $self->{data}->{$methodname}) ? $self->{data}{$methodname}[0]{content} : undef;
}

1;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.203 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )