Commits

Toby Inkster  committed 5df6e9a

Remove some private aliases for public methods.

  • Participants
  • Parent commits eccb0c2

Comments (0)

Files changed (1)

File lib/Web/Magic.pm

 {
 	my ($self, @args) = @_;
 	croak "Cannot set request method on already requested resource"
-		if @args && $self->_already_requested;
+		if @args && $self->is_requested;
 	$self->_request_object->method(uc $args[0]);
 	$self->set_request_body($args[1]) if exists $args[1];
 	return $self;
 sub set_request_body
 {
 	my ($self, $body) = @_;
-	if ($self->_already_requested)
+	if ($self->is_requested)
 	{
 		croak "Cannot set request body on already requested resource";
 	}
 {
 	my ($self, @args) = @_;
 	croak "Cannot set request header on already requested resource"
-		if exists $args[1] && $self->_already_requested;
+		if exists $args[1] && $self->is_requested;
 	$self->_request_object->header(@args);
 	return $self;
 }
 	my ($self, %extra_headers) = @_;
 	
 	my $req = $self->_request_object;
-	return $req if $self->_already_requested;
+	return $req if $self->is_requested;
 
 	if (%extra_headers)
 	{
 	return $req;
 }
 
-sub _already_requested
+sub is_requested
 {
 	my ($self) = @_;
 	return exists $self->_stash->{response};
 }
 
-*is_requested = \&_already_requested;
-
 sub _check_assertions
 {
 	my ($self, $response, @assertions) = @_;
 		croak "Need to perform HTTP request, but it is cancelled.";
 	}
 	
-	unless ($self->_already_requested)
+	unless ($self->is_requested)
 	{
 		my $req      = $self->_final_request_object(%extra_headers);
 		my $response = $self->user_agent->request($req);
 	$self->_stash->{assert_response} = [] unless defined $self->_stash->{assert_response};
 	push @{ $self->_stash->{assert_response} }, [$name => $code];
 	
-	if ($self->_already_requested)
+	if ($self->is_requested)
 	{
 		return $self->_check_assertions($self->response, [$name => $code]);
 	}
 	scalar @{ $self->_stash->{assert_response} // [] };
 }
 
-sub _response_object
+sub response
 {
 	my ($self, %extra_headers) = @_;
 	$self->do_request(%extra_headers);
 	$self->_stash->{response};
 }
 
-sub response
-{
-	my ($self, %extra_headers) = @_;
-	my $response = $self->_response_object(%extra_headers);
-	return $response;
-}
-
 sub to_hashref
 {
 	my ($self) = @_;
 sub cancel
 {
 	my ($self) = @_;
-	croak "Tried to cancel an already submitted request" if $self->_already_requested;
+	croak "Tried to cancel an already submitted request" if $self->is_requested;
 	$self->_stash->{cancel_request}++;
 	return $self;
 }
 {
 	my ($self) = @_;
 	return if $self->is_cancelled;
-	return if $self->_already_requested;
+	return if $self->is_requested;
 	if ($self->_request_object->method =~ m(^(GET|HEAD|OPTIONS|TRACE|SEARCH)$)i)
 	{
 		return unless $self->has_response_assertions;