Linux中國

Linux/Unix 桌面趣事:終端上的聖誕樹

安裝 Acme::POE::Tree

安裝perl模塊最簡單的辦法就是使用CPAN(Perl綜合典藏網(Comprehensive Perl Archive Network))。打開終端,把下面的指令敲進去便可安裝Acme::POE::Tree。

### 以root身份運行 ###
perl -MCPAN -e 'install Acme::POE::Tree'

示例輸出:

Installing /home/vivek/perl5/man/man3/POE::NFA.3pm
Installing /home/vivek/perl5/man/man3/POE::Kernel.3pm
Installing /home/vivek/perl5/man/man3/POE::Loop.3pm
Installing /home/vivek/perl5/man/man3/POE::Resource.3pm
Installing /home/vivek/perl5/man/man3/POE::Filter::Map.3pm
Installing /home/vivek/perl5/man/man3/POE::Resource::SIDs.3pm
Installing /home/vivek/perl5/man/man3/POE::Loop::IO_Poll.3pm
Installing /home/vivek/perl5/man/man3/POE::Pipe::TwoWay.3pm
Appending installation info to /home/vivek/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/perllocal.pod
  RCAPUTO/POE-1.367.tar.gz
  /usr/bin/make install  -- OK
  RCAPUTO/Acme-POE-Tree-1.022.tar.gz
  Has already been unwrapped into directory /home/vivek/.cpan/build/Acme-POE-Tree-1.022-uhlZUz
  RCAPUTO/Acme-POE-Tree-1.022.tar.gz
  Has already been prepared
Running make for R/RC/RCAPUTO/Acme-POE-Tree-1.022.tar.gz
cp lib/Acme/POE/Tree.pm blib/lib/Acme/POE/Tree.pm
Manifying 1 pod document
  RCAPUTO/Acme-POE-Tree-1.022.tar.gz
  /usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01_basic.t .. ok
All tests successful.
Files=1, Tests=2,  6 wallclock secs ( 0.09 usr  0.03 sys +  0.53 cusr  0.06 csys =  0.71 CPU)
Result: PASS
  RCAPUTO/Acme-POE-Tree-1.022.tar.gz
Tests succeeded but one dependency not OK (Curses)
  RCAPUTO/Acme-POE-Tree-1.022.tar.gz
  [dependencies] -- NA

在Shell中顯示聖誕樹

只需要在終端上運行以下命令:

perl -MAcme::POE::Tree -e 'Acme::POE::Tree->new()->run()'

示例輸出

Gif 01: An animated christmas tree in Perl

Gif 01: 一棵用Perl寫的喜慶聖誕樹

樹的定製

以下是我的腳本文件tree.pl的內容:

#!/usr/bin/perl

use Acme::POE::Tree;
my $tree = Acme::POE::Tree->new(
{
  star_delay => 1.5,  # shimmer star every 1.5 sec
  light_delay => 2,   # twinkle lights every 2 sec
  run_for => 10,      # automatically exit after 10 sec
}
);
$tree->run();

這樣就可以通過修改stardelay、runfor和light_delay參數的值來自定義你的樹了。一棵好玩的終端聖誕樹就此誕生。

via: http://www.cyberciti.biz/open-source/command-line-hacks/linux-unix-desktop-fun-christmas-tree-for-your-terminal/

作者:Vivek Gite 譯者:soooogreen 校對:wxy

本文由 LCTT 原創編譯,Linux中國 榮譽推出


本文轉載來自 Linux 中國: https://github.com/Linux-CN/archive

對這篇文章感覺如何?

太棒了
0
不錯
0
愛死了
0
不太好
0
感覺很糟
0
雨落清風。心向陽

    You may also like

    Leave a reply

    您的電子郵箱地址不會被公開。 必填項已用 * 標註

    此站點使用Akismet來減少垃圾評論。了解我們如何處理您的評論數據

    More in:Linux中國