| Business-UPS-Tracking documentation | Contained in the Business-UPS-Tracking distribution. |
Business::UPS::Tracking::Role::Builder - Helper role
This role provides methods that construct various objects (eg. Business::UPS::Tracking::Element::Address).
my $address = $self->build_address($xpath_expression);
Turns an address xml node into a Business::UPS::Tracking::Element::Address object.
my $address = $self->build_code($xpath_expression);
Turns an address xml node into a Business::UPS::Tracking::Element::Address object.
my $weight = $self->build_weight($xpath_expression);
Turns an weight xml node into a Business::UPS::Tracking::Element::Weight object.
my $weight = $self->build_referencenumber($xpath_expression);
Turns an weight xml node into a Business::UPS::Tracking::Element::ReferenceNumber object.
| Business-UPS-Tracking documentation | Contained in the Business-UPS-Tracking distribution. |
# ============================================================================ package Business::UPS::Tracking::Role::Builder; # ============================================================================ use utf8; use 5.0100; use Moose::Role; use strict; # Make cpants happy #requires('xml'); use Business::UPS::Tracking::Element::Address; use Business::UPS::Tracking::Element::Weight; use Business::UPS::Tracking::Element::ReferenceNumber; use Business::UPS::Tracking::Element::Code;
sub build_address { my ($self,$xpath) = @_; my $node = $self->xml->findnodes($xpath)->get_node(1); return unless $node && ref $node; return Business::UPS::Tracking::Element::Address->new( xml => $node, ); }
sub build_code { my ($self,$xpath) = @_; my $node = $self->xml->findnodes($xpath)->get_node(1); return unless $node && ref $node; return Business::UPS::Tracking::Element::Code->new( xml => $node, ); }
sub build_weight { my ($self,$xpath) = @_; my $node = $self->xml->findnodes($xpath)->get_node(1); return unless $node && ref $node; return Business::UPS::Tracking::Element::Weight->new( xml => $node, ); }
sub build_referencenumber { my ($self,$xpath) = @_; my $node = $self->xml->findnodes($xpath)->get_node(1); return unless $node && ref $node; return Business::UPS::Tracking::Element::ReferenceNumber->new( xml => $node, ); } no Moose::Role; 1;