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
0
votes
1 answer

How to Display IFconfig information with perl program in Linux

I have an assignment where i am supposed to create a perl script in linux that will give an output similar to that of the linux command "ifconfig". I have started writing the script but I repeatedly get errors. I would like some assistance in…
user218001
  • 35
  • 1
  • 8
0
votes
2 answers

Perl telnet command not sending every command

I have the following program below which telnets into another device and prints serial number and Mac address. My problem is that for some reason if I send the command once it skips the first command and sends the second, but if I copy the same…
0
votes
2 answers

looking for help call a perl script with arguments from java class

I have to call a Perl script from a Java class. I am able to do that using final ProcessBuilder builder = new ProcessBuilder("perl", "/home/abc.pl"); I am wondering if I can pass parameters something like new ProcessBuilder("perl", "/home/abc.pl …
user2254173
  • 113
  • 1
  • 2
  • 9
0
votes
1 answer

Unable to load Perl subpackage

I can't work out why I am unable to access a subpackage: mbzdb: #!/usr/bin/perl -w use lib "./lib"; use MbzDb::Instance; my $instance = new MbzDb::Instance(); $instance->startFromCommandLine(); lib/MbzDb/Instance.pm: #!/usr/bin/perl -w package…
Elliot Chance
  • 5,526
  • 10
  • 49
  • 80
0
votes
1 answer

how to incorporate perl modules into script

I am a beginner at Perl, I need to use functions from the Perl module Date::Easter in order to create a program that will take a year from user input and display the date of Easter within that year, i need to know how you would incorporate that…
user218001
  • 35
  • 1
  • 8
0
votes
1 answer

Fail to load the App due to ODBC driver

install_driver(ODBC) failed: Can't load '/usr/local/lib/perl5/auto/DBD/ODBC/ODBC.so' for module DBD::ODBC: libodbc.so.1: cannot open shared object file: No such file or directory at /usr/lib/perl5/DynaLoader.pm line 200. at (eval 3) line 3…
user1363308
  • 938
  • 4
  • 14
  • 33
0
votes
1 answer

Best way to compare 4 arrays

I have 4 files, each file I read into it's own array. From there i then compare files A, B and C to each other. At each step I print out a list of numbers which are missing. Compare A to B then B to A Print list of files found in A and not B and…
Leo.Cruz
  • 57
  • 1
  • 8
0
votes
3 answers

Dynamic array of hashes in Perl

I have a CSV file like this: name,email,salary a,b@b.com,1000 d,e@e.com,2000 Now, I need to transform this to an array of hash-maps in Perl, so when I do something like: table[1]{"email"} it returns e@e.com. The code I wrote is : open(DATA,…
Srikrishnan Suresh
  • 729
  • 2
  • 13
  • 31
0
votes
5 answers

How to test your own Perl modules while not depending on other modules in production?

First of all, I think somebody needs to rewrite my question, I know what I am asking, not how I should ask it precisely. Assume I have some local module LOCAL::Commons and it has one subroutine called globalTrim. I am testing that subroutine below,…
Gogi
  • 1,695
  • 4
  • 23
  • 36
0
votes
1 answer

Use (include/require) the same file twice

I have a perl script (MyTest.pl) that includes (use) two modules (MyA.pm and MyB.pm). The problem I have is that module A also have to include Module B, but this doesn't seem to work as is already has been included in the .pl file. MyTest.pl use…
Andreas
  • 1,211
  • 1
  • 10
  • 21
0
votes
1 answer

CGI::Session not setting cookie

I have some code that has been working fine - until I moved the session initialisation into one of my modules. Now the cookie is no longer being set via print->header - and so a new session is created every time I run it. Here's the (heavily…
Upland
  • 691
  • 3
  • 8
  • 18
0
votes
2 answers

site_perl directory is missing in perl search path

I'm noob in perl. I used perl module installed on /usr/lib/perl5/site_perl on CentOS 5. On CentOS 6 the directory is missing from perl search path (@INC). On CentOS 5 perl -V output: Summary of my perl5 (revision 5 version 8 subversion 8)…
dimba
  • 26,717
  • 34
  • 141
  • 196
0
votes
1 answer

Issue with the search order when including perl modules

this question is a follow up to: What's the search order in perl's include path when a module is loaded posted a while back but that remained unanswered. I have 2 versions (1.22 and 1.25) of the module IO installed in two separate folders: …
mhursin
  • 1
  • 1
0
votes
3 answers

date conversion in perl

I am using perl to access a DB from where I am getting the date in DD-MON-YYYY format. I need to perform 2 operations: Convert this format to a MM/DD/YYYY format. Compare this date with two dates to see if it lies in that time range. my $chdate =…
adizone
  • 203
  • 1
  • 5
  • 13
0
votes
1 answer

Having trouble with Spreadsheet::ParseExcel module in Perl?

I am new to perl and I have just started using the module Spreadsheet::ParseExcel. I do not want to write anything to the Excel sheet that I am using. The script should basically run through the Excel sheet and print the values row by row. I have…