Watching Upstream Dependencies

I am subscribed to the RSS feed for CPAN uploads and watch for new versions of CPAN distributions my modules depend on and read their change logs. The other day I saw Moose 0.89 come out and saw a new feature added where the trigger of an attribute will now receive the old value if there was one.

package Node;
use Moose 0.89;
has child => (
  is  => 'rw',
  isa => 'Node',
  clearer   => 'clear_child',
  predicate => 'has_child',
  trigger   => \&_child_trigger,
has parent => (
  is  => 'rw',
  isa => 'Node',
  clearer   => 'clear_parent',
  predicate => 'has_parent',
before clear_child => sub {
  my ($self) = @_;
  # Trigger dissociate the parent from the child about to be cleared
  $self->_child_trigger(undef, $self->child);
sub _child_trigger {
  my ($self, $child, $previous_child) = @_;
  if (defined $previous_child) {
    # Remove this node as the parent of the previous child
  if (defined $child) {
    # Set this node as the parent of the new child
no Moose;

I quickly saw the benefit of this new feature for my Authen::CAS::External distribution and incorporated this into the cas_url and the user_agent attributes. Now the associated LWP::UserAgent always has the proper handlers set up and strange issues where browsing to a CAS page with a user agent object formerly associated with Authen::CAS::External triggering the Authen::CAS::External library will no longer occur.

Leave a Reply