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
7
votes
3 answers

What does "my ($self, %myInputs) = @_;" mean?

I came across this line a lot of times in perl modules but I could not figure out what this exactly means. my ($self, %myInputs) = @_; Kindly explain me the statement so that I can proceed.
user1855888
  • 131
  • 2
  • 5
7
votes
3 answers

How can a perl module find its own path?

I'm creating my own module, lets call it X::Y. Of course, the module will be in the file X/Y.pm. Lets say Y needs to call an external program, prog. Ideally I'd just like to put prog in X, so I can run X/prog. I'd like to not have hardcode X/progs…
Clinton
  • 22,361
  • 15
  • 67
  • 163
7
votes
3 answers

Perl: Dynamic module loading, object inheritance and "common helper files"

In a nutshell I try to model a network topology using objects for every instance in the network. Additionally I got a top-level manager class responsible for, well, managing these objects and performing integrity checks. The filestructure looks like…
incaseoftrouble
  • 353
  • 1
  • 13
7
votes
2 answers

How to derefence a copy of a STDIN filehandle?

I'm trying to figure out how to get a Perl module to deference and open a reference to a filehandle. You'll understand what I mean when you see the main program: #!/usr/bin/perl use strict; use warnings; use lib '/usr/local/share/custom_pm'; use…
cooldood3490
  • 2,418
  • 7
  • 51
  • 66
7
votes
4 answers

Can't load 'C:/strawberry/perl/site/lib/auto/XML/LibXML/LibXML.dll' for module XML::LibXML

I have downloaded strawberry PERL and writing one application with CGI Perl Apache on Winxp sp3). One of the libraries (written by someone else) which I using uses XML::LibXML. When i load the page it gives Internal Server Error. From Apache error…
7
votes
2 answers

How to manually install XS modules?

Correct me if i'm wrong, but XS and Dynaloader based modules are those who use C/C++ shared objects (.so) and which are not PP (Pure Perl)? Now assuming I have a machine, which does not have web-connectivity whatsoever (Solaris 10) and I want, for…
snoofkin
  • 8,725
  • 14
  • 49
  • 86
6
votes
3 answers

How to make a HTTP PUT request using LWP?

I'm trying to change this request to a HTTP PUT request, any idea how ? my $request = LWP::UserAgent->new; my $response = $request->get($url, "apikey", $apiKey, "requestDate", $requestDate);
Stephane
  • 4,978
  • 9
  • 51
  • 86
6
votes
3 answers

Perl multi-dimensional table with headers

I'm trying to implement a multi-dimensional table with headers. Here's an example for 2D: < dimension1 > /\ 'column0' 'column1' dimension0 'row0' data00 data10 \/ 'row1' data01 …
Giovanni Funchal
  • 8,934
  • 13
  • 61
  • 110
6
votes
2 answers

Creating Packages With Perl

I seem to be having a lot of trouble with making my first, simple Package (actually it is my first package period). I am doing everything I should be doing (I think) and it still isn't working. Here is the Package (I guess you can call it a…
Dynamic
  • 921
  • 1
  • 12
  • 31
6
votes
1 answer

Tty.c: loadable library and perl binaries are mismatched

I upgraded Ubuntu from zesty to bionic. In the process perl was upgraded from 5.24.1 to 5.26.1. Now I am getting this error when I try to install Expect. Tty.c: loadable library and perl binaries are mismatched I have re-installed IO::Tty and that…
Maverik Minett
  • 2,131
  • 3
  • 17
  • 28
6
votes
1 answer

Regexp::Debugger Perl module doesn't seem to work within another Perl Module

I am writing a Perl module that involves some very complicated regular expressions that are nearly impossible to debug without a tool to help me. I figured the Regexp::Debugger module would be the perfect tool for the job, but it only seems to work…
tjwrona1992
  • 8,614
  • 8
  • 35
  • 98
6
votes
2 answers

Installation of modules Perl 6 failed - No compiler available for Perl v6.c

I installed Rakudo, the Perl 6 interpreter, by: sudo apt-get install rakudo I am following a tutorial about installation of Perl 6 modules: http://perl6maven.com/how-to-install-perl6-modules And in the last step I get this error: perl6…
Daniel
  • 7,684
  • 7
  • 52
  • 76
6
votes
2 answers

Save resources by only loading parts of a module?

I am reading through O'Reilly's Perl Objects, References & Modules, more specifically its section about modules. It states that when using use Some::Module you can specify an import list. From its explanation it seems that the only benefit of using…
Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239
6
votes
3 answers

How can I parse user-agent strings in Perl?

I need to parse the user-agents in HTTP-headers from a text file so as to determine the browser, the version, the OS and possibly the device. so few examples of those lines are: User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Update a; AOL 6.0;…
sfactor
  • 12,592
  • 32
  • 102
  • 152
6
votes
3 answers

Stopping Perl XS modules from silently falling back to pure-perl

It seems some (many?) modules on CPAN are partly implemented in C using XS, and can fall back to a pure-perl implementation if necessary. While this is smart, it can obviously hurt performance, and I would like to know it happens so I can fix the…
Øyvind Skaar
  • 2,278
  • 15
  • 15