How can I print the values of the cookie/cookie_jar being set?
Trying:
##my $cookie_jar=HTTP::Cookies->new(file => "cookie.jar",autosave=>1,ignore_discard=>1);
my $cookie_jar=HTTP::Cookies->new(); ## Would like it to be in memory
my $agent = WWW::Mechanize->new(cookie_jar => $cookie_jar);
##my $agent =…
Let's say I have a subroutine/method that a user can call to test some data that (as an example) might look like this:
sub test_output {
my ($self, $test) = @_;
my $output = $self->long_process_to_get_data();
if ($output =~ /\Q$test/) {
$self->assert_something();
}
else {
…
I've got a large XML file, which takes over 40 seconds to parse with XML::Simple.
I'd like to be able to cache the resulting parsed object so that on the next run I can just retrieve the parsed object and not reparse the whole file.
I've looked at using Data::Dumper but the documentation is a bit lacking on how…
I'm trying to write some abstract code for searching through a list of similar objects for the first one whose attributes match specific values. In order to do this, I need to call a bunch of accessor methods and check all their values one by one. I'd like to use an abstraction like this:
sub verify_attribute {
…
I have a string that has a file path:
$workingFile = '/var/tmp/A/B/filename.log.timestamps.etc';
I want to change the directory path, using two variables to note the old path portion and the new path portion:
$dir = '/var/tmp';
$newDir = '/users/asdf';
I'd like to get the following:
…
I need to write a daemon that supposed to have one TCP socket and one named pipe. Usually if I need to implement a multi IO server with "pure" sockets, the select based multi-IO model is always the one I will choose. so does anyone of you have ever used named pipe in select or you
can just…
Hi all,
I have a PDF document which I need to shift the pages to the right several inches. I.e like putting a margin on the left hand side of the page.
Can either CAM::PDF or PDF::API2 do it?
Or is there anyone have experience with it?
Thanks.
I have used JSON::Any in my program to transfer the hash between client and server.
I faced one problem, I want to find whether the text (sent by client) is normal text or JSON encoded text.
Can anyone please tell me how to find,
without checking, I got some error in server side and it…
I want to get the file from one host to another host. We can get the file using the NET::FTP module. In that module we can use the get method to get the file. But I want the file contents instead of the file. I know that using the read method we can read the file contents. But how do I…
I want to capture several text using the following regex:
$text_normal = qr{^(\/F\d+) FF (.*?) SCF SF (.*?) MV (\(.*?)SH$};
A sample of the string is like below:
my $text = '/F12345 FF FF this is SCF SF really MV (important stuff SH';
Can that be rewritten to speed up the…
I am trying to parse the filename from paths. I have this:
my $filepath = "/Users/Eric/Documents/foldername/filename.pdf";
$filepath =~ m/^.*\\(.*[.].*)$/;
print "Linux path:";
print $1 . "\n\n";
print "-------\n";
my $filepath = "c:\\Windows\eric\filename.pdf";
$filepath =~…
Ultimately, what I want to do is to start a process in a module and parse the output in real time in another script.
What I want to do :
Open a process Handler (IPC)
Use this attribute outside of the
Module
How I'm trying to do it and fail :
Open the process handler…
I want to get file size I'm doing this:
my $filename=$query->param("upload_file");
my $filesize = (-s $filename);
print "Size: $filesize ";`
Yet it is not working. Note that I did not upload the file. I want to check its size before uploading it. So to limit it to…
Let's say I have a subroutine/method that a user can call to test some data that (as an example) might look like this:
sub test_output {
my ($self, $test) = @_;
my $output = $self->long_process_to_get_data();
if ($output =~ /\Q$test/) {
…
I am trying to figure out a way of checking for the existence of a value in an array without iterating through the array.
I am reading a file for a parameter. I have a long list of parameters I do not want to deal with. I placed these unwanted parameters in…
I am getting started with Test::More, already have a few .t test scripts. Now I'd like to define a function that will only be used for the tests, but across different .t files. Where's the best place to put such a function? Define another .t without any tests…
I want to send standard output to the file "my_output.txt" but failed.
Here's the output:
inside value loop
------------------------------------------------------------
Server listening on UDP port 5001
Receiving 1470 byte datagrams
UDP buffer size: 108…
I want to get file size I'm doing this:
my $filename=$query->param("upload_file");
my $filesize = (-s $filename) ;
print "Size: $filesize ";
Yet it is not working.Note that I did not upload the file. I want to check its size before uploading it. so…
Hi,
I know I can do this,
------
open(F,"",\$var);
print F "something cool";
close(F);
print $var;
------
or this,
open(F, "| ./prog1 | ./prog2 tmp.file");
print F "something cool";
close(F);
but is it possible to combine these? The…
I have a script that has been running for over a year and now it is failing:
It is creating a command file:
open ( FTPFILE, ">get_list");
print FTPFILE "dir *.txt"\n";
print FTPFILE "quit\n";
close FTPFILE;
Then I run the system command:
…
Hello.
I plan to ignore the block content which include the start line of "MaterializeU4()" with the subroutin() read_block below. But failed.
# Read a constant definition block from a file handle.
# void return when there is no data left in…
Hello.
I plan to skip the block content which include the start line of "MaterializeU4()" with the subroutin() read_block below. But failed.
# Read a constant definition block from a file handle.
# void return when there is no data left in…