comp.lang.perl.misc
  Home FAQ Contact Sign in
comp.lang.perl.misc only
 
Advanced search
April 2008
motuwethfrsasuw
 123456 14
78910111213 15
14151617181920 16
21222324252627 17
282930     18
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.perl.misc Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  Uninitialized values in hash         


Author: mike
Date: Apr 9, 2008 23:54

Hi,

I am running the following code:

use strict;
use warnings;

my $verbose = 1;
my $info = "[INFO] :";
my $error = "[ERROR]:";

my $configFile = "config.dat"; # Recommended plugins.
my %%User_Preferences = ();

####################### Subroutines #######################

#################################### Start Main
#######################################
print "Reading configuration data ...\n";

open FILE, "$configFile" or die "$error Could not open file
$configFile :$! ";

while () {
Show full article (1.52Kb)
3 Comments
  Sendmail         


Author: Deepan Perl XML Parser
Date: Apr 9, 2008 22:20

my $email = populateEmail("test");
print $email;

open(SENDMAIL, "|/usr/lib/sendmail -oi -t -i") or print "cannot open
SENDMAIL: $!";
print SENDMAIL <<"EOF";
From: juniper.net>
To: ${email}
Subject: [SUSTAINING TICKET] Case
Content-type: text/html
testing
EOF
close(SENDMAIL);

The above code results in "No recipient address found in header"
but when i replace ${email} with direct address say deepan.
17\@gmail.com it works fine.

populateEmail function's code is available below:
Show full article (0.64Kb)
4 Comments
  FAQ 8.49 How do I add a directory to my include path (@INC) at runtime?         


Author: PerlFAQ Server
Date: Apr 9, 2008 18:03

This is an excerpt from the latest version perlfaq8.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

8.49: How do I add a directory to my include path (@INC) at runtime?

Here are the suggested ways of modifying your include path, including
environment variables, run-time switches, and in-code statements:

the PERLLIB environment variable
$ export PERLLIB=/path/to/my/dir
$ perl program.pl

the PERL5LIB environment variable
$ export PERL5LIB=/path/to/my/dir
$ perl program.pl

the perl -Idir command line flag
$ perl -I/path/to/my/dir program.pl

the use lib pragma:
use lib "$ENV{HOME}/myown_perllib";
Show full article (1.78Kb)
no comments
  Can I use a look-ahead and a look-behind at the same time?         


Author: dan.j.weber
Date: Apr 9, 2008 15:01

How would I match the text that's after "#ab cd ef#" and before "#qr
st uv#" in the following string? I want to use a regular expression
that has both a look-behind and a look-ahead together. Is this
possible?

#ab cd ef#gh ij kl#qr st uv#
5 Comments
  FAQ 8.50 What is socket.ph and where do I get it?         


Author: PerlFAQ Server
Date: Apr 9, 2008 12:03

This is an excerpt from the latest version perlfaq8.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

8.50: What is socket.ph and where do I get it?

It's a Perl 4 style file defining values for system networking
constants. Sometimes it is built using h2ph when Perl is installed, but
other times it is not. Modern programs "use Socket;" instead.

--------------------------------------------------------------------

The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
are not necessarily experts in every domain where Perl might show up,
so please include as much information as possible and relevant in any
corrections. The perlfaq-workers also don't have access to every
operating system or platform, so please include relevant details for
corrections to examples that do not work on particular platforms.
Working code is greatly appreciated.
Show full article (1.23Kb)
no comments
  ? about using multi-level menu system using dispatch method         


Author: mmccaws2
Date: Apr 9, 2008 09:25

It's a general question on how do I make sure that I'm not eating up
memory unnecessarily. I have a script that is used as a user
interface to:
monitoring the status of application's several scripts,
stopping, starting, and creating projects within the application

A project is defined as the set of actions required to be implemented
by the collection of scripts. All the settings are stored in a DB by
this script, then the script can start and stop the application's set
of scripts.

The question is how do I make sure that I'm not unnecessarily eating
memory (is this what you may call creating zombies?). How do I go
about monitoring those resources. Is there a good link or book
addressing this?

Thanks
Mike
3 Comments
  SOAP         


Author: KevinO
Date: Apr 9, 2008 06:29

Hi

I "inherited" a program which contains this line:
$a = $soap->call( $retrieveXmlList => @params )->result ;

I added:
print "$a\n" ;

Which produced:
HASH(0x50c5d4)

How do I proceed from here to see and parse the XML tree/data?

Thanks
KO
8 Comments
  FAQ 9.4 How do I remove HTML from a string?         


Author: PerlFAQ Server
Date: Apr 9, 2008 06:03

This is an excerpt from the latest version perlfaq9.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

9.4: How do I remove HTML from a string?

The most correct way (albeit not the fastest) is to use HTML::Parser
from CPAN. Another mostly correct way is to use HTML::FormatText which
not only removes HTML but also attempts to do a little simple formatting
of the resulting plain text.

Many folks attempt a simple-minded regular expression approach, like
"s/<.*?>//g", but that fails in many cases because the tags may continue
over line breaks, they may contain quoted angle-brackets, or HTML
comment may be present. Plus, folks forget to convert entities--like
"<" for example.

Here's one "simple-minded" approach, that works for most files:

#!/usr/bin/perl -p0777
s/<(?:[^>'"]*|(['"]).*?\1)*>//gs
Show full article (2.42Kb)
no comments
  problem using system()         


Author: mike
Date: Apr 9, 2008 05:42

Hi,

I have the following string:

my $command = "$User_Preferences{"asadminexecutable"} deploy --user=
$User_Preferences{"user"} --passwordfile=
$User_Preferences{"passwordfile"} --host=$User_Preferences{"host"} --
port=$User_Preferences{"port"} $User_Preferences{"pathdeployunit"}";
system($command);

Global symbol "$command" requires explicit package name at
remote_deploy.pl line 55.
syntax error at remote_deploy.pl line 55, at EOF
Missing right curly or square bracket at remote_deploy.pl line 55,
within string
Execution of remote_deploy.pl aborted due to compilation errors.

Any ideas what I need to do to make it possible to execute the
command?

cheers,

//mike
8 Comments
  Trouble with @ARGV         


Author: ff0000
Date: Apr 9, 2008 02:17

Hi,

I'm in trouble and doubt (is it a Perl or shell (Bash) fault? :-)
while understanding the
@ARGV behaviour... Here's a simple (newbie) script:

--
#!/usr/bin/perl

print "ARGV: `" . "@ARGV" . "`\n";

for my $i (0..$#ARGV) {
print "Argument[${i}]: `" . $ARGV[$i] . "`\n";

}

1;
--

First case:

ff0000@tsi00588pc:tmp$ ./test.pl "a b c"
ARGV: `a b c`
Argument[0]: `a b c`

The "a b c" quoting has been eating up; ok let's protect it:
Show full article (0.74Kb)
12 Comments
 
1 2