I am using RRDtool for storing data for displaying graphs. I update the RRD by RRDs::update and this fails when trying to rewrite the information, means update data for a time in the past (e.g. someone moved the system timer back). The error I get is:
ERROR: Cannot update /opt/dashboard/rrd/Disk/192.168.120.168_disk_1.rrd with '12280...
I've been using the following snippet in developements for years. Now all of a sudden I get a DB Error: no such field warning
$process = "process";
$create = $connection->query
(
"INSERT INTO summery (process) VALUES($process)"
);
if (DB::isError($create)) die($create->getMessage($create));
but it's fine if I use numerics
$process =...
On researching another question I noted that the stat function in Perl can take a dirhandle as its argument (instead of a filehandle or filename).
However I can't find any examples of correct use of this - there are none in the Perl manual.
Can anyone show an example of how to use it?
...
Is there a clean and OS independent way to determine the local machine's IP addresses from Perl?
So far I have found the following solutions:
parse the output of ifconfig and ipconfig (hard, different windows versions have different ipconfig outputs)
establish a network connection to a well-known IP and examine the socket's local IP a...
Consider the following code and its output:
Code
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
my $HOURS_PER_DAY = 24.0 * 1.0;
my $BSA = 1.7 * 1.0;
my $MCG_PER_MG = 1000.0 * 1.0;
my $HOURS_DURATION = 20.0 * $HOURS_PER_DAY;
my $dummy = $HOURS_PER_DAY * $BSA * $MCG_PER_MG * $HOURS_DURATION;
print Dumper($HOURS_PER_DAY);
print Dumpe...
I need to get a database connection through a firewall, and also limit what queries can be run. DBD::Proxy seems to be the perfect solution for this. However, I'm currently using DBIx::Class, and can't figure out how to hook them together.
In particular, DBD::Proxy doesn't take SQL; it takes particular named queries. But DBIx::Class doe...
Hello,
I'm trying to understand a particular Perl code from vcake. Usually I find my way around in Perl but the following statement baffles me. I suspect that this is simply an error but I'm not completely sure. The statement is:
foreach my $seq (keys %$set) {
if( (defined $set->{$seq}) and (my $numReads >= ($coverage)) ) {
...
I want to integrate some existing Perl code with ASP.NET. I see plenty examples of accessing Perl from .NET but nothing on the reverse. Has anyone had any experience attempting to do this or does everyone just recreate their existing Perl functionality in one fell swoop?
For more detail, I have some functionality already implemented in ...
My list (@degree) is built from a SQL command. The NVL command in the SQL isn't working, neither are tests such as:
if (@degree[$i] == "")
if (@degree[$i] == " ")
if (@degree[$i] == '')
if (@degree[$i] == -1)
if (@degree[$i] == 0)
if (@degree[$i] == ())
if (@degree[$i] == undef)
$i is a counter variable in a for loop. Basically it goe...
Whenever I alter (or even just resave without altering) a Perl file, it completely takes down our backend. I have no idea what the problem could be. Permissions are correct. Encoding is correct. Encoding is UTF-8. Transfer mode was ASCII.
I might not deal with Perl too much but I have no idea what the problem could be. The network admin...
Hello all,
I am trying to get a header that will work with Apache, IIS 6, and IIS 7. I won't go into the reason for that here. Let's just say that it's not as easy as I thought it would be :-)
Anyway, the problem has something to do with NPH. In our code (originally written for IIS 6) we have
use CGI qw(:standard);
print "HTTP/1.0...
I have Perl on Mac, Windows and Ubuntu. How can I tell from within the script which one is which? Thanks in advance.
Edit: I was asked what I am doing. It is a script, part of our cross-platform build system. The script recurses directories and figures out what files to build. Some files are platform-specific, and thus, on Linux I don't...
The mod_perl2 and Perl 5.10 two are playing nicely together, but I can't seem to find any positive information about Devel::Cover working with mod_perl2 under Win32. I'm currently using ActiveState's Perl 5.10, but I would be open to switching to Strawberry Perl if it meant this combination could work.
Also, Devel::Cover PPDs don't see...
Here's a short test program:
sub foo($;@) {
my $sql = shift;
my @params = @_;
print "sql: $sql\n";
print "params: " . join(",", @params);
}
sub bar($;@) {
foo(@_);
}
bar("select * from blah where x = ? and y = ?",2,3);
print "\n";
Why is the output this:
sql: 3
params:
Rather than this?
sql: select * from blah where x...
I am looking for a DBI (or similar) proxy that supports both SQL restrictions and transactions. The two I know about are:
DBD::Proxy
DBD::Gofer
DBD::Proxy
The problem I have found with DBD::Proxy is that its server, DBI::ProxyServer, doesn't just restrict queries coming in over the network (which I want), but it also restricts queri...
Perl seems to be killing my array whenever I read a file:
my @files = ("foo", "bar", "baz");
print "Files: " . join(" ", @files) . "\n";
foreach(@files) {
print "The file is $_\n";
func();
}
sub func {
open(READ, "< test.txt");
while(<READ>) {
}
close READ;
}
print "Files: " . join(" ", @files) . "\n";
produces:
...
I would like to know whether it is possible to force LWP::UserAgent to accept an expired SSL certificate for a single, well-known server. The issue is slightly complicated by the Squid proxy in between.
I went as far as to set up a debugging environment like:
use warnings;
use strict;
use Carp;
use LWP::UserAgent;
use LWP::Debug qw(+);...
I am moving into a project which has lots of Perl coding in it. Can somebody suggest me a good book which I can use to learn Perl? Online tutorials would also be helpful.
...
I am working on an internal web based application for storing and cataloging photos. How should I retrieve, and save these files to the server?
Note: I want to save the files to the file system, not to a database.
Similar to this question
...
According to this site I can simply write
$user = getlogin();
but the group handling functions seem not to be able to accept a username/userid as a parameter. Should I really iterate over all the /etc/group file lines and parse the group names from it?
...