PerlDancer / PerlDancer/Dancer2

delayed() will fail when send_file() is used within

Open
#1,019 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

As the subject says, delayed() will fail when send_file() is called within. Dancer2::Core::App will fail like so:

Can't call method "env" on an undefined value at /usr/local/share/perl/5.18.2/Dancer2/Core/App.pm line 883.

The smallest code to reproduce the failure:

get '/foo' => sub {
    delayed {
        send_file 'bar.txt';
    };
};

Discovered this in Dancer2 0.162000.

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

Run the minimal delayed() and send_file() route from the issue to reproduce the undefined env error. Then inspect Dancer2::Core::App.pm around line 883 and trace how delayed() supplies request context to send_file(). Done means the route serves bar.txt without failing on an undefined value.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.