I know this type of thing I want to do used to work in 5.8. Am I doing something wrong? Is there a way to get back there in Perl 5.10?
Here's the module:
package TableMod;
use base qw<Exporter>;
our @EXPORT_OK = qw<mod_table>;
use Data::Dumper;
sub mod_table (\%@) { print Dumper( @_ ); }
1;
And here is the script:
use strict;
use ...
Is there a reason why opendir doesn't have the same policy than open in Perl Best Practices?
I'm thinking about at least these 2 policies:
Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles
Perl::Critic::Policy::InputOutput::RequireBriefOpen
...
I need to random some elements from an array. I'm doing that by randomizing the index $array[int(rand(100))]. I want some of the elements to appear more often. How do I do it?
I thought of a stupid solution of having those elements duplicated several times in the array, but I'm sure you guys can do better.
...
Hi,
I need a PCRE(Perl Compatible Regular Expression) that will match all non-images(jpg,png,tiff) from a list of files. So I need something go in place of XXX
# Perl
while(<>){
chomp;
if(/XXX/){
// non-image
}
}
// PHP
foreach($files as $file){
if(preg_match('/XXX/',$file){
// non-image
}
}
I know it can be done using negation ...
I've been a Perl guy for over 10 years but a friend convinced me to try Python and told me how much faster it is than Perl. So just for kicks I ported an app I wrote in Perl to Python and found that it runs about 3x slower. Initially my friend told me that I must have done it wrong, so I rewrote and refactored until I could rewrite and r...
This is very stupid but I seem to be completely lost trying to test a Perl command-line application with XAMPP. I downloaded the 'ExifTool by Phil Harvey' and extracted the files in a folder within htdocs with an index.php in it, in which I hope to set up a PHP interface to the functionalities provided by ExifTool. Actually I can't even ...
I use this Perl subroutine to get a line from a webpage, which I then split to get the information I require to proceed. This has worked for a dozen years.
sub capture_line {
my $page_to_get = $_[0];
my $host_to_get_text = $_[1];
my $port = 80;
my $buf = &HTTPGet($page_to_get, $host_to_get_text, $port);
my $image_capture...
Let say the public URL /faq is linked to the private path /faq/index in my Catalyst application:
package MyApp::Controller:FAQ;
sub index :Path {
[....]
How can I do a forward to /faq from another controller, that is how can I know that the action for the URL /faq is /faq/index ? Something like:
$c->forward(c->dispatcher->get_action_...
Please bear with me experts i'm a newbie in web dev.
With html,css can take care of webpages..
javascript,ajax for some dynamic content..
php for server side scripting,accessing databases,sending emails,doing all other stuf...
What role do these programming languages play?
Can they do any other important task which cannot be done by PH...
Ok, so, I got the signal through but for some reason the process exists after it receives the signal.
If I add an endless loop (while(1) ) before I even create the socket then it works as prescribed.
So... something in my socket code is quitting when the kill command is issued.
I don't see what it would be though. Without the kill, ...
I'm about to get a new iMac. It's my first Intel mac and will presumably come with Snow Leopard. What would other users recommend as the right strategy for installing and using perl on this machine?
I know I've read some complaints about the version of Perl (or was it the version of CPAN?) shipped with Leopard, although a quick google i...
I am using File::Fetch in a Perl script. How can I get File::Fetch to store
a file to be downloaded in a specified file?
I have tried:
use File::Fetch;
my $ff = File::Fetch->new( uri => 'http://stackoverflow.com/users/63550');
#my $where = $ff->fetch() or die $ff->error; #Creates a file named "63550".
my $where = $f...
Hi all,
I had a question using Perl's readdir(). I want to gather all the files in a directory that have the same prefix file name I specified. So, for each prefix, I need to use Perl's readdir() to grep all related files.
Suppose the prefix is "abc", there are several files with the names "abc_1", "abc_2", etc.
However, I noticed t...
Recently, I've chatted with a fellow Perl Monger about my and his job. He has a lot of Perl background, but works in a team that creates and maintains many low-scale projects for the customers, mostly based on .NET and Java. His opinion is currently that Perl has mostly lost the web game, since it's still lacking widget toolkits, which a...
This is the code snippet I am working with:
my %photo_details = (
'black_cat' => (
('size' => '1600x1200', 'position' => -25),
('size' => '1280x1024', 'position' => 25),
('size' => '800x600', 'position' => 0),
),
'race_car' => (
('size' => '1600x1200', 'position' => 10),
('size' => '800x600', 'position' => 5),
),...
I use grep to parse through my trading apps logs, but it's limited in the sense that I need to visually trawl through the output to see what happened etc.
I'm wondering if Perl is a better option? Any good resources to learn log and string parsing with Perl?
I'd also believe that Python would be good for this. Perl vs Python vs 'grep o...
Seems that it may not be possible, but hey I might as well ask, I could be wrong. Was wondering if there's anyway for perl to update multiple rows using one MySQL call, I'm using DBI.
Any help or feedback would be greatly appreciated, this is possible in MSSQL through ASP and ASP.net so was wondering if also possible through perl on MyS...
I use Net::SMTP to automate emails. I want to get notification if someone use email into Outlook I used this:
$smtp->datasend("Disposition-Notification-To: to.me\@domain.com");
The email sent succesfully but the Outlook client is not getting the notification.
Here is a snippet of the code:
$smtp = Net::SMTP->new("my mail host");...
I want to download about 200 different html files over HTTPS and extract the title of the page from each file and put the titles into a text document. How would I go about using Perl to download files using https? I searched google, but didn't find very much helpful info or examples.
...
I have a dozen or so Perl files with this line:
my $version = "<span class=\"foottext\"><em>version 0.11</em></span>";
This is line 7 of each perl file. The element I need to batch-modify is "X.XX" -- the version number.
What is the most elegant script I can run from the shell (in Perl) to open each file, change the version number on...