小编use*_*411的帖子

如何将自定义模块添加到perl纸箱?

我正在尝试使用纸箱作为部署容器.但我遇到了一个小问题.我不知道,如何安装私有模块.

创建了一个快速测试模块:

h2xs -AX Foo::Bar

tree Foo-Bar/
Foo-Bar/
??? Changes
??? lib
?   ??? Foo
?       ??? Bar.pm
??? Makefile.PL
??? MANIFEST
??? README
??? t
    ??? Foo-Bar.t
Run Code Online (Sandbox Code Playgroud)

打包它:tar cvfz Foo-Bar-0.01.tar.gz Foo-Bar/ 将包复制到vendor/cache目录.

ls vendor/cache/
Foo-Bar-0.01.tar.gz  Try-Tiny-0.18.tar.gz

cat cpanfile
requires 'Foo::Bar', '0.01';
requires 'Try::Tiny', '0.18';

carton install --cached
Installing modules using /home/donpedro/Garbage/Carton/cpanfile
! Couldn't find module or a distribution Foo::Bar (0.01)
Successfully installed Try-Tiny-0.18
! Installing the dependencies failed: Module 'Foo::Bar' is not installed
! Bailing out …
Run Code Online (Sandbox Code Playgroud)

perl

10
推荐指数
1
解决办法
1337
查看次数

如何在祝福中重定向stdout?

长话短说:我想为开发守护进程构建一个CLI.守护进程向stdout输出不同种类的信息,我希望以可滚动的方式将该信息传递给屏幕区域中的用户.我正在努力让stdout得到祝福.下面简单的原型,缓冲stdout,所以信息永远不会完整.

var blessed = require('blessed');

var screen = blessed.screen(),
body = blessed.box({
  top: 1,
  left: 0,
  width: '100%',
  height: '99%'
}),
statusbar = blessed.box({
  top: 0,
  left: 0,
  width: '100%',
  height: 1,
  style: {
    fg: 'white',
    bg: 'blue'
  }
});

screen.append(statusbar);
screen.append(body);

screen.key(['escape', 'q', 'C-c'], function(ch, key) {
  return process.exit(0);
});

function status(text) { statusbar.setContent(text); screen.render(); }
function log(text) { body.insertLine(0, text); screen.render(); }

status('TEST');

var spawn = require('child_process').spawn;

yes = spawn('yes', ['it is']);

ls.stdout.on('data', function (data) {
   log(data.toString());
}); …
Run Code Online (Sandbox Code Playgroud)

command-line-interface node.js

7
推荐指数
1
解决办法
620
查看次数

标签 统计

command-line-interface ×1

node.js ×1

perl ×1