我需要一个 perl5 脚本中的轻量级对象系统。在阅读了Mouse.pm、Moo.pm和Mo.pm的文档后,我在 Moo 和 Mo 之间折腾。最终的决定因素是 Mo 模块没有依赖关系(见页面右侧 - ”依赖项”是灰色的)。
因此,我继续进行我认为简单的安装:
User@Ubuntu-iMac:~$ perl -MCPAN -e shell
Terminal does not support AddHistory.
cpan shell -- CPAN exploration and modules installation (v2.05)
Enter 'h' for help.
cpan[1]> Terminal does not support GetHistory.
Lockfile removed.
User@Ubuntu-iMac:~$ sudo perl -MCPAN -e shell
[sudo] password for User:
Terminal does not support AddHistory.
cpan shell -- CPAN exploration and modules installation (v2.05)
Enter 'h' for help.
cpan[1]> install Mo
Reading '/home/User/.cpan/Metadata'
Database was generated on Tue, 23 Feb 2016 02:17:02 GMT
Running install for module 'Mo'
Fetching with LWP:
http://www.cpan.org/authors/id/I/IN/INGY/Mo-0.39.tar.gz
Checksum for /home/User/.cpan/sources/authors/id/I/IN/INGY/Mo-0.39.tar.gz ok
Scanning cache /home/User/.cpan/build for sizes
............................................................................DONE
Configuring I/IN/INGY/Mo-0.39.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Mo
Writing MYMETA.yml and MYMETA.json
INGY/Mo-0.39.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- OK
Running make for I/IN/INGY/Mo-0.39.tar.gz
---- Unsatisfied dependencies detected during ----
---- INGY/Mo-0.39.tar.gz ----
Moose [requires,optional]
IO::All [requires,optional]
Mouse [requires,optional]
... many lines of installation of dozens of modules deleted ...
所以我的问题是 - 为什么它认为它需要Mouse
,IO::All
而且,最痛苦的是,Moose
?请注意,我可以看到它说 [requires,optional] - 但我认为这两个术语是矛盾的。