I have a bash script that cuts out a section of a logfile between 2 timestamps, but because of the size of the files, it takes quite a while to run.
If I were to rewrite the script in Perl, could I achieve a significant speed increase - or would I have to move to something like C to accomplish this?
#!/bin/bash
if [ $# -ne 3 ]; then
...
I have a output file which is a two dimensional array (this file was output generated after running script written to produce 2D array) and I have to read information under a particular column, say column 1. In other words, how do I read and print out information listed, corresponding to all the rows, under column 1.
Any suggestions?
_...
I get this error while using cookie_jar method:
Can't call method cookie_jar on an undefined value
Here is my code:
my $cookie_jar= new HTTP::Cookies;
my $ua=new LWP::UserAgent;
my %cookies= fetch CGI::Cookie;
my $encoded=$cookies{'SCred'};
$cookie_jar->set_cookie(1, "SCred", $encoded, "/", $SSO_DOMAIN, "", 0, 0, 60*60, 0);
$ua->co...
This is strange.
The following:
$sum = !0;
print $sum;
prints out 1 as you would expect. But this
$sum = !1;
print $sum;
prints out nothing. Why?
...
What is the difference between the C-style operators &&, ||, ... and their Perl human-readable version "and", "or", ... ?
It seems that internet code uses them both :
open (FILE, $file) or die("cannot open $file");
open (FILE, $file) || die("cannot open $file");
...
I am trying to extract text from PDF files using Perl. I have been using pdftotext.exe from command line (i.e using Perl system function) for extracting text from PDF files, this method works fine.
The problem is that we have symbols like , and other special characters in the PDF files which are not being displayed in the generated txt...
Anyone know of any Perl module to escape text in an XML document?
I'm generating XML which will contain text that was entered by the user. I want to correctly handle the text so that the resulting XML is well formed.
...
Handling two dimensional arrays in Perl is giving me a headache. Anyway, the following is my question:
I have a loop which pushes an array, say @twoOneArray, into another array, say @twoDimArray, and then is reset before the next iteration of loop begins and then again is pushed into @twoDimArray with new set of values. When I print thi...
Thanks to everyone in advance.
I'd like to access the nth byte of a binary scalar. For example you could get all the file data in one scalar variable...
Imagine that the binary data is collected into scalar...
open(SOURCE, "<", "wl.jpg");
my $thisByteData = undef;
while(<SOURCE>){$thisByteData .= $_;}
close SOURCE;
$thisByteData...
I have a run mode in my CGI::Application web-app that I would like to be able to trigger from the command line so i can automate it. From the web-app's perspective it does some processing then sends the results in an email.
When called from the web interface it passes in a set of parameters (email address, which query to run, date, etc...
I'm currently using a modified HTTP::Daemon::Threaded server in
combination with SOAP::WSDL and Pod::WSDL to provide web services
used by a variety of client types and roles.
---- that's not the question, the following is -----
I'd like to arrive at an optimal solution (as far as is possible) with respect to the following topics:
Req...
I have mounted a cifs file on two Linux machines. I have a Perl script which can modify the shared file. How do we lock the file over network in this scenario?
...
What I need to do is change a string such as "CN=bobvilla, OU=People, DC=example, DC=com" (can have many DC='s in the string) to "example.com"
I have this method but It seems sloppy to me and wanted to see if anyone had a better idea.
my $str = "CN=bobvilla, OU=People, DC=example, DC=com";
print "old: $str\n";
while($str =~ s/DC=([^,]+...
What is the difference between package, module and class in object oriented Perl?
...
I have several copies of the same PDF file. These copies have annotations in it (Rect type with pop-up comments).
I want to know if I can get all these annotations from these copies and aggregate them into a single master copy using CAM::PDF (or another free tool).
an example to illustrate:
I have file1_userA.pdf and file1_userB.pdf. T...
Here is some test code to illustrate my problem;
use Tk;
use POE qw( Loop::TkActiveState );
use Tk::Toplevel;
POE::Session->create(
inline_states => {
_start => \
}
,over => sub { exit }
}
);
$poe_kernel->run();
exit 0;
sub ui_start {
my ($kernel, $session, $heap) = @_[KERNEL, SESSION, HEAP];
$heap->...
I am looking for instructional materials on object-oriented software design that are framed as extended examples. In other words, over the course of several lessons or chapters, the author would develop a moderately large piece of software and explain the design approach step by step. Ideally, the material would address not only the desi...
I'm building an FTP client using Net::FTP. The documentation states that the new constructor has a Host option which can be a reference to an array with hosts to try in turn. I don't seem to be able to get this to work. I'm using ActivePerl under Windows XP. Here's my code:
@try_these = ("turing.unh.edu", "euler.unh.edu");
$ftp = Net::F...
Other than RATS, are there any other Perl security scanners?
Possibly also any STATIC only perl code graph engine which has an ability to follow data-flow or otherwise tainted input?
...
Is there a way to use app-specific mini-CPANs (to ensure specific module versions for different apps and make an install work without net access). The 'standard' mini-cpan way of things relies on setting 'o conf urllist' with a file url in your CPAN/Config.pm
That's fine with one single mini-cpan. However, I need to automate having a C...