perl-module

Where can I find the cpanfile format definition?

不问归期 提交于 2019-12-03 12:00:38
We consider to use Minilla or Dist::Milla for our perl development. Declaring dependencies is done via cpanfile . I expected to find an exact definintion of what and how can be declared. But perldoc cpanfile : Shows only the principal usage. 'SEE ALSO' section does not help. perldoc Module::CPANfile: same as cpanfile. perldoc cpanfile-faq: no explanation of the exact syntax or a link to it, only Familiar DSL syntax This is a new file type, but the format and syntax isn't entirely new. The metadata it can declare is exactly a subset of "Prereqs" in CPAN Meta Spec. The syntax borrows a lot from

Ruby equivalent of Perl Data::Dumper

时光总嘲笑我的痴心妄想 提交于 2019-12-03 08:50:44
问题 I am learning Ruby & Perl has this very convenient module called Data::Dumper, which allows you to recursively analyze a data structure (like hash) & allow you to print it. This is very useful while debugging. Is there some thing similar for Ruby? 回答1: Look into pp example: require 'pp' x = { :a => [1,2,3, {:foo => bar}]} pp x there is also the inspect method which also works quite nicely x = { :a => [1,2,3, {:foo => bar}]} puts x.inspect 回答2: I normally use a YAML dump if I need to quickly

How do I retrieve an integer's ordinal suffix in Perl (like st, nd, rd, th)

假装没事ソ 提交于 2019-12-03 06:18:28
I have number and need to add the suffix: 'st', 'nd', 'rd', 'th'. So for example: if the number is 42 the suffix is 'nd' , 521 is 'st' and 113 is 'th' and so on. I need to do this in perl. Any pointers. Daniel Li Try this: my $ordinal; if ($foo =~ /(?<!1)1$/) { $ordinal = 'st'; } elsif ($foo =~ /(?<!1)2$/) { $ordinal = 'nd'; } elsif ($foo =~ /(?<!1)3$/) { $ordinal = 'rd'; } else { $ordinal = 'th'; } Bill Ruppert Use Lingua::EN::Numbers::Ordinate . From the synopsis: use Lingua::EN::Numbers::Ordinate; print ordinate(4), "\n"; # prints 4th print ordinate(-342), "\n"; # prints -342nd # Example of

Can't locate DBI.pm

拈花ヽ惹草 提交于 2019-12-03 04:52:58
I'm trying to launch this script: #!/usr/bin/perl use DBI; my $dbh = DBI->connect( 'dbi:Oracle:host=lonlin2;sid=TIMFX1AD;port=1524','xbsesdbo','xbsesdbo123' ) || die ( $DBI::errstr . "\n" ); my $query= "SELECT * FROM product_elements WHERE element_id = 1001"; my $queryHandler= $dbh->prepare($query); my $result= $queryHandler->execute(); open(fileHandler,"> note.txt"); print fileHandler "Risultato query: $result\n"; my $e= $dbh->disconnect(); close(fileHandler); When I launch this script I receive this error: Can't locate DBI.pm in @INC (@INC contains: /opt/perl_32/lib/5.8.3/IA64.ARCHREV_0

Ruby equivalent of Perl Data::Dumper

一笑奈何 提交于 2019-12-02 22:45:31
I am learning Ruby & Perl has this very convenient module called Data::Dumper, which allows you to recursively analyze a data structure (like hash) & allow you to print it. This is very useful while debugging. Is there some thing similar for Ruby? Look into pp example: require 'pp' x = { :a => [1,2,3, {:foo => bar}]} pp x there is also the inspect method which also works quite nicely x = { :a => [1,2,3, {:foo => bar}]} puts x.inspect I normally use a YAML dump if I need to quickly check something. In irb the syntax is simply y obj_to_inspect . In a normal Ruby app, you may need to add a

Can't load '/usr/lib/perl5/vendor_perl/5.8/msys/auto/XML/LibXML/Common/Common.dll' for module XML::LibXML::Common: dlopen: Win32 error 126

这一生的挚爱 提交于 2019-12-02 17:28:27
问题 I'm stuck with this error: Can't load '/usr/lib/perl5/vendor_perl/5.8/msys/auto/XML/LibXML/Common/Common.dll' for module XML::LibXML::Common: dlopen: Win32 error 126 at /usr/lib/perl5/5.8 /msys/DynaLoader.pm line 230. at /usr/lib/perl5/vendor_perl/5.8/msys/XML/LibXML.pm line 12 Compilation failed in require at /usr/lib/perl5/vendor_perl/5.8/msys/XML/LibXML.pm line 12. BEGIN failed--compilation aborted at /usr/lib/perl5/vendor_perl/5.8/msys/XML/LibXML.pm line 12. Compilation failed in require

Installing Older Version of Module in Active Perl

你。 提交于 2019-12-02 16:13:29
问题 I am trying to install the Date::Manip Module in Perl. I am running Perl Version 5.14.2 and it does not seem to be installing successfully through the PPM. (PPM throws a 401 Access required error). I am guessing that the error here is that the Version of Perl is outdated for the module in the ppm. Since this is in the server and there are many other scripts running on a day to day basis, I can not upgrade the Perl version. I need to install the previous version of the Date::Manip module but

perl: inter-module variable use

只谈情不闲聊 提交于 2019-12-02 15:30:32
问题 I have a module misc with variable $verbose : use strict; use diagnostics; package misc; my $verbose = 1; and module mymod which uses misc : use strict; use diagnostics; use misc; package mymod; sub mysub ($) { ... ($misc::verbose > 0) and print "verbose!\n"; } which is, in turn, used by myprog : use strict; use diagnostics; use misc; use mymod; mymod::mysub("foo"); when I execute myprog , I get this warning: Use of uninitialized value $misc::verbose in numeric gt (>) at mymod.pm line ...

How do I sort a list of IP addresses and compute a class and netmask for each? [closed]

自古美人都是妖i 提交于 2019-12-02 13:35:44
I have 2 options. One is that I have a array that has a list of IPs. For example my @Ip=(); # array that has the IPs below in it Sample input: 108.0.0.30 108.0.0.30 108.0.0.30 192.168.1.1 192.168.1.2 10.0.0.1 I need a program that can sort such an array and tell which network class and subnet mask it is. For example, the output should be like 10.1.1.1/25 10.1.1.1 is ip and 25 is submask Net::IP , Net::IP::Resolver , Net::IP::Match::Regexp and other Submodules from Net::IP are doing that fine for you. Just the part with sorting is difficult. But if you google it, you find some nice Methods. For

Perl IPTables Module Installation Error

时光总嘲笑我的痴心妄想 提交于 2019-12-02 10:51:10
I've been trying to install the IPTables module for perl http://metacpan.org/pod/IPTables::IPv4 and I've been running into errors during installation. I've tried installing using the CPAN in shell as well as downloading the tarball form the link above. Both installation give me errors. I am not sure how to get the dump from CPAN but what I can get is a dump of my shell when I run the MAKE file from the tarball: [root@localhost IPTables-IPv4-0.98]# make make -C libiptc/ all make[1]: Entering directory `/home/student/Downloads/IPTables-IPv4-0.98/libiptc' gcc -o libip6tc.o -c libip6tc.c -I..