PerlDancer / PerlDancer/Dancer2

Chained hooks

Open
#818 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement
Dominant language
Perl
Stars
604
Forks
288
Avg merge
1d 5h
Merged PRs (30d)
5

Description

I would love to have a hook that provides an around, rather than a before or after.

The before hook is meant to perform some checks and we're utilizing the halt flag after a before hook to check whether the hook asked to stop a request, simply because the before hook wasn't intended for that.

What people really need is an around hook. It will allow you to add information, send the request along (or not), and applying changes on a return, just like a Plack middleware.

Then we could deprecating changing the response (and stopping the request) from the before hook - which I honestly abhor. A lot of our problems have to do with having a response before there's a response, most of it for the before hook.

What do you think?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by tracing the existing before and after hook handling and its halt and response behavior; the work is done when an around hook's request and return flow is defined and covered without relying on the current before-hook response changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.