编译的时候遇到问题:
Can’t locate Switch.pm in @INC (you may need to install the Switch module) (@INC contains:
环境为ubuntu20
解决方法:
1.直接安装libswitch-perl
sudo apt-get install libswitch-perl
这步操作完之后还不行,需要做第2步操作,是因为perl版本的原因
2.执行命令:sudo cpan -f Switch 根据提示一直填"yes",等待安装完成 。再次编译OK。
/usr/local/lib/perl5/5.14.2$ sudo cpan -f Switch
CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.
Would you like to configure as much as possible automatically? [yes] yes
Autoconfigured everything but 'urllist'.
Now you need to choose your CPAN mirror sites. You can let me
pick mirrors for you, you can select them from a list or you
can enter them by hand.
Would you like me to automatically choose some CPAN mirror
sites for you? (This means connecting to the Internet) [yes] yes
Trying to fetch a mirror list from the Internet
Fetching with HTTP::Tiny:
http://www.perl.org/CPAN/MIRRORED.BY
Looking for CPAN mirrors near you (please be patient)
. done!
New urllist
http://www.cpan.org/
Autoconfiguration complete.
commit: wrote '/root/.cpan/CPAN/MyConfig.pm'
You can re-run configuration any time with 'o conf init' in the CPAN shell
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/01mailrc.txt.gz
Going to read '/root/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with HTTP::Tiny:
http://www.cpan.org/modules/02packages.details.txt.gz
Going to read '/root/.cpan/sources/modules/02packages.details.txt.gz'
Database was generated on Fri, 16 Jul 2021 18:17:03 GMT
HTTP::Date not available
.............
New CPAN.pm version (v2.28) available.
[Currently running version is v1.960001]
You might want to try
install CPAN
reload cpan
to both upgrade CPAN.pm and run the new version without leaving
the current session.
...............................................................DONE
Fetching with HTTP::Tiny:
http://www.cpan.org/modules/03modlist.data.gz
Going to read '/root/.cpan/sources/modules/03modlist.data.gz'
DONE
Going to write /root/.cpan/Metadata
Running install for module 'Switch'
Running make for C/CH/CHORNY/Switch-2.17.tar.gz
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/C/CH/CHORNY/Switch-2.17.tar.gz
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/C/CH/CHORNY/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/C/CH/CHORNY/Switch-2.17.tar.gz ok
CPAN.pm: Going to build C/CH/CHORNY/Switch-2.17.tar.gz
Checking if your kit is complete...
Looks good
Writing Makefile for Switch
Writing MYMETA.yml
cp Switch.pm blib/lib/Switch.pm
Manifying blib/man3/Switch.3
CHORNY/Switch-2.17.tar.gz
/usr/bin/make -- OK
'YAML' not installed, will not store persistent state
Running make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/given.t ... ok
t/nested.t .. ok
t/switch.t .. ok
All tests successful.
Files=3, Tests=590, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.09 cusr 0.00 csys = 0.11 CPU)
Result: PASS
CHORNY/Switch-2.17.tar.gz
/usr/bin/make test -- OK
Running make install
Manifying blib/man3/Switch.3
Installing /usr/local/lib/perl5/site_perl/5.14.2/Switch.pm
Installing /usr/local/share/man/man3/Switch.3
Appending installation info to /usr/local/lib/perl5/5.14.2/x86_64-linux/perllocal.pod
CHORNY/Switch-2.17.tar.gz
/usr/bin/make install -- OK