I have created a package using Moose and I would like to nstore some large instances. The resulting binary files are very large (500+MB) so I would like to compress them.
What is the best way for doing that?
Should I open a filehandle with bzip etc. then store using fd_nstore?
...
I'm a Moose newbie and I wonder if the common
our $VERSION = "0.001";
$VERSION = eval $VERSION;
should also be used in Moose packages, or Moose has some alternative way for version control. Couldn't find a reference in Moose docs.
...
Can you point me on an idea of how to get all the HTML files in a subfolder and all the folders in it of a website?
For example:
www.K.com/goo
I want all the HTML files that are in: www.K.com/goo/1.html, ......n.html
Also, if there are subfolders so I want to get also them: www.K.com/goo/foo/1.html...n.html
...
I am trying to download a .csv file into an array and then parse each column line-by-line with Text::CSV. I have the following:
my @file = get("http://www.someCSV.com/file.csv") or warn $!;
my $CSV = Text::CSV->new();
$CSV->sep_char (',');
for ( @file ) {
$CSV->parse($_) or warn $!;
my @columns = $CSV->fields();
print...
I have a system script in perl. I need some equivalent of bash -x to determine what is going wrong with the script. Is there something equivalent?
EDIT: What bash -x does is that it prints each line as it is evaluated. This makes debugging code that is just missing some path variable or file very easy.
...
I wrote a simple Perl script which will run in while loop and exit whenever any signal is send to this Perl script. I wrote a c program which creates a thread using the pthread_create() and in its start routine, it's using popen to execute that Perl script:
popen("/usr/bin/perl myprog.pl");
I am using the sigtrap in the Perl script to...
Hello Every1,the issue is regarding how to retain the selected value in Combobox during pagination.
"i have a combobox which has some values,whenevr i select 1 value then according to the value selected the Records per page will be defined BUT whenever i navigate to next page then the value in combobox gets reset to first value". Here's ...
@ver = $session->cmd("sh conf");
The variable here is ver, which has the configuration file, that is, it has more than one line. So how to take an output of each line of the ver variable without putting it in a loop?
...
I needed to make a simple browser user agent parser in Perl. I have found a PHP code that does this but my knowledge is rather limited (esp. in regular expressions). So, here is the code whose Perl equivalent I want to write.
if ($l = ereg($pattern, $agent, $a = array()))
{
array_push($found, array("product" => $a[1], ...
$ cat test.pl
my $pid = 5892;
my $not = system("top -H -p $pid -n 1 | grep myprocess | wc -l");
print "not = $not\n";
$ perl test.pl
11
not = 0
$
I want to capture the result i.e. 11 into a variable. How can I do that?
...
On Unix, all these three generate the same result
system("top -H -p $pid -n 1"); #ver1
system("top", "H", "p $pid", "n 1"); #ver2
system("top", "-H", "-p $pid", "-n 1"); #ver3
What is the difference between ver2 and ver3?
Is there any reason I should use ver2 and ver3, and not ver1?
They do not even support pipin...
system("logscr.ply ");
The error I get is this:
Can't exec "logscr.ply": Permission denied at eal.ply line 3
Why am I getting the error, and how do I fix it?
...
I would like to remove contents of a file from a certain character to a certain character in the file in Perl. How do I do that using a script?
The file has this:
Syslog logging: enabled (11 messages dropped, 2 messages rate-limited,
0 flushes, 0 overruns, xml disabled, filtering disabled)
Console logging: level inf...
Background
Looking to automate creating Domains in JasperServer. Domains are a "view" of data for creating ad hoc reports. The names of the columns must be presented to the user in a human readable fashion.
Problem
There are over 2,000 possible pieces of data from which the organization could theoretically want to include on a report....
In one of my modules, I have to deal with the concept of infinity. To date, I have been using 9**9**9 as positive infinity, and this seems to work well, is fast, and seems to be what perl's internals use as infinity.
However, things get a bit dicey if a user of my module decides to use one of the big number modules (like use bigint;)...
I'm using XML::Simple to parse an XML file which I then want to use to write an output file in a very specific format. Thus, the output order is important.
As I understand it, when the XML is converted to the perl hashref the order is lost (because perl hashes have no order). But what about when an array is used by XML::Simple.
For ex...
In Perl, pack and unpack have two templates for converting bytes to/from hex:
h A hex string (low nybble first).
H A hex string (high nybble first).
This is best clarified with an example:
use 5.010; # so I can use say
my $buf = "\x12\x34\x56\x78";
say unpack('H*', $buf); # prints 12345678
say unpack('h*', $buf); # prints...
Hi dear Friends.... i am new to perl environment....i have n number of arrays with n number of strings in it and iam trying to get the combinations of all the strings of all the arrays ie i have like.....
array1="array1_String_1,array1_String_2,array1_String_3 ..... array1_String_n";
array2="array2_String_1,array2_String_2,array2_String...
what is the easiest way to decompress a data name? for exmaple
change compressed form:
abc[3:0]
into decompressed form:
abc[3]
abc[2]
abc[1]
abc[0]
preferable 1 liner :)
...
I'm looking to fork Modern::Perl, it's over a year old now, and far dated. I've created nextgen.pm (now on cpan) to take it place.
So far, I've added in:
autodie,
and indirect
I assert 5.10.1, so no one trying to write modern Perl gets caught up in the mess that is 5.10.0's smart match. I've also added conditional support for
Moo...