Questions tagged [perl-module]

A Perl module is a reusable portion of Perl code.

In Perl, modules are vital to object-oriented design and can provide static variables referenced similarly to those in C++. The package model improves code organization, by allowing the coder to import functions from external files and 'bless' new object instances. Further, perl allows the directory structure holding modules to aid in the description of an object hierarchy. Perl module files traditionally have the extension '.pm'

see perlmod - perldoc.perl.org for more information.

1358 questions
6
votes
1 answer

How do you create application-level options using Perl's App::Cmd?

Update from FMc I'm putting a bounty on this question, because I'm puzzling over the same problem. To rephrase the question, how do you implement application-level options (those that apply to an entire program, script.pl), as opposed to those that…
user419056
  • 61
  • 2
6
votes
1 answer

What is difference between installing a perl module and copying whole folder?

I have installed a perl module, say XYZ then a folder is created that contains many .pm files. I copied the folder and put it in any other system where XYZ is not installed. So, I'm able to use methods of XYZ module in both system. I mean, I'm…
Kamal Nayan
  • 1,890
  • 21
  • 34
6
votes
1 answer

My Perl module from CPAN won't install, what do I do?

This is a canonical question for the above problem, inspired by this answer and this question. Please edit and improve it. I'm trying to install a module from CPAN, using the CPAN/cpanm/CPANPLUS client. However, I'm getting build or test errors…
dsolimano
  • 8,870
  • 3
  • 48
  • 63
6
votes
2 answers

Text::SpellChecker module and Unicode

#!/usr/local/bin/perl use strict; use warnings; use Text::SpellChecker; my $text = "coördinator"; my $checker = Text::SpellChecker->new( text => $text ); while ( my $word = $checker->next_word ) { print "Bad word is $word\n"; } Output: Bad…
Chankey Pathak
  • 21,187
  • 12
  • 85
  • 133
6
votes
3 answers

How to check availability of Perl, its version and presence of a required module?

I have written a Perl script, I just want to give it to every one, for that I planned to write a bash script which is used to test the environment of a user and find whether that environment is capable of running the Perl script. I want to test…
abubacker
  • 4,638
  • 6
  • 32
  • 35
6
votes
1 answer

Wide character error using utf8 pragma with HTML::Laundry

I am having trouble with the HTML::Laundry module. The following snippet demonstrates what happens when using use utf8 or not. Enabling use utf8 results in an error: Wide character in subroutine entry at /usr/local/share/perl/5.14.2/HTML/Laundry.pm…
xherbie
  • 63
  • 2
6
votes
3 answers

How do I use beta Perl modules from beta Perl scripts?

If my Perl code has a production code location and "beta" code location (e.g. production Perl code us in /usr/code/scripts, BETA Perl code is in /usr/code/beta/scripts; production Perl libraries are in /usr/code/lib/perl and BETA versions of those…
DVK
  • 126,886
  • 32
  • 213
  • 327
6
votes
1 answer

Perl's Modules lists

I got confused with something while importing a module, like: use POSIX; & use POSIX(); & use POSIX qw(WNOHANG); What is the difference between these use?
Mahmoud Emam
  • 1,499
  • 4
  • 20
  • 37
6
votes
5 answers

Should I change my utilities.pl to a utilities.pm module?

In our product we have a big utilities file that we require (with do) at the beginning of a lot of our files. Is there a reason not to turn this into a module? For example, instead of doing this: do '../dbi_utilities.pl'; our…
Frew Schmidt
  • 9,364
  • 16
  • 64
  • 86
6
votes
3 answers

Perl: Can't call method "say" without a package or object reference

Im trying to learn Perl, am using OS-X 10.8.4 and have Perl version: This is perl 5, version 12, subversion 4 (v5.12.4) built for darwin-thread-multi-2level I am trying to run this code: #!/usr/bin/env perl use strict; use warnings; my $a = 1; my…
Richard
  • 316
  • 3
  • 12
6
votes
3 answers

Perl Install PAR:Packer Problems

My perl version is 5.16.2 on my Windows 7 64bit, I failed to install PAR:Packer. I tried active perl and strawberry perl , both got the same error. Can you please give me some suggestion. Below is my experience: I tried ppm install PAR:Packer,…
emily
  • 61
  • 1
  • 3
6
votes
2 answers

How do I override perl's compilation flags when building modules?

When building a Perl module ExtUtils::MakeMaker uses the flags defined in Config.pm (see perldoc Config) for values such as ccflags and ldflags. How do I override theses values (short of editing the Makefile.PL)? perl Makefile.PL ldflags=
6
votes
1 answer

JSON::XS "Usage" croak

I can't seem to use JSON::XS's OO interface properly. The following croaks with an error I can't track down: use JSON::XS; my $array = ['foo', 'bar']; my $coder = JSON::XS->new->utf8->pretty; print $coder->encode_json($array); This croaks with the…
Nate Glenn
  • 6,455
  • 8
  • 52
  • 95
6
votes
1 answer

How to print out Nagios Service UP Time Percentage from Nagios-Report Perl Module

I can print out Host UP Time percentage from Nagios-Report Perl Module with following code: #!/usr/bin/perl use strict ; use Nagios::Report ; my $x = Nagios::Report->new(q) or die "Can't construct Nagios::Report…
Zim3r
  • 580
  • 2
  • 14
  • 36
6
votes
1 answer

is_quoted() method in Text::CSV perl module

I may be missing something obvious, but I have a very simple perl script in which the is_quoted() method in the Text::CSV module is not working as expected. Here's the code: # cat ./testcsv.pl #!/usr/bin/perl use strict; use Text::CSV; my $csv =…
barush
  • 303
  • 2
  • 6