Sometimes my system call goes into a never ending state. To, avoid that I want to be able to break out of the call after a specified amount of time.
Is there a way to specify a timeout limit to system?
system("command", "arg1", "arg2", "arg3");
I want the timeout to be implemented from within Perl code for portability, and not using ...
For Example :
use Getopt::Long;
%file ;
GetOptions('file=s%' =>
sub { push(@{$file{$_[1]}}, $_[2]) });
use Data::Dumper ;
print Dumper %file ;
print @{$file{filename}} ;
my @file_array = @{$file_ref};
print "==\n @file_array == ";
I can execute and it working :
perl multipls.pl --file filename=a.txt --file filename=b.txt ...
use Uniq;
my @test1 = ("0","0","A");
my @test2 = ("1","1","A");
@test1 = uniq sort @test1;
@test2 = uniq sort @test2;
print "$_" for @test1;
print "\n";
print "$_" for @test2;
print "\n";
returns :
00A
1A
It should be 0A or not?!
Thank you
...
I am trying to use Net::SFTP to get connected to remote server.
My script is:
my %args = (
ssh_args => {
user => 'canneu_scp',
identity_files => [ '/home/home1/cgrshah/responsys/capgemini.private' ],
debug => 1,
} );
my $targetserver='files.responsys.net';
my $sftp = Net::SFTP->new($targetserver, %args)...
Is there a way to take a plain text file and convert it to a simple HTML?
A couple of 'sophisticated' stuff that will be great
identify hyper-links.
identify (tab delimited) tables.
UPDATE
I just found this HTML::FromText. Checking to see if it meets my needs...
...
After I download data from Yahoo and Google finance, how I do use a Perl script to send these to MySQL database automatically?
...
How can I produce a unique value key to be paired with my _rec_key_ field name? I am producing a datafile. I was looking at using an MD5 value as my key or any other suggestions you have to making sure this is unique. I'm not familiar with how to extract this value.
The format of the file should look something like this:
__rec_key__^a...
Possible Duplicate:
How can I escape meta-characters when I interpolate a variable in Perl's match operator?
I am using the following regex to search for a string $word in the bigger string $referenceLine as follows :
$wordRefMatchCount =()= $referenceLine =~ /(?=\b$word\b)/g
The problem happens when my $word substring cont...
I use the following Perl syntax in my bash script:
perl -i –pe 'next if /^ *#/; s/(\b|\D)$ENV{OLD }(\b|\D)/$1$ENV{NEW }$2/' file
I want to find the OLD word without first "#" character in the file , then replaces the OLD word with NEW word
My question: I want to print "replace $OLD with $NEW" each time perl replace the $OLD ...
I want to parse a list of arguments in a perl script, for example i have this situation :
script.pl -h 127.0.0.1 -u user -p pass arg1 arg2 arg3
How can i do for parse the list of argument that aren't option in an array, and the option parameter in scalar value ?
Thanks.
...
I have a Perl regex /\W/i which matches all non-alphanumeric characters, but it also matches spaces which I want to ignore. How do I get it to match non-alphanumeric characters except spaces?
...
I notice that XML::RSS::Parser hasn't been updated since 2005. Is this still the recommended library for parsing RSS or Atomtom? Is there a better one or a better way?
...
I got a problem when I parse a complex file which include thousands of lines.
I already implemented my Perl script like this days ago.
my ($head, $tail) = split /=/, $line;
Nearly all my source file $line style as below:
constant normalLines = <type value> /* hello world */
and I can get the output $tail = /* hello world ...
I have these three lines in bash that work really nicely. I want to add them to some existing perl script but I have never used perl before ....
could somebody rewrite them for me? I tried to use them as they are and it didn't work
note that $SSH_CLIENT is a run-time parameter you get if you type set in bash (linux)
users[210]=radek ...
I have a Perl script that is running an infinite loop. I'd like to be able to minimize this to the system tray. Can I use the Win32::GUI to create a system tray icon that when maximized shows the command prompt and the output of the script?
Edit: My perl script is a process by itself. Its running continuously. How can I run the systray...
I want to know if there is a linux tool or a script available to convert xlsx file to .txt.
Thanks.
...
Let's say we have a html string like "2 < 4"
How should be determined if it contains any of these extended sequences?
I 've found HTML::Entities on CPAN, but it doesn't provide 'check' method.
Details: fixing 'truncate' method in a way to not leave corrupted string like "2 &l" and not to do unnecesary work. It should look like this...
I'm using Moose to write an object module.
I currently have a few mandatory fields:
has ['length'] => (
is => 'ro',
isa => 'Int',
required => 1,
);
has ['is_verified'] => (
is => 'ro',
isa => 'Bool',
required => 1,
);
has ['url'] => (
is => 'ro',
isa => 'Str',
requi...
Code
# get already active Excel application or open new
my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
|| Win32::OLE->new('Excel.Application', 'Quit');
# open Excel file
my $Book = $Excel->WorkBooks->Open($file);
# select worksheet number. Default is 1 (you can also select a worksheet by name)
print "worksheet $wo...
I am about a develop a simple web application (5-6 static pages). Is there a framework I could use for this? I can just write these HTML pages without a framework but I would like a framework as it will better handle header, footer, and CSS throughout the website.
I have a Perl script that will be modifying these HTML pages daily. And I...