Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would like a lazy require option. (rt54947) #16

Open
rjbs opened this issue Feb 1, 2013 · 2 comments
Open

Would like a lazy require option. (rt54947) #16

rjbs opened this issue Feb 1, 2013 · 2 comments

Comments

@rjbs
Copy link
Owner

rjbs commented Feb 1, 2013

https://rt.cpan.org/Ticket/Display.html?id=54947

I've been using App::Cmd as a framework for defining individual batch
jobs. This has worked out fairly well so far, but as the number of
jobs/commands has increased into the 70+ range, the overhead of doing a
C on each command has become noticeable.

Because these jobs do a wide range of tasks, each call to the main app
ends up loading 600-ish pm files.

Would you consider adding a lazy_load option which, when true, would
only require the given command during the _prepare_command phase?
Using this option would necessarily enforce a 1-command-per-pm limit.

An added benefit to this in a shared environment, is that other users'
broken commands only affect you if you attempt a command listing or help.

I've attached a proof of concept patch. If you are interested in adding
this option I could create a more formal patch with tests.

Thanks,

  • danboo
@nichtich
Copy link
Contributor

nichtich commented Nov 1, 2013

See also this blog post referencing the issue. Lazy loading of commands is also related to pull request #20 - it would be great to solve both issues (how to specify commands and how these commands are loaded) together. The slowness of App::Cmd has already complained before and Mark Lawrence wrote App::Dispatcher as fork of App::Cmd in 2011. This is confusing if one is looking for a tool to create a command line app. I'd prefer to get App::Cmd as best as possible instead of more modules on CPAN with unknown features and downsides.

@rjbs
Copy link
Owner Author

rjbs commented Sep 26, 2014

Why did I never add the obvious comment: Yes, this would be cool.

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

No branches or pull requests

2 participants