I find myself needing to use Perl more and more since PHP's regular expressions leave me wondering what is going on half the time as they simply don't respond as they should (as they do when I use Perl, for example)... i had been using this method to call perl (before i started trying to do this with regular expressions).. passing in a r...
I couldn't understand what exactly "W" do.
my $x = "this is my string";
print unpack("W",substr($x,0,1));
Prints: 116
my $x = "this is my string";
print unpack("W",$x);
Still Prints: 116
...
Hi everyone, i'm trying to make a logging function with php for a tool that captures computer information on Windows. Every 15 seconds the a txt file will be produced with information inside. i want to make it run in the background while the user access other pages and not be interrupted.
Here's the code i'm now using
<?php
$tr...
I'm using DBIx::Class in a web context and I'd like to display the number of SQL queries performed and the time they took for the rendering of a page.
Any idea about how to implement that?
...
I try to log all soap calls, with subrutine called and arguments passed to the subroutine, my solution was this:
#!/usr/bin/perl -w
use SOAP::Transport::HTTP;
SOAP::Transport::HTTP::CGI
-> dispatch_to('SoapStatus')
-> handle;
package SoapStatus;
use POSIX qw(strftime);
# Can I capture arguments and called sub from here ?
...
I have an executable which reads from STDIN and output goes to STDOUT.
I need a Perl script which will fork this executable as a child and write to STDIN of that child process and read from the STDOUT.
This is required for Windows. Any ideas or suggestions?
...
I have a table (id, parent_id, data) where parent_id points to another row in same table (or is null).
Is there a standard way to query (1) all the ancestors of a certain id and (2) all the descendants of a certain id?
I'm also doing this in DBIx::Class, so if there's a most convenient way to do it with that module (or some other), I'd...
In my Perl script I get strings of file paths that may contain environment variables, e.g. $FONTS/test.ttf or $TMP/file.txt.
I now want to open those files like this:
open my $handle, "<$filename" or die $!;
How can I now expand the environment variables prior to the open call, as e.g. the bash shell would do?
...
I need to run the following command from inside a Perl script in Windows. The code can't be simpler than this:
#! C:\Perl\bin\perl
perl -e "print qq(Hello)";
I save this file as test.pl. I open a command prompt in Windows and run the following from the c:\Per\bin directory. When I run it as perl test.pl, I get the following result:
...
Hi,
In my script I need to iterate through range of dates given the start date and end date. Please provide me guidance to achieve this using perl.
Thank You
...
How do I parse a negative number from a string in perl? I have this piece of code:
print 3 - int("-2");
It gives me 5, but I need to have 3. How do I do it?
...
I am trying to convert a Perl script to a C# 3.5 routine.
The perl code I have is:
if($work =~ /\<[0-9][0-9][0-9]\>/){
$left = $`;
$match = $&;
$work = $';
}
In C# I wrote the following code:
string[] sSplit = Regex.Split(work, @"\<[0-9][0-9][0-9]\>");
if sSplit.length is > 2
{
left = sSplit[0];
...
TFMail was a popular CGI Form Mail script at one time.
Unfortunately, my client insists on continuing to use it. I hope that there are people who still use it and are experts in using it. The best documentation I can find is someone's home made reference sheet.
In my HTML form, I have an input named attachment1 :
<input type="file"...
TFMail was a popular PERL CGI Form Mail script at one time. So far it has served our purposes. It is very easy to set up and configure.
Unfortunately, it only has basic functionality. It works well when you want users to fill in a form and have the result emailed to a specified email address.
Can someone recommend a script ( maybe...
I want my .pl to execute a function at the end of every day, week and month. What the function will do is grab an integer from an html at the end of the day and store it in a .txt to be used to create a graph.
I already know how to implement CGI and JS with a perl script, so that is no issue. I'm just not clear on whether or not DateTi...
Right now when i do something like this:
use strict;
use warnings;
package My::Test;
use parent 'Test::Class';
use Test::More;
sub overrides_basic : Tests {
ok( 1, "works" ); ok( 1, "works" );
}
sub overrides_no_profile : Tests {
ok( 2, "works" ); ok( 2, "works" );
}
__PACKAGE__->runtests;
1;
The output is this:
ok 1 - work...
Right now I can name the subroutine printargs as follows to get the dump.
perl -MO=Concise,printargs,-main,-terse Hello.pl
Assuming I have several subroutines, how can I build a generic module to dump details for all subroutines?
...
I need a regular expression to uncomment a block of Perl code, commented with # in each line.
As of now, my find expression in the Eclipse IDE is (^#(.*$\R)+) which matches the commented block, but if I give $2 as the replace expression, it only prints the last matched line. How do I remove the # while replacing?
For example, I need to...
I wrote a Perl program to capture a live data stream from a tail command on a Linux machine using the following command in the console:
tail -f xyz.log | myperl.pl
It works fine. But now I have to execute this Perl program on a different machine because the log file is on that different machine. Can anyone tell me how I can do it?
...
Hi, I'm trying to debug a script with perl -d .... After I break where I want, I'd like to print out the current environment and the environment from higher frames.
I see the stack via T. Now, if I try V, I get a list of everything, which is pretty much useless, since it includes stuff like SO_BROADCAST constants, etc. How can I filter ...