I have a base class like this:
package MyClass;
use vars qw/$ME list of vars/;
use Exporter;
@ISA = qw/Exporter/;
@EXPORT_OK = qw/ many variables & functions/;
%EXPORT_TAGS = (all => \@EXPORT_OK );
sub my_method {
}
sub other_methods etc {
}
--- more code---
I want to subclass MyClass, but only for one method.
package MySubclass...
Doing the following:
my $c = Net::Cassandra::Easy->new(server => 'localhost', port => '9160', keyspace => 'Keyspace1'); $c->connect();
my $uuid_bin = Data::UUID->new()->create_bin();
eval { $result = $c->mutate([$key],
family => 'StandardByUUID1',
insertions => { $uuid_bin => '123...
I have an object with a method that returns a filehandle, and I want to read from that handle. The following doesn't work, because the right angle bracket of the method call is interpreted as the closing angle bracket of the input reader:
my $input = <$object->get_handle()>;
That gets parsed as:
my $input = ( < $object- > ) get_handl...
In Perl/Tk I have designed one interface in that I have one frame.
That frame has an Entry and Text box. When I am clicking the button
those Entry and Text value has to clear in the Frame. I know that I can
access each object then I can clear using delete function.
I need to do as like HTML form reset button functionality. How can I...
I have series of files like this:
foo1.txt.gz
foo2.txt.gz
bar1.txt.gz
..etc..
and a tabular format file that describe those files:
foo1 - Explain foo1
foo2 - Explain foo2
bar1 - Explain bar1
..etc..
What I want to do is to have a website with a simple search bar and allow people to type
foo1 or just foo and finally return the gzipp...
This script works with and without XPathContext. Why should I use it with XPathContext?
#!/usr/bin/env perl
use warnings; use strict;
use XML::LibXML;
use 5.012;
my $parser = XML::LibXML->new;
my $doc = $parser->parse_string(<<EOT);
<?xml version="1.0"?>
<xml>
Text im Dokument
<element id="myID" name="myname" style="old" />
...
Hi,
I am using a small java smtp library (http://code.google.com/p/subethasmtp/), by this I need to parse the incoming emails in separate components viz body, attachments etc.
I am trying to use mime4j , but the documentation suggests that mime4j can only give event notification or token notification and nothing else. For stripping o...
I have to read a file in the BUILD method and I want to use the load method of the MooseX::Storage package.
But this load method create a new object and so when I instatiate the object this isn’t the object read from file. In the code below I create an object $m1 with state 2 to write the file, I create $m2 with no parameter to read the...
I've written a Perl script using OpenGL. It calls glutMainLoop() to let the user view some stuff, then the user closes the window but I want to let him continue using the script and reopening a new window and seeing some other stuff. Is that possible? I've found that it is possible to execute this instruction:
glutSetOption(GLUT_ACTION_...
A common 'Perlism' is generating a list as something to loop over in this form:
for($str=~/./g) { print "the next character from \"$str\"=$_\n"; }
In this case the global match regex returns a list that is one character in turn from the string $str, and assigns that value to $_
Instead of a regex, split can be used in the same way or ...
I have a file in which every line is an integer which represents an id. What I want to do is just check whether some specific ids are in this list.
But the code didn't work. It never tells me it exists even if 123 is a line in that file. I don't know why? Help appreciated.
open (FILE, "list.txt") or die ("unable to open !");
my @da...
In Ror or Django or web2py you can "describe" a database (as a set of classes that remaps to tables) and the framework (having being provided with a connection string to the desired database) generates the tables, fields, relations and in the case of RoR and web2py it also keeps it up-to-date (eg, removing a class drops the table, adding...
I've got a Perl script I'm using for running a file processing tool which is started using backticks. The problem is that occasionally the tool hangs and It needs to be killed in order for the rest of the files to be processed.
Whats the best way best way to apply a timeout after which the parent script will kill the hung process?
At t...
I have a file with such list:
100
101
102
103
What I want to do is to replace every 0 into A, 1 into C, 2 into G, 3 into T.
Hence we hope to get
CAA
CAC
CAG
CAT
...
I am trying to execute a Perl script like so:
/usr/bin/ec2-consistent-snapshot 'vol-dr3131c2'
When the Perl script fails it exits using 'die' and prints out an error message. I can see that error message when executing manually, but I am failing to capture it through PHP.
I tried the following with no success:
exec($command,$output)...
I have an array of numbers:
@numbers = 1,2,3,6,8,9,11,12,13,14,15,20
and I want to print it this way:
1-3,6,8-9,11-15,20
Any thoughts? Of course I tried using the most common "looping", but still didn't get it.
...
I have the follwing, simplest Perl CGI script:
use strict;
use warnings;
use CGI();
use CGI::Carp qw(fatalsToBrowser);
use Template;
print CGI::header();
foreach(@INC) {
print "$_\n";
}
When called (http://[..]/cgi-bin/p.cgi) I am given the following error:
Can't locate Template.pm in @INC (@INC contains: /usr/lib/perl5/site_p...
I'm writing a program that has to get values from a file. In the file each line indicates an entity. Each entity has three values. For example:
Value1 Value2 value3
I have a regular expresion to match them
m/(.*?) (.*?) (.*?)/m;
But it seems that the third value in never matched! The only way to match the third value is to add a...
I've found this on http://www.perlmonks.org/?node_id=606909
looking by qualified name ...
In this case you can call findnodes method on any node, you don't need the XML::LibXML::XPathContext with its prefix => namespace mapping:
$doc->findnodes('///info/fooTransaction/transactionDetail/[name() = "histFile:transactionSummary"]/*')...
I am using Perl stat() function to get the size of directory and its subdirectories. I have a list of about 20 parent directories which have few thousand recursive subdirs and every subdir has few hundred records.
Main computing part of script looks like this:
sub getDirSize {
my $dirSize = 0;
my @dirContent = <*>;
my $sizeOfFilesInDi...