Module Foo::Bar has been installed somewhere in @INC.
Other than recursively checking @INC for Foo, then Bar, then scripts or t, is there a way of accessing those directories from the module itself?
For example, I would like to call a particular script in lib/scripts/findmeifyoucan.pl from Foo/Bar.pm.
...
I'm working with perl, and using DBI. Up to now, I've been using ->fetchall_arrayref to get the results of a database query, and just accessing the array by numeric keys. However, I much prefer to be able to access records by the field names (associative fetch) than numeric.
How do I do this, and what is the correct syntax for accessing...
I'm requesting a web page using LWP in perl, and I'd like to be able to access the SSL certificate that the web server presents (I'm looking for an expiration date in the cert, among other things). The information I want isn't in the three headers that Crypt::SSLeay adds to the request. Is there a way that I'm overlooking with which I ...
Working on converting an array to another array. In PHP, this is easy, but Perl has some syntax that I am having a hard time getting my head around and understanding.
Here is my loop in Perl:
foreach my $r (@toindex){
#print Dumper $r;
%indexed{@$r[0]}{'image_id'} = @$r[0]; #Broken
%indexed{"@$r[0]"}{'image_id'} = @$r[0...
I have a situation where we have a base recordset with about one hundred thousand records. And, we are creating a separate application that shares some of the dataset, but not most, so we are creating a detail table that has a one to one relationship with the original table. What I want to do is pull the existing information from the ori...
I have a <textarea> for user input, and, as they are invited to do, users liberally add line breaks in the browser and I save this data directly to the database.
Upon displaying this data back on a webpage, I need to convert the line breaks to <br> tags in a reliable way that takes into consideration to \n's the \r\n's and any other com...
I have a value ($field) that I want to test. Read the perl doc (http://perldoc.perl.org/Switch.html#Allowing-fall-through), and figured that I had this nailed. Seems not, because if I pass 'Exposure Bias', there is no output, though 'Exposure Bias Value' works as it should. It throws no errors, so I have no clue.
use Switch;
use strict;...
My goal is to find all "<?=" occurrences with ack. How can I do that?
ack "<?="
Doesn't work. Please tell me how can I fix escaping here?
...
I have a perl CGI application that I want to take the users request headers, and turn those around into an LWP::UserAgent get request. Basically the goal is to replicate the incoming users headers and use those to make a separate request.
I've tried to create the headers myself but when I attempt to display the CGI headers and then my ...
I'd like to store a data structure persistently in RAM and have it accessible from pre-forked
web server processes in Perl.
Ideally I would like it to behave like memcached but without the need for a separate daemon. Any ideas?
...
In my script, I need to load some info from disk file and during the run of script the info might be changed.To keep the consistence of the file in disk and it's in memory copy I need to
write back the info to disk whenever the info is changed in memory or periodically write them
back to disk or just write them back at the time of the sr...
I have some very large C files, having lots of functions. I need to trace the execution path at run time. There is no way I can trace it through debugging as its a hypervisor code currently running over qemu and doing a lot of binary translations.
Can anyone point me to some script in Perl or Python which can add a printf at the startin...
In my app I need to store some simple data both in memroy and in disk. A real database will be overkill in my case, so I need lighter one to handle the simple data persistence requirement. I do some google search by myself, and found something interesting like DBM and DBI CVS, etc. but since there are too many options there so it is diff...
I need help to write some Perl code to replace some selected values in text files. Below is the sample of my text files. I want to replace the value of "end" to a new value in the date format YYYYMMDD, increase the key value by 1, and the rest should remain the same.
Source File:
server=host1
network=eth0
start=YYYYMMDD
...
I have Cygwin installed, I want to execute something like this on the command prompt:
perl -pne 's/</<' input > output
But I'm running into two separate issues with the & and < each needing to be escaped.
something like 's/&/&' is an error at the perl level
"Substitution pattern not terminated at -e line 1"
something like 's/...
So at the command line I can conveniently do something like this:
perl -pne 's/from/to/' in > out
And if I need to repeat this and/or I have several other perl -pne transformations, I can put them in, say, a .bat file in Windows. That's a rather roundabout way of doing it, of course. I should just write one perl script that has all th...
Does anyone know how to access/modify the POST request data using mod_perl2.
IN GET method one can get/set the request QUERY string:
$args = $r->args();
$prev_args = $r->args($new_args);
How to get/set the request QUERY string in POST method ?
...
Consider the following:
use strict;
use Data::Dumper;
my $hash={['one','two']=>[1,2]};
print Dumper($hash);
=for comment
prints....
$VAR1 = {
'ARRAY(0x35358)' => [
1,
2
]
};
=cut
As an alternative, the key in the hash can be ...
package a::b::c:d
my $res = a::b::c:e->new(); # i am doing like this
# is there any othere to do this
sub new {
...
my $self = {
#result = a::b::c:e->new();
}
}
sub test {
}
sub test2 {
}
1;
package a::b::c:e
sub new {
...
}
sub testresult {
}
1;
My question is:
how to initalize the e module in d in new itself rath...
with
@a=(6,3,5,7);
@b=(@a[0..3])[2..3];
print @b;
#print 57
but for
@b=@a[0..3][2..3];
I get a syntax error. Could someone explain why?
...