skaji/cpm

Cannot require self-contained cpm without running it

XSven opened this issue · 3 comments

XSven commented

Recently I have used a self-contained cpanm file in the following way

require 'cpanm';
my $cpanm = App::cpanminus::script->new;
...

Now I wanted to replace cpanm with a self-contained cpm file using the same approach

require 'cpm';
my $cpm = App::cpm::CLI->new;
...

The require fails with the message

Need subcommand, try cpm --help

Seemingly the self-contained cpm is not implemented as a modulino (Scripts as Modules).

  • Can this be changed short-term?!
  • Is there another way how I can load a self-contained cpm and control its execution separately?
skaji commented

After installing App::cpm module from CPAN, you could use App::cpm::CLI.

But please note that the use of App::cpm::CLI is not supported and I will change the internal of cpm whenever I want.

skaji commented

There is no way to use self contained cpm as a module.

XSven commented

This is a pity. I want to use cpm in another perl project. I dislike to start a perl program from another perl program using a system() call.