Dancer2

 view release on metacpan or  search on metacpan

lib/Dancer2/Manual/Keywords.pod  view on Meta::CPAN


Deserializes a JSON string into a Perl data structure. The input is expected
to be UTF-8 encoded bytes.

B<When to use>: Decode JSON data from the client. L</decode_json> is likely
what you want.

B<Related Keywords>: L</to_json>

=head2 L<from_yaml|Dancer2::Manual/from_yaml>

Deserializes a YAML structure.

B<When to use>: When you need to turn YAML into a Perl hashref.

B<See also>: L</to_yaml>, L</from_json>

=head2 L<halt|Dancer2::Manual/halt>

Halts request processing and sends a response immediately.

B<When to use>: Stop processing and return a response early.

B<Best Practice>: Combine L</halt> with L</status> to ensure appropriate
HTTP response codes are sent.

B<Related Keywords>: L</status>, L</send_error>

=head2 C<header>

Deprecated. Use L</response_header> instead.

B<Related Keywords>: L</response_header>.

=head2 C<headers>

Deprecated. Use L</response_headers> instead.

B<Related Keywords>: L</response_headers>.

=head2 L<pass|Dancer2::Manual/pass>

Passes control to the next matching route.

B<When to use>: Skip the current route and try the next one.

B<Related Keywords>: L</forward>

=head2 C<push_header>

Deprecated. Use L</push_response_header> instead.

B<When to use>: Don't. Use L</push_response_header>.

B<Related Keywords>: L</push_response_header>.

=head2 L<push_response_header|Dancer2::Manual/"Adding Additional Response Headers">

Adds a new value to an existing response header without replacing its current value.

B<When to use>: Append additional values to headers like 'Set-Cookie' or 'X-Forwarded-For'.

B<See also>: L</response_header>, L</response_headers>

=head2 L<redirect|Dancer2::Manual/redirect>

Redirects the client to a different location.

B<When to use>: Redirect users to another route or external URL.

B<Related Keywords>: L</status>

=head2 L<response|Dancer2::Core::Response>

Provides access to the current response object.

B<When to use>: Manipulate the outgoing response (headers, status, content).

B<Related Keywords>: L</request>, L</header>, L</content>

=head2 L<response_header|Dancer2::Manual/"Adding Additional Response Headers">

Sets or retrieves a specific header in the outgoing response.

B<When to use>: Modify or access response headers before sending them to the client.

B<Related Keywords>: L</header>, L</response_headers>

=head2 L<response_headers|Dancer2::Manual/"Adding Additional Response Headers">

Returns a hash reference of all headers set in the response.

B<When to use>: Inspect or manipulate multiple response headers simultaneously.

B<Related Keywords>: L</response_header>, L</header>

=head2 L<send_as|Dancer2::Manual/send_as>

Manually serializes and sends the response in a specific format.

B<When to use>: Control response serialization explicitly.

B<Related Keywords>: C<encode_json>, C<decode_json>.

=head2 L<send_error|Dancer2::Manual/send_error>

Immediately halts processing and sends an error response with a specific
status code.

B<When to use>: To send a custom error response.

B<Related Keywords>: L</halt>, L</status>

=head2 L<send_file|Dancer2::Manual/"Sending Static Files from a Route Handler">

Sends a file to the client.

B<When to use>: Send files from disk or in-memory data as a file.

B<Related Keywords>: L</send_as>



( run in 0.888 second using v1.01-cache-2.11-cpan-39bf76dae61 )