Sorry about all these silly questions, I've been thrust into Perl programming and I'm finding it really hard to think like a Perl programmer.
Silly question for today:
I load a pipe delimited file into a hash using the id field as the key, like so
#open file
my %hash;
while (<MY_FILE>) {
chomp;
my ($id, $path, $date) = split ...
I have developed a database with the use of Perl CGI with C++. I have problem in sending the results to mail. I used the following code:
print LOG "[",`date`,"] Sending mail to $email\n";
system (qq{mutt -s "MMM" -a $zip_file $email < $job_id});
if ( $? == 0) {
print LOG "[",`date`,"] Sending mail to $email :: SUCCESS ::\...
I am having a prior knowledge of shell scripting.
I am trying to connect to a table using SQL*Plus and fetch the data in a Perl script and store that output in a Perl variable.
Normally in a shell script I would do like below:
SQL_RESULT=`sqlplus -s ${CONNECT_STRING} << EOF
${SQLPLUS_SETTINGS}
select foo||'|'||bar ||'|'|| xy...
Hi
I want to place sudoku puzzles(9X9 size) on A4 paper, 4 on front side of the page and 4 on back side of the page.I am in need to generate 12 pages booklet with 96 sudoku puzzles each 8 sudoku puzzles.Does any body guide me how to do this either using perl or C#.I do not know which website or manual to go through for information.
Any...
I have the code:
#!/usr/bin/perl
use strict;
use WWW::Mechanize;
my $url = 'http://divxsubtitles.net/page_subtitleinformation.php?ID=111292';
my $m = WWW::Mechanize->new(autocheck => 1);
$m->get($url);
$m->form_number(2);
$m->click();
my $response = $m->res();
print $m->response->headers->as_string;
It submits the download button on ...
Are there bindings for layout engines like Gecko or WebKit for Perl?
I found Gtk2-Webkit on CPAN but I would like to know if there are other options.
My idea is to use one of those engines to create thumbnails of web pages from a Perl script.
...
I have a set of intra-dependent Perl projects and would like to use EPIC to work on them. I created one Epic (Eclipse) project for each of my projects and I set dependencies among them using Project|Properties|Project References function.
For each project I also set Perl Include Path (@INC) in Project|Properties|Perl Include Path adding ...
I'm starting with DBIx::Class and i have a subselect that wanted to be in DBIx::Class, but i'm getting confused and can't build the code.
My MySQL select is this one:
Select name from tblCategory where id = (
Select id from tblCategory where id = (
Select id from tblRadio where name = "RFM"
)
);
I read that DBIx::Cla...
I've read the doc for GetOptions but I can't seem to find what I need... (maybe I am blind)
What I want to do is to parse command line like this
myperlscript.pl -mode [sth] [inputfile]
I can use the -mode part, but I am not sure how to get the [inputfile]. Any advice will be appreciated.
...
When I try a "chdir" with a filehandle as argument, "chdir" returns 0 and a pwd returns still the same directory. Should that be so?
I tried this, because in the documentation to chdir I found:
"On systems that support fchdir, you
might pass a file handle or directory
handle as argument. On systems that
don't support fchdir, p...
Often in Perl I want to print out column/row data, say, from a hash.
This is simple:
foreach my $k(keys %h)
{
print $k, "\t", $h{$k}, "\n";
}
However, if the key happens to have a varying length, then the formatting just looks very jagged. I've investigated format, and its typically too heavyweight for what I'm looking for, which i...
Right now, I have my own homegrown testing harness/directory structure/support doc strucure/distribution tools for my libraries. However, reading the blog post Write your code like it's going on CPAN, it sounded like a good idea. Then it occurred to me, I'm really not sure how to do that.
What are some good resources to get started ma...
How do I tell what type of value is in a Perl variable?
$x might be a scalar, a ref to an array or a ref to a hash (or maybe other things).
...
How can I get actual attribute value instead of XML::DOM::NamedNodeMap=HASH(0xa3246d4) while using getAttribute function from XML::DOM parser
Code
my $parent = $doc->getElementsByTagName ("ParentTag")->item(0);
my @parent = $childnodes->getChildNodes();
{
foreach my $parent(@parent)
{
...
I am building a Web interface to monitor an embedded system.
I have built a Perl script which runs remote commands and gathers output from that system.
Now what I need is a Web interface which makes calls to this script (executes remotes command) and displays data on the web page.
First of all, I need to make my script as a daemon proc...
If I call this function directly it works fine, yet if I call it from Javascript using an ajax call it wont work correctly.
I found out the reason for this, it was cause I was using $(document).ready(function ..) where I should call the functions directly after the ajax returns the results.
...
Assume that an attacker controls the variable $untrusted_user_supplied_path . Is the following Perl code exploitable?
my $untrusted_user_supplied_path = ...
if ($untrusted_user_supplied_path =~ /\.\./) {
die("Tries to escape homedir.");
}
my $base_path = "/home/username/";
my $full_path = "${base_path}${untrusted_user_supplied_path}";...
I'm using Damian Conway's "inside-out" objects as described is his wonderful book Perl Best Practices to construct an object-oriented interface to a security system at my client. I'm coming across the need to use internal helper methods within my module that I would normally designate as "_some_method". However, this seems to break enc...
I am trying to compare an encode_base64('test') to the string variable containing the base64 string of 'test'. The problem is it never validates!
use MIMI::Base64 qw(encode_base64);
if (encode_base64("test") eq "dGVzdA==")
{
print "true";
}
Am I forgetting anything?
...
I want to be able to use a module kept in the lib directory of my source code repository, and I want the only prerequisite for a developer to use the scripts that I'm writing is to have a standard Perl installation, but I'm not sure how to accomplish this.
In my scripts, I have
use FindBin qw($Bin);
use lib "$Bin/lib"; # store non sta...