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
21
votes
11 answers

Which framework should I use to write modules?

What's the best framework for writing modules -- ExtUtils::MakeMaker (h2xs) or Module::Build?
Michael Carman
  • 30,628
  • 10
  • 74
  • 122
21
votes
9 answers

Linux: How to install DBD::Pg module?

Postgres DB is already installed. I'm not using system perl I have installed another perl in "/srv/data203806/Migration/CPAN/localperl/bin". When I'm trying to install, It is asking for PATH TO pg_config: [root1@frmrszvwb023 bin]# ./cpan install…
Naghaveer R
  • 2,890
  • 4
  • 30
  • 52
20
votes
3 answers

Is there a tool to check a Perl script for unnecessary use statements?

For Python, there is a script called importchecker which tells you if you have unnecessary import statements. Is there a similar utility for Perl use (and require) statements?
Dennis Williamson
  • 346,391
  • 90
  • 374
  • 439
19
votes
3 answers

Manual installation of a Perl Module

I have downloaded the module Digest::SHA1 and extracted it to a directory (../Digest-SHA1-2.13/) , then copied all the SHA1.* files into (../Digest-SHA1-2.13/Digest) and in the perl script, I did : use Digest::SHA1; launching the script like…
snoofkin
  • 8,725
  • 14
  • 49
  • 86
18
votes
6 answers

How to make my Perl module's README file compatible with Github's Markdown display?

I've authored the README file in my Perl module in Markdown. Github treats this README file as plain text. I tried renaming the file to "README.md"—which looks great on Github, but is invisible to Perl tools that look for a file named "README." Is…
Anirvan
  • 6,214
  • 5
  • 39
  • 53
17
votes
2 answers

What is the difference between and ?

When I use in Perl module (*.pm) files it's not reading input from the keyboard, but when I use in the same place it works fine. Why is it not getting input when I use ?
Rajalakshmi
  • 681
  • 5
  • 17
17
votes
3 answers

Ruby equivalent of Perl Data::Dumper

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?
John
  • 1,681
  • 3
  • 20
  • 28
17
votes
6 answers

How to install JSON.pm perl module on OSX

I am trying to use the po2json parser/converter from the JS gettext library (http://jsgettext.berlios.de/), but when I try to convert I get this error: Can't locate JSON.pm in @INC (@INC contains: /Library/Perl/5.12/darwin-thread-multi-2level…
ragulka
  • 4,312
  • 7
  • 48
  • 73
16
votes
4 answers

How do I get CGI.pm to output HTML5 instead of XHTML 1.0?

I'm having some trouble getting CGI.pm to output to HTML5 instead of XHTML 1.0 or HTML 4.01. When I try "HTML5" or "HTML 5" as the -dtd argument in start_html() I get a document in HTML 4. I've also tried importing :HTML5, but that doesn't seem to…
CyberSkull
  • 796
  • 1
  • 7
  • 16
16
votes
3 answers

How does a Perl program know where to find the file containing Perl module it uses?

If my Perl program uses Perl modules, how will it determine where to find the file containing the module code? For example, if the program contains: use MyModule1; # Example 1 use This::Here::MyModule2; # Example 2 where will it…
DVK
  • 126,886
  • 32
  • 213
  • 327
15
votes
2 answers

malformed header from script. Bad header=

I am receiving the following server error on a perl script: malformed header from script. Bad header=: youtube_perl.pl, Here is my source code: #!"C:\XAMPP\perl\bin\perl.exe" -T use strict; use warnings; use CGI; use CGI::Carp…
nicktendo
  • 681
  • 2
  • 11
  • 25
15
votes
3 answers

How can I set a default value for a Perl variable?

I am completely new to Perl. I needed to use an external module HTTP::BrowserDetect. I was testing some code and tried to get the name of the OS from os_string method. So, I simply initialized the object and created a variable to store the value…
sfactor
  • 12,592
  • 32
  • 102
  • 152
15
votes
2 answers

How to include file in Raku

I have two Raku files: hello.p6: sub hello { say 'hello'; } and main.p6: require 'hello.p6'; hello(); But don't work. How to can include the first file in the main script?
Juan Manuel
  • 311
  • 1
  • 11
15
votes
6 answers

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

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.
bozo user
  • 241
  • 1
  • 6
  • 15
14
votes
1 answer

Where can I find the cpanfile format definition?

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…
katastrophos
  • 521
  • 4
  • 17
1
2
3
90 91