I have 5 Perl files that are verification scripts for 5 different states of my environment.
Each of them has at least a couple of subroutines.
Till now, the number of states was limited to 5 and these worked fine. But now, I have like 20 more states of the environment and hence 20 more Perl scripts according to the current design.
I wa...
HI am using SQLite DB and whenever I try to bind the values of parameter into the statement I am getting an error.
Here's the piece of code:
my $sth = $dbh->prepare("SELECT UserId,UserName,CardNo,GroupId,Role,VerifyType FROM
UsersList limit ?,? ");
$sth->bind_param(1, undef,SQL_VARCHAR);
$sth->bind_param(2, undef,SQL_VARCHAR);
$st...
Hi
I am trying to grab a list of meeting attendees from Outlook 2003. I am open to using any language that would be appropriate. Scripting languages are preferable. Any suggestions?
...
How can I get a value from particular number?
Lets say number is 20040819. I want to get last two digit i.e 19 using Perl.
...
$ cat test.pl
use strict;
use warnings;
sub route {
print "hello, world!";
}
my %h;
$h{'a'} = 'route';
print "1\n";
$h{a};
print "2\n";
$h{a}();
print "3\n";
"$h{a}".();
$ perl test.pl
Useless use of hash element in void context at test.pl line 12.
Useless use of concatenation (.) or string in void context at test.pl line 18.
1
...
After going through couple of linksI came to know that Perl does the compilation and create
an intermediate byte code and then interpret that byte code.
My question is where does that byte code reside?
Like in other language like java, c we can see the machine executable object code after compilation. Though Perl doesn't create machine ...
I need to parse the user-agents in HTTP-headers from a text file so as to determine the browser, the version, the OS and possibly the device. so few examples of those lines are:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Update a; AOL 6.0; Windows 98)
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Crazy Browser...
I'm an absolute newbie to Moose and so far I have read Moose and most of the Cookbook.
There a few things I don't get. I created the following package:
package MyRange;
use Moose;
use namespace::autoclean;
has [ 'start', 'end' ] => (
is => 'ro',
isa => 'Int',
required => 1,
);
__PACKAGE__->meta->make_immutable...
Let's say I have the following piece of code:
my $compiled = eval 'sub { print( "Hello World\n" ); }';
I can call this by writing:
$compiled->();
So far so good. Now imagine I create 10 functions:
my @fns = ();
for ( my $i = 0; $i < 10; $i++ ) {
push( @fns, eval "sub { print( 'I am function $i\n' ); }" );
}
I can call these 10...
I need to create a multi-dimensional array which will be passed to a class.
Here is sample code where I can reference the array elements outside of the class, but once I create a class and pass the multi-dimensional array, I'm not able to reference it inside of the class.
Output:
My Array Value = 3
Can't use string ("1") as an ARRAY ...
Is it possible in Perl to install only one signal handler for all the signals it receive? The reason behind this is, I am not aware of what signal my Perl code will get at run time. One way I can see is that point all the available signals to my custom signal handler, but I don't want to go this way. Is there any easy way to do this? som...
I have a data that looks like this:
1 1:-0.394668 2:-0.794872 3:-1 4:-0.871341 5:0.9365 6:0.75597
1 1:-0.463641 2:-0.897436 3:-1 4:-0.871341 5:0.44378 6:0.121824
1 1:-0.469432 2:-0.897436 3:-1 4:-0.871341 5:0.32668 6:0.302529
-1 1:-0.241547 2:-0.538462 3:-1 4:-0.871341 5:0.9994 6:0.987166
1 1:-0.757233 2:-0.948718 3:-1 4:-0.871341 5...
How can you get current script directory in Perl?
This has to work even if the script is imported from another script (require).
This is not the current directory
Example:
#/aaa/foo.pl
require "../bbb/foo.pl"
#/bbb/bar.pl
# I want to obtain my directory (`/bbb/`)
print($mydir)
The script foo.pl could be executed in any ways and fr...
I have a Perl script that replaces any Us or Ns at the end of a string with Ts. This program is what I'm trying:
use strict;
my $v = "UUUUUCCNNCCCCNNNCUUUNNNNN";
printf("before: %s \n", $v);
if($v =~ m/([UN]+)$/)
{
my $length = length($1);
substr($v, (length($v) - $length), $length) = "T" x $length;
}
printf(" after: %s \n", $v);
...
I came across God which seems good but I am wondering if anyone knows of other process monitoring and control frameworks that I can compare god with.
God has the following features:
Config file is written in Ruby
Easily write your own custom conditions in Ruby
Supports both poll and event based conditions
Different poll conditions can ...
The USPS provides a C library and a Java wrapper for generating their new Intelligent Mail barcodes. Has anyone found a Perl wrapper? I've used SWIG once before but wanted to see if it's already been done before I went to the trouble. My searching so far has only led to those spam sites that pretend to have whatever your search terms are...
Recently we added a "audit_logs" table to the database, and after some frustration I realised that there was already an "auditlog" table in the database for some reason. It wasn't being used so I dropped it. I deleted the Auditlog.pm and AuditLogs.pm files from my schema, and then regenerated. For some reason DCSL again created AuditLogs...
In UNIX, I am checking to see if a process is up by executing the following command;
E.g.
psg dtllst pe99
This returns the following output if the process is running;
UID PID PPID C STIME TTY TIME CMD
pe99 1234 1 0 03:29:44 pts/8 0:01 dtllst pe99
Now in Perl, I want to be able to find out whether th...
I have three TCP servers I need to connect to, each with different protocols, but all in nonblocking mode. Right now my plan is essentially opening a new IO::Socket per each one and adding them to IO::Select, then looping through can_read(). The idea is based on how servers are usually written in Perl, but it seems like it could work for...
I wish to nstore a Perl hash which also contains a code reference. Following this perldoc I wrote something like this:
use strict;
use warnings;
local $Storable::Deparse = 1;
my %hash = (... CODE => ...);
nstore (\%hash, $file);
I get a warning saying Name "Storable::Deparse" used only once: possible typo at test4.pl line 15.. I gues...