小编kat*_*hos的帖子

我在哪里可以找到cpanfile格式定义?

我们考虑使用MinillaDist :: Milla进行perl开发.声明依赖关系是通过cpanfile完成的.我期望找到一个确切的定义,以及如何宣布.但

  • perldoc cpanfile:仅显示主要用法."另请参见"部分没有帮助.

  • perldoc Module :: CPANfile:与cpanfile相同.

  • perldoc cpanfile-faq:仅解释确切的语法或链接

熟悉的DSL语法

这是一种新的文件类型,但格式和语法并不是全新的.它可以声明的元数据恰好是CPAN Meta Spec中"Prereqs"的子集.

语法从Module :: Install中借鉴了很多.Module :: Install是一种轻松声明模块元数据(如名称,作者和依赖项)的好方法.cpanfile格式只是将依赖项提取到一个单独的文件中,这意味着大多数开发人员都熟悉语法.

有谁知道在哪里可以找到cpanfile语法/格式的确切描述?

perl perl-module

13
推荐指数
1
解决办法
919
查看次数

无法理解多行正则表达式qr /(.$.+)/ xms的结果

对于字符串"aa \nbb \ncc"我想从左边的最后一个字母到第一个换行符("a")到多行字符串的末尾匹配,并且预期

"aa\nbb\ncc" =~ qr/( . $ .+ )/xms 火柴 a\nbb\ncc

然后

"aa\nbb\ncc\n" =~ qr/( . $ .+ )/xms比赛 a\nbb\ncc\n.

但我敌不过"aa\nbb\ncc" =~ qr/( . $ .+ )/xms 和匹配c\n"aa\nbb\ncc" =~ qr/( . $ .+ )/xms.

使用qr/( . $ ..+ )/xms我获得了预期的结果(参见示例代码).

Perl版本5.14.2.

任何人都可以解释这种行为吗?

perldoc perlre:

   m   Treat string as multiple lines.  That is, change "^" and "$" 
       from matching the start or end of the string to matching the start 
       or end …
Run Code Online (Sandbox Code Playgroud)

regex perl

12
推荐指数
1
解决办法
2317
查看次数

Tree :: Simple :: traverse()不访问树的根 - 错误或功能?

如果我尝试以下代码

#!/usr/bin/env perl

use Tree::Simple;

# Tree:
#                   a
#         _________ | ________
#        /          |         \ 
#       b           c          d 
#                 /    \
#                e      f  
#                        \
#                         g
#

my $tree = Tree::Simple->new('a', Tree::Simple->ROOT);

$tree->addChildren( Tree::Simple->new('b'),
                    Tree::Simple->new('c'),
                    Tree::Simple->new('d'),
                  );

$tree->getChild(1)->addChildren (
                    Tree::Simple->new('e'),
                    Tree::Simple->new('f'),
);

$tree->getChild(1)->getChild(1)->addChildren (
                    Tree::Simple->new('g'),
);

$trav_func= sub {
    my $node = shift;
    printf "node : %s  leaf : %3s   root : %s\n",
           $node->getNodeValue, $node->isLeaf ? 'yes' : 'no',
           $node->isRoot ? 'yes' : 'no';
}; …
Run Code Online (Sandbox Code Playgroud)

perl module

6
推荐指数
1
解决办法
1064
查看次数

标签 统计

perl ×3

module ×1

perl-module ×1

regex ×1