return( $self->error( "Object provided ($this) has an object type (", $this->object, ") different from the ones currently in our stack ($obj_name).") ) if( $this->object ne $obj_name);
}
return( $this);
}
sub_data
{
my$self= CORE::shift( @_);
my$field= 'data';
if( @_)
{
my$ref= CORE::shift( @_);
return( $self->error( "I was expecting an array ref, but instead got '$ref'. _is_array returned: '", $self->_is_array( $ref), "'") ) if( !$self->_is_array( $ref) );
my$arr= [];
# Are we provided with an array of existing objects? No need to do anything then
if( $self->_is_object( $ref->[0] ) )
{
# Unless it is already an array object, we make it one
return( $self->error( "I found an array of objects, but they do not have the method \"object\".") ) if( !$ref->[0]->can( 'object') );
$type= $ref->[0]->object || return( $self->error( "Somehow, the object property for this object (", $ref->[0], ") is empty.") );
}
else
{
return( $self->error( "I was expecting an array of hash reference, but instead of hash I found $ref->[0]") ) if( ref( $ref->[0] ) ne 'HASH');
return( $self->error( "Found an hash reference in this array, but it is empty: ", sub{ $self->dumper( $ref) } ) ) if( !scalar( keys( %{$ref->[0]} ) ) );
$type= $ref->[0]->{object} || return( $self->error( "I was expecting a string in property 'object', but found nothing: ", sub{ $self->dumper( $ref) } ) );
}
my$class= $self->_object_type_to_class( $type) || return( $self->error( "Could not find corresponding class for ojbect type \"$type\".") );
my $list = $stripe->customers( 'list' ) || die( $stripe->error );
printf( "%d total customer(s) found\n", $list->count );
while( my $cust = $list->next )
{
printf( "Customer %s with e-mail has a balance of %s\n", $cust->name, $cust->email, $cust->balance->format_money( 0, '¥' ) );
}
=head1 VERSION
v0.200.3
=head1 DESCRIPTION
This is a package with a set of useful methods to be inherited by various Stripe package, such as bellow packages. It can also be used directly in a generic way and this will find out which list of objects this is. This is the case for example when getting the list of customer tax ids in B<Net::API::Stripe::tax_id_list>().