Business-US-USPS-WebTools

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

a module.

To build the distribution, run this file normally:

	% perl Makefile.PL

But, it's more interesting than that. You can load it with C<require>
and call C<arguments> to get the data structure it passes to
C<WriteMakefile>:

	my $package = require '/path/to/Makefile.PL';
	my $arguments = $package->arguments;

Note that C<require>-ing a file makes an entry in C<%INC> for exactly
that name. If you try to C<require> another file with the same name,
even from a different path, C<require> thinks it has already loaded
the file. As such, I recommend you always require the full path to the
file.

The return value of the C<require> is a package name (in this case,
the name of the main module). Use that to call the C<arguments> method.

lib/Business/US/USPS/WebTools.pm  view on Meta::CPAN

	}

sub _api_path {
	$_[0]->_live ?
		"/ShippingAPI.dll"
			:
		"/ShippingAPI.dll"
		}

sub _make_url {
	state $rc = require Mojo::URL;
	my( $self, $hash ) = @_;

	$self->{url} = Mojo::URL->new
		->scheme('https')
		->host( $self->_api_host )
		->path( $self->_api_path )
		->query(
			API => $self->_api_name,
			XML => $self->_make_query_xml( $hash )
			);
	}

sub _make_request {
	my( $self, $url ) = @_;
	state $rc = require Mojo::UserAgent;
	state $ua = Mojo::UserAgent->new;

	$self->{error} = undef;

	$self->{transaction} = $ua->get( $self->url );
	$self->{response} = $self->{transaction}->result->body;

	$self->is_error;

	use Data::Dumper;
#	print STDERR "In _make_request:\n" . Dumper( $self ) . "\n";

	$self->{response};
	}

sub _clone {
	my $rc = require Storable;
	my( $self ) = @_;

	my $clone = Storable::dclone( $self );
	}

=item is_error

Returns true if the response to the last request was an error, and false
otherwise.

lib/Business/US/USPS/WebTools/TrackConfirm.pm  view on Meta::CPAN


	my $array  = $details->map(
		sub { $self->_parse_subbits( $_ ) }
		)->to_array;

	unshift @$array, $summary_parsed;
	bless $array, ref $self; # 'Hash::AsObject';
	}

sub _parse_subbits {
	state $rc = require Hash::AsObject;
	state $fields = [ qw(
		EventTime EventDate Event EventCity EventState EventZIPCode
		EventCountry FirmName Name AuthorizedAgent
		) ];

	my( $self, $subbit ) = @_;

	my %hash;
	foreach my $field ( @$fields ) {
		my( $value ) = eval { $subbit->at( $field )->text };



( run in 0.590 second using v1.01-cache-2.11-cpan-0d8aa00de5b )