Hi experts,
I'm new to Perl-HTML things. I'm trying to fetch both the texts and links from a HTML table.
Here is the HTML structure:
<td>Td-Text
<br>
<a href="Link-I-Want" title="title-I-Want">A-Text</a>
</td>
I've figured out that WWW::Mechanize is the easiest module to fetch things I need from the <a> part, but I'm not su...
How can I print 1st, 10th, 20th... lines (not array index) number in a long list of text.
Of course, the following doesn't work:
for(my $i=0; $i<=$arr_size; $i+=10){
print $arr[$i],"\n";
}
Many thanks in advance.
...
I have some perl code which establishes a signal handler:
$SIG{'KILL'} = sub {
....
};
I'm tasked with porting this to windows and I was wondering how I could generate this signal from a C# class.
I saw the Process.Kill method in the System.Diagnostics.Process class which seems to allow me to create (via another method) and kill my p...
Can anyone suggest a a very simple way to use Net::SSH::Perl in Windows without all those cygwin hacks and all.
Whenever I am trying to install the modules it's taking me to some other dependent modules and the process seemed never ending..
Thanks beforehand
...
There's Test::Simple, Test::More, Test::Builder (all part of the Test::Simple distribution), Test::Class, Test::Unit, Test::Moose...
I'm starting a new project using Moose—which module should I use for writing my tests?
...
I'm new to Perl/HTML things. I'm trying to use $mech->get($url) to get something from a periodic table on http://en.wikipedia.org/wiki/Periodic_table but it kept returning error message like this:
Error GETing
http://en.wikipedia.org/wiki/Periodic_table:
Forbidden at PeriodicTable.pl line 13
But $mech->get($url) works fine if ...
There is a directory where a buddy adds new builds of a product.
The listing looks like this
$ ls path-to-dir/
01
02
03
04
$
where the numbers listed are not files but names of directories containing the builds.
I have to manually go and check every time whether there is a new build or not. I am looking for a way to automate this, s...
I am doing the following, and getting "1" which I assume means the statement wend well. But I would like the result instead.
What's wrong?
#!/usr/bin/perl
use strict;
use DBI;
my $host = "test";
my $database = "dd";
my $port = 3306;
my $user = "uuu";
my $pw = "ppp";
my $mysql = DBI->connect("DBI:mysql:database=$database;host=$host;p...
For example, I have an array
my @arr = qw(0 1 2 3 4);
How do I get the following combinations:
0
01
012
0123
01234
1
12
123
1234
2
23
234
3
34
4
If any, what's the name for this kind of combination (or permutation)?
Thanks like always!
...
I have a Google Map that is created using the newer Google Maps API V3 from a Perl script. The script builds the map from values passed to it from hidden form fields in the parent page, and returns the map into an iframe in the same parent page.
The reason that the map is in the iframe, is because I have discovered browser issues both w...
I'm using File::Copy::Recursive::dircopy( $original_dirname, $new_dirname ) or die $!; to copy a read-only directory from within a Perl script. I get a Permission denied error.
I can see that $new_dirname is created, but is marked as read only (like the original directory). Maybe this prevents from the content to be copied into it?..
...
I would like to check whether some string match any of a given set of regexes. How can I do that?
...
This is what my Perl code looks like for monitoring a Unix folder :
#!/usr/bin/perl
use strict;
use warnings;
use File::Spec::Functions;
my $date = `date`; chomp $date;
my $datef = `date +%Y%m%d%H%M.%S`; chomp $datef;
my $pwd = `pwd`; chomp $pwd;
my $cache = catfile($pwd, "cache");
my $monitor = catfile($pwd, "monme");
my $...
when we use Expires header for text files like js, css, contents are cached in the browser, to get new content we need to change in the html file the new names in the link and script tag. When we add changes. How can we automate it.
In a Windows Box, I may have some bunch of html files in multiple folders also in subdirectories.
There ...
I would like to match paths like /this/is/my/dir/name/anything but not /this/is/my/dir/name/anything/anything2. In other words, I want to match all files and sub directories on the first level under `/this/is/my/dir/name/, but not anything on lower levels.
...
Perl's quotemeta operator typically works on the SEARCH side of s///, but in generating code to be compiled with eval, how should I protect the REPLACEMENT that should be used literally but may contain bits such as $1?
With code of the form
my $replace = quotemeta $literal_replacement;
my $code = eval <<EOCode;
sub { s/.../$replace/...
Following perl code I have written to parse an array in JSON. But the array returned has length 1 and I am not able to iterate over it properly. So the problem is I am not able to use the array returned.
#!/usr/bin/perl
use strict;
my $json_text = '[ {"name" : "abc", "text" : "text1"}, {"name" : "xyz", "text" : "text2"} ]';
use JSON;
...
Hi Friends,
I made a login script in Perl which has to run on Mac OS X clients and record the Logged in Directory Service user name.
I tried using getlogin() , getpwuid($<) respectively.
Now the problem is that since the login script runs as root on the system when the client logs in, getpwuid($<) always gives me the username as root....
I have this Perl script for monitoring a folder in Linux.
To continuously check for any updates to the directory, I have a while loop that sleeps for 5 minutes in-between successive loops :
while(1) {
...
sleep 300;
}
Nobody on my other question suggested using cron for scheduling instead of a for loop.
This while construct...
Are there any good introductory tutorials for Perl server-side scripting available freely on the internet?
I checked perl.org and google searches like perl server scripting, server side script examples in perl, but did not get any good results.
Is Perl not that common as a server-side language? It is mentioned here as one.
...