I currently use the DBIx::Class::InflateColumn::DateTime plugin to inflate my date columns to DateTime objects and deflate my DateTime objects to MySQL date values.
I want to store the age of an individual (I cannot use DOB) and for this the years, months or days values may be 0. Therefore I am using a DateTime::Duration object. Thing i...
Suppose I have variables
$x1 = 'XX a b XX c d XX';
$x2 = 'XX a b XX c d XX e f XX';
I want a regular expression that will find each instance of letters between XX. I'm looking for a general solution, because I don't know how many XX's there are.
I tried using /XX(.*?)XX/g but this only matches "a b" for x1 and "a b", "e f" for x2 bec...
In a perl script, I'm trying to accept input without blocking and without echoing the characters entered (The script is producing output and I want to have 'hotkeys' to alter its behaviour).
I got as far as using
use Term::ReadKey;
ReadMode( "cbreak", STDIN );
if($input = ReadKey($pause_time, STDIN)){
#process input
}
But once th...
What's the best way to handle modules that use each other?
Let's say I have a module which has functions for hashes:
# Really::Useful::Functions::On::Hash.pm
use base qw<Exporter>;
use strict;
use warnings;
use Really::Useful::Functions::On::List qw<transform_list>;
our @EXPORT_OK = qw<transform_hash transform_hash_as_list ...>;
#...
Is it possible to push to an array reference in Perl? Googling has suggested I deference the array first, but this doesn't really work. It pushes to the deferenced array, not the referenced array.
For example,
my @a = ();
my $a_ref = [@a];
push(@$a_ref,"hello");
print $a[0];
@a will not be updated and this code will fail because t...
I am trying to figure out a way to calculate the year of birth for records when given the age to two decimals at a given date - in Perl.
To illustrate this example consider these two records:
date, age at date
25 Nov 2005, 74.23
21 Jan 2007, 75.38
What I want to do is get the year of birth based on those records - it should be, in th...
How to enable user account in Active Directory from Perl if that account is disabled
I am using NET::LDAP . How its not working UserAccountControl Attribute
...
how convert string into Unicode string in Perl.
I am looking some attribute in LDAP which accepts only Unicode string .
So i want to convert normal string to Unicode string
...
I am trying to define constants in Perl using the constant pragma:
use constant {
FOO => "bar",
BAR => "foo"
};
I'm running into a bit of trouble, and hoping there's a standard way of handling it.
First of all...
I am defining a hook script for Subversion. To make things simple, I want to have a single file where the class (...
Is there a module that provides functionality like Template Toolkit does when accessing a deeply nested data structure? I want to pull out something like $a = $hash{first}[0]{second}{third}[3] without having to test each part of the structure to see if it conforms to what I expect. If %hash = {} I want $a = undef, not produce an error.
...
I have written a crawler in Perl awhile back and it was super simple giving the high-level capability of libwww-perl. It is so straight forward in fact, it can take the raw HTML response of one request, and create the next HTTP request for you from the FORMs on that page (as in it will parse the HTML for you).
Does anyone know any libr...
Hi, please help! I'm really going nuts with this problem!
I have a CGI perl script and it always fails at the following line when executed from the Apache HTTP server:
tie %db, 'MLDBM', "$data_path/$db_name.db", O_RDONLY, 0640 or die $!
and the error is Permission denied:
Software error:
Permission denied at /var/www/cgi-bi...
Using perl 5.8.8 on windows server I am writing a perl cgi script using Archive::Zip with to create on fly a zip that must be download by users: no issues on that side. The zip is managed in memory, no physical file is written to disk using temporary files or whatever. I am wondering how to allow zip downloading writing the stream to the...
In my Perl/Tk script I'm opening new windows, and i want the window opening will run an initial subroutine (when ever the window is opened)
How can I do it?
...
By default, PerlTidy will line up assignments in my code. E.g.
PerlTidy changes this...
my $red = 1;
my $green = 2;
my $yellow = 3;
my $cyan = 4;
...into this...
my $red = 1;
my $green = 2;
my $yellow = 3;
my $cyan = 4;
How do I prevent this from happening?
I've trawled the manual but I can't find a solution.
Thanks!
...
I am wondering if there is anyway to grab the html that is generated from an ASP page. I am trying to pull a table from the page, and I foolishly used a static html page so I would not have to be constantly querying the server where this page resides while I tested out my code. The javascript code I wrote to grab to unlabeled table from ...
I've got a batch script that does some processing and calls some perl scripts.
My question is if there was a way to put the perl code directly into the batch script and have it run both types of scripts.
...
I am in search of who specifically to contact at Sybase regarding Advantage Database Server's DBI driver, specifically DBD::Advantage.
The only reference I can find is to one 'lancesc' in the README, but there are no references to a contact email, CPAN author etc. Inadvertantly I happened upon one StackOverflow user lancesc here.
Woul...
How do I set a Moose read only attribute trait?
package AttrTrait;
use Moose::Role;
has 'ext' => ( isa => 'Str', is => 'ro' );
package Class;
has 'foo' => ( isa => 'Str', is => 'ro', traits => [qw/AttrTrait/] );
package main;
my $c = Class->new( foo => 'ok' );
$c->meta->get_attribute('foo')->ext('die') # ro attr trait
What is the pu...
I am attempting to write a singleton role using Perl and Moose. I understand a MooseX::Singleton module is available but there is always resistance when requiring another CPAN module for our project. After trying this and having a little trouble I would like to understand WHY my method is not working. The singleton role I have written...