Skip to content

Remove the pre_header_initialize and header methods from the WeBWorK::ContentGenerator package. - #3263

Open
drgrice1 wants to merge 1 commit into
openwebwork:developfrom
drgrice1:remove-pre-header-initialize
Open

drgrice1 wants to merge 1 commit into
openwebwork:developfrom
drgrice1:remove-pre-header-initialize

Conversation

@drgrice1

Copy link
Copy Markdown
Member

This is something I have been intending to do since the conversion to Mojolicious. There is no need for a pre_header_initialize and initialize method anymore. Just one is needed. Furthermore, the name pre_header_initialize no longer has the meaning it was named for. That being an initialization before the header. The header is no longer set like it was with modperl and this method is not before that.

Technically the initialize method is removed and the pre_header_initialize method renamed to the initialize method in terms of when the method is called from the WeBWorK::ContentGenerator::go method. The only real difference between the methods is that the reply_with_file or reply_with_redirect methods had to be called from the pre_header_initialize method, and would not work from the initialize method.

For most WeBWorK::ContentGenerator subclasses all that was needed was to rename the pre_header_initialize method to initialize. However, there were a few that called both methods, and so the contents of the two methods had to be carefully merged to preserve calling order and properly handle early returns.

As to the header method, it has done nothing since the conversion to Mojolicious. Its return value is entirely ignored and nothing overrides it.

…WorK::ContentGenerator` package.

This is something I have been intending to do since the conversion to
Mojolicious.  There is no need for a `pre_header_initialize` and
`initialize` method anymore.  Just one is needed.  Furthermore, the name
`pre_header_initialize` no longer has the meaning it was named for.
That being an initialization before the header.  The header is no longer
set like it was with modperl and this method is not before that.

Technically the `initialize` method is removed and the
`pre_header_initialize` method renamed to the `initialize` method in
terms of when the method is called from the `WeBWorK::ContentGenerator::go`
method. The only real difference between the methods is that the
`reply_with_file` or `reply_with_redirect` methods had to be called from
the `pre_header_initialize` method, and would not work from the
`initialize` method.

For most `WeBWorK::ContentGenerator` subclasses all that was needed was
to rename the `pre_header_initialize` method to `initialize`.  However,
there were a few that called both methods, and so the contents of the
two methods had to be carefully merged to preserve calling order and
properly handle early returns.

As to the `header` method, it has done nothing since the conversion to
Mojolicious. Its return value is entirely ignored and nothing overrides
it.
@drgrice1
drgrice1 force-pushed the remove-pre-header-initialize branch from aa6651c to e9a5b20 Compare October 30, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant