Hello! When I installed perl from the source the first nice surprise was that without doing something all module installed from now on were available to the new perl. Since I didn't find one module on cpan that comes with my OS I have to use for some scripts the onboard-perl. For one of these scripts I would like to install Text::Format ...
I have a computationally expensive task in perl, and would like to inform the user that computation is ongoing by printing out a period after each portion of the computation is completed. Unfortunately, until I print a "\n", none of my periods are printed. How can I address this?
...
Is it possible to replace a method of a Moose object at runtime ?
By looking at the source code of Class::MOP::Method (which Moose::Meta::Method inherits from) I concluded that by doing
$method->{body} = sub{ my stuff }
I would be able to replace at runtime a method of an object.
I can get the method using
$object->meta->find_meth...
I have a bunch of log files which are pure text. Here is an example of one...
Overall Failures Log
SW Failures - 03.09.2010 - /logs/swfailures.txt - 23 errors - 24 warnings
HW Failures - 03.09.2010 - /logs/hwfailures.txt - 42 errors - 25 warnings
SW Failures - 03.10.2010 - /logs/swfailures.txt - 32 errors - 27 warnings
HW Failures - 03....
Hello, I have a Perl script which will allow for a file to be uploaded to my server. I'm not completely done with it yet, but I would like to know, if there is any way for me to get the full path of a file i uploaded. Shouldn't this be possible by checking the PATH_INFO environment variable, but when i try to check the path info, nothing...
According the the Perl documentation on regexes:
By default, the "^" character is guaranteed to match only the beginning of the string ... Embedded newlines will not be matched by "^" ... You may, however, wish to treat a string as a multi-line buffer, such that the "^" will match after any newline within the string ... you can do th...
This code triggers the complaint below:
#!/usr/bin/perl
use strict;
use warnings;
my $s = "aaa bbb";
my $num_of_item = split(/\s+/, $s) ;
print $num_of_item;
When I run the code, Perl complains that "Use of implicit split to @_ is deprecated" .
I really have no "context" for the problem, so I expect you help to explain what's wrong...
How do I initialize a 2d array in perl?
I am trying the following code:
0 use strict;
10 my @frame_events = (((1) x 10), ((1) x 10));
20 print "$frame_events[1][1]\n";
but it gives the following error:
Can't use string ("1") as an ARRAY ref while "strict refs" in use at ./dyn_pf.pl line 20.
This syntax only seems to initialize a ...
I have been trying several regular expressions in the substitution operator:
$str =~ s/^0+(.)/$1/;
converts 0000 to 0 and 0001 to 1
$str =~ s/^0+./$1/;
converts 0000 to empty string, 000100 to 00, 0001100 to 100.
what difference is the parentheses making?
...
I have an array of strings: @array
I want to concatenate all strings beginning with array index $i to $j.
How can I do this?
...
I have an environment variable set in Windows as TEST=abc£ which uses Windows-1252 code page. Now, when I run a Perl program test.pl this environment value comes properly.
When I call another Perl code - test2.pl from test1.pl either by system(..) or Win32::Process, the environment comes garbled.
Can someone provide information why t...
I'm using the date plugin for Template::Toolkit (Template::Plugin::Date), it works well with datetimes (yyyy-mm-dd hh:mm:ss) pulled straight out of MySQL, but it will not work with dates (yyyy-mm-dd).
What's the simplest way to get date.format to accept dates (without modifying the sql query)?
Thanks.
...
I've got a bunch of questions about how people use exceptions in Perl. I've included some background notes on exceptions, skip this if you want, but please take a moment to read the questions and respond to them.
Thanks.
Background on Perl Exceptions
Perl has a very basic built-in exception system that provides a spring-board for mor...
Hello:
I'm tyring to remove lowercase sentence fragments from standard text files using regular expresions or a simple Perl oneliner.
These are commonly referred to as speech or attribution tags, for example - he said, she said, etc.
This example shows before and after using manual deletion:
Original:
"Ah, that's perfectly tr...
Can I use isa in Moose with a regex as a parameter ? If not possible can I achieve the same thing with someothing other than ->isa ?
ok, having the following types Animal::Giraffe , Animal::Carnivore::Crocodile , I want to do ->isa(/^Animal::/), can I do that ? if I can't, what can I use to reach the desired effect ?
...
I'm trying to "hide" some of my perl program from the end user to make things easier on them. I'm doing what I can to keep them out of the command prompt. The program itself has a GUI designed in Perl/Tk, so they don't have to worry about the command prompt.
Could I write out a quick batch file that goes along the lines of:
START perl ...
I'm using fork() on Perl on Windows (ActivePerl) for a basic socket server, but apparently there are problems (it won't accept connections after a few times), is there any workaround?
Here is the portion of the relevant code:
while($client = $bind->accept()) {
$client->autoflush();
if(fork()){ $client->close(); }
else { $bi...
I have a bunch of XML files that are about 1-2 megabytes in size. Actually, more than a bunch, there are millions. They're all well-formed and many are even validated against their schema (confirmed with libxml2).
All were created by the same app, so they're in a consistent format (though this could theoretically change in the future)....
There is a perl script that needs to run as root but we must make sure the user who runs the script did not log-in originally as user 'foo' as it will be removed during the script.
So how can I find out if the user, who might have su-ed several times since she logged in has not impersonated 'foo' at any time in that chain?
I found an i...
Tom Christiansen's example code (à la perlthrtut) is a recursive, threaded implementation of finding and printing all prime numbers between 3 and 1000.
Below is a mildly adapted version of the script
#!/usr/bin/perl
# adapted from prime-pthread, courtesy of Tom Christiansen
use strict;
use warnings;
use threads;
use Thread::Queue;
su...