sub bar { my($self) = @_; my $rv = { status => 0, error => undef, external_id => undef }; $rv->{ error } = "Authentication Failed" and return $rv unless $self->authenticate_user(); my $profile = $self->get_user_profile(); $rv->{ error } = "User is not active" and return $rv unless $profile->is_active(); $rv->{ external_id } = $self->find_external_id( $profile ) // $self->send_profile_to_partner( $profile ); $rv->{ status } = 1; return $rv; }