Skip to content

deprecate read/write object attributes #152

Open
@sherrardb

Description

@sherrardb

long-term plan note:

there is a mix of objects whose attributes are all 'ro' and those with some subset of attributes that are 'rw'. i think that the argument for deprecation has merit solely on the basis of interface consistency. but my bigger concern is the likelihood of user confusion when allowing updates to the attributes of a retrieved object.

a simple example is

my $customer = $stripe->get_customer( customer_id=> $customer_id);
$customer->email( $new_email_address );
...
# code that makes use of $customer->email()

where the user has not re-posted the customer object.

and the fact that this doesn't behave as expected is just as bad:

~$ perl -Mstrict -Mwarnings -mNet::Stripe -e 'my $stripe = Net::Stripe->new(api_key => $ENV{STRIPE_API_KEY});
my $customer = $stripe->post_customer(
  email=> "john.doe\@example.com"
);
print $customer->email()."\n";
$stripe->post_customer(
  customer=> $customer,
  email=> "dr.john.doe\@example.com"
);
print $customer->email()."\n";'
[email protected]
[email protected]

it is also worth noting that we are significantly lacking in unit tests that verify the expected behavior when updating object attributes and re-posting.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions