I am doing pass-by-reference like this:
use strict;
use warnings;
sub repl {
local *line = \$_[0]; our $line;
$line = "new value";
}
sub doRepl {
my ($replFunc) = @_;
my $foo = "old value";
$replFunc->($foo);
print $foo; # prints "new value";
}
doRepl(\&repl);
Is there a cleaner way of doing it?
Prototypes ...
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 libraries are in /usr/code/beta/lib/perl, is there an easy way for me to achieve such a set...
We have a setup where most code, before being promoted to full production, is deployed in BETA mode - meaning, it runs in full production environment (using production database - usually production data; and production web server). We call that stage BETA testing.
One of the main requirements is that BETA code promotion to production mu...
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 look?
...
What are all the ways of affecting where Perl modules are searched for?
or, How is Perl's @INC constructed?
As we know, Perl uses @INC array containing directory names to determine where to search for Perl module files.
There does not seem to be a comprehensive "@INC" FAQ-type post on StackOverflow, so this question is intended as on...
I feel like I'm traveling 10 years back in time by asking this, but...
Are there any modules, patches, or any "new" version of Perl (released in the last 10 years) to enable writing web-oriented Perl scripts using ASP-style tags?
e.g. from ASP/JSP
some html <% some code %> more HTML
e.g. from PHP
some html <? some code ?> more...
I am using a SMTP mail server which require user + ssl authentication for connection. I am looking for the perl modules to connect to the mail server and send emails but doesn't found anything helpful.
Any suggestion for perl module or any perl code would be really appreciated.
EDIT
I have tried to use Mail::Sendmail and Net::SMTP::S...
I'm creating a bundle to make it easy to install my app.
I started here: http://search.cpan.org/dist/CPAN/lib/CPAN.pm#Bundles
I have a package Bundle::MyApp which looks like this:
package Bundle::MyApp;
$VERSION = '0.01';
1;
__END__
=head1 NAME
Bundle::MyApp - modules needed by my app
=head1 SYNOPSIS
cpan install Bundle::MyApp
...
Consider that I have 100 Perl modules in 12 directories. But, looking into the main Perl script, it looks like 100 use p1 ; use p2 ; etc. What is the to best way to solve this issue?
...
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 work either. Any advice?
...
I am making a change to Perl/Tk for an application that has its own resident Perl and modules installation (so we can drop the app in and go).
I've found a problem I am experiencing that I just stumbled on what seems to be the patch I need here: http://osdir.com/ml/lang.perl.tk/2004-10/msg00030.html
Bug confirmed. Here's the patc...
I was wondering what the best practice in Perl is regarding getting - or, more importantly, setting - a global variable of some module by directly accessing $Module::varName in case the module didn't provide getter/setter method for it.
The reason it smells bad to me is the fact that it sort of circumvents encapsulation. Just because I ...
Is it possible to add header(with text and one image) and footer (with page number) with images. I wrote below code to create a PDF document which shows png images.
If this can be done easily with any other module, please suggest.Really appreciate response with sample code.
use strict;
use PDF::API2::Lite;
use Getopt::Long;
my $outfil...
Hi, I have got 1 file which looks like this
COMPANY=xyz
system.employee[0].Name=shayam
system.employee[0].Age=26
system.employee[0].sex=Male
system.employee[1].Name=ram
system.employee[1].Age=28
system.employee[1].sex=Male
COMPANY=bhg
system.employee[0].Location=Bangalore
system.employee[0].Number=26
system.employee[1].Location=chennai...
I am trying to set up an application dependant on few Perl modules, but the server I am installing to, does not have Internet connection. I read about offline module installs via ppd files, however I would have to resolve all the dependencies one by one.. All the more tedious considering I don't have direct internet connection.
I am hop...
I am new to the File::Slurp module, and on my first test with it, it was not giving the results I was expecting. It took me a while to figure it out, so now I am interested in why I was seeing this certain behavior.
My call to File::Slurp looked like this:
my @array = read_file( $file ) || die "Cannot read $file\n";
I included the "...
From everything I've read on using Perl modules, the basic usage is:
Module file with .pm extension, which includes the statement package <name>, where <name> is the filename of the module without the extension.
Code file that uses module contains the statement use <name>;.
The application I'm coding has one main code script which us...
VMS style command line user interface messages have standard format. For example:
$ PRINT SOMEFILE.DAT
%PRINT-E-OPENIN, error opening DKA2:[MYDIR]SOMEFILE.DAT; as input
-RMS-E-FNF, file not found
Component name: PRINT, RMS.
Severity level: Success, Information, Warning, Error, and Fatal.
Message identifier: OPENIN, FNF.
Message text...
What's the best way to handle modules that use each other?
Let's say I have a module which has functions for hashes:
# Really::Useful::Functions::On::Hash.pm
use base qw<Exporter>;
use strict;
use warnings;
use Really::Useful::Functions::On::List qw<transform_list>;
our @EXPORT_OK = qw<transform_hash transform_hash_as_list ...>;
#...
Hi
I have no experience on perl.
I am trying to configure the W3C validator on my localhost (win32).
I have already followed all the instructions given by W3C @http://validator.w3.org/docs/install_win.html, but I am getting the following error:
Can't locate loadable object for module Encode::HanExtra in @INC (@INC contains: C:/xampp/...