[24239] in Perl-Users-Digest
Perl-Users Digest, Issue: 6430 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 20 09:05:50 2004
Date: Tue, 20 Apr 2004 06:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 20 Apr 2004 Volume: 10 Number: 6430
Today's topics:
Re: activeperl + -T option <clydenospamorham@nospamorhamgetofftheline.freeservenospamorham.co.uk>
Re: activeperl + -T option <tassilo.parseval@rwth-aachen.de>
Re: compilation problem when adding a module (Anno Siegel)
Re: Encrypting files <zentara@highstream.net>
Re: help with upload perl <clydenospamorham@nospamorhamgetofftheline.freeservenospamorham.co.uk>
Re: Opening Ports (Anno Siegel)
Pattern matching question ... <jhalbrook@bjc.org>
Re: Pattern matching question ... <nobull@mail.com>
Re: Pattern matching question ... axel@white-eagle.co.uk
Pipes and non blocking writing <sppNOSPAM@monaco377.com>
Re: Pipes and non blocking writing (Anno Siegel)
Re: Pipes and non blocking writing <sppNOSPAM@monaco377.com>
Re: regular expression module? <nobull@mail.com>
Re: regular expression module? (Anno Siegel)
Re: Request for program test on different operating syt <t@REMOVETHISbrowse.to>
Re: slurp not working? ideas please! <geoffacox@dontspamblueyonder.co.uk>
Re: slurp not working? ideas please! <geoffacox@dontspamblueyonder.co.uk>
Re: slurp not working? ideas please! (Anno Siegel)
Re: slurp not working? ideas please! <tadmc@augustmail.com>
Re: slurp not working? ideas please! <geoffacox@dontspamblueyonder.co.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 20 Apr 2004 11:59:42 +0100
From: "Clyde Ingram" <clydenospamorham@nospamorhamgetofftheline.freeservenospamorham.co.uk>
Subject: Re: activeperl + -T option
Message-Id: <9o7hc.52$pl4.33@newsfe3-win.server.ntli.net>
Robin,
"Robin" <robin @ infusedlight.net> wrote in message
news:c62hsr$qci$1@reader2.nmix.net...
> I am running active perl 8.2.3 Build 809 and I'm wondering why when I turn
> on taint mode checking on the #!/usr/bin/perl line whenver I run the
script
> it gives me an error "Too late for -T option at bbs.pl line 1." and
whenever
> I run the script with perl -T bbs.pl it works fine
You have not said which platform you are running on.
What you hint at should behave correctly on most UNIX systems.
There are several well documented bugs in how DROSS and Windoze systems
invoke Perl programs . . .
> ....is there any
> configuration file I can edit so perl will automatically understand it to
be
> run with a -T option? I want to run the script with a Perl IDE that I've
> downloaded and it gives me this error unless I take out the -T option. Do
I
> have to take out the -T evertime I run the script with the IDE or is there
> something I can do?
I assume Windoze.
From the ActivePerl user guide, look at
file://E:\Perl\html\faq\Windows\ActivePerl-Winfaq4.html#What_s_the_equivalent_of_the_she
(for E:, substitute the drive you have installed ActivePerl on):
<QUOTE>Unfortunately, Win32 platforms don't provide the shebang syntax, or
anything like it. You can try one of the two following methods to run a
script from the command line. If all else fails, you can always just call
the perl interpreter directly, as in perl myscript.pl.
. . .
For Windows NT 4.0/2000, the coolest method is to use associated file types
(see How do I associate Perl scripts with perl?). If you've associated Perl
scripts with the .pl extension, you can just type the name of your file at
the command line and Windows NT/2000 will launch perl.exe for you.
</QUOTE>
I guess you could hard-wire "-T" into the Perl command line associated with
extension ".pl", but that would impose taint checking everywhere, which
would give you headaches.
If you change the PATHEXT environment variable to include .pl files, like
this:
SET PATHEXT=.pl;%PATHEXT%
you can just type the file name without an extension, and Windows NT/2000
will find the first .pl file in your path with that name. You may want to
set PATHEXT in the System control panel rather than on the command line.
Otherwise, you'll have to re-enter it each time the command prompt window
closes.
<QUOTE> Note that the file association method does not work for Windows 9x,
nor does it work with Windows NT/2000 if you have command extensions
disabled. You can, however, still start the Perl script from an Explorer
window if the extension is associated with perl.
Another option is to use the pl2bat utility distributed with ActivePerl to
convert your Perl script into a batch file. What this does is tag some Win32
batch language to the front of your script so that the system calls the perl
interpreter on the file. It's quite a clever piece of batch coding,
actually.
If you call the pl2bat utility on your Perl script helloworld.pl, like this:
C:\> pl2bat helloworld.pl
it will produce a batch file, helloworld.bat. You can then invoke the script
just like this:
C:\> helloworld
Hello, World!
You can pass command line parameters, as well. Your script can be in your
PATH, or in another directory, and the pl2bat code will usually find it and
execute it correctly. The big advantage of this over file associations is
that I/O redirection will work correctly.
pl2bat has a number of useful command line options to affect how the
wrapping is done, what command line switches to pass to perl, etc. Running
perldoc pl2bat at the command line will show a full description of these
options.
</QUOTE>
When I run this little script, called "trial_shebang.pl":
#!e:\perl\bin\perl.exe -wT
use strict;
print "Howdy do there\n"
I see what you saw:
D:\Clyde\perldev\Trial>trial_shebang.pl
Too late for "-T" option at D:\Clyde\perldev\Trial\trial_shebang.pl
line 1.
When I run:
D:\Clyde\perldev\Trial>pl2bat trial_shebang.pl
pl2bat creates a DROSS batch file "trial_shebang.bat"
When I run it, I see this:
D:\Clyde\perldev\Trial>trial_shebang
Howdy do there
Now, whether this is any help to you depends on how your IDE invokes your
Perl programs.
Which IDE was it?
.
Regards,
Clyde
------------------------------
Date: 20 Apr 2004 11:05:00 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: activeperl + -T option
Message-Id: <c6304s$7edtm$1@ID-231055.news.uni-berlin.de>
Also sprach Robin:
> I am running active perl 8.2.3 Build 809 and I'm wondering why when I turn
> on taint mode checking on the #!/usr/bin/perl line whenver I run the script
> it gives me an error "Too late for -T option at bbs.pl line 1." and whenever
> I run the script with perl -T bbs.pl it works fine....is there any
> configuration file I can edit so perl will automatically understand it to be
> run with a -T option? I want to run the script with a Perl IDE that I've
> downloaded and it gives me this error unless I take out the -T option. Do I
> have to take out the -T evertime I run the script with the IDE or is there
> something I can do?
The reason why this happens is that your operating system (most probably
Windows) doesn't take the shebang line into account. However, perl does.
It executes the script and looks at the shebang line to see whether it
should include some switches (like -w). This doesn't work with the -T
switch because a perl instance cannot switch to tainted mode. It has to
know right from the start that it should use taintedness.
You can probably tell your IDE to use 'perl -T' instead of 'perl' as the
interpreter.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: 20 Apr 2004 10:51:55 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: compilation problem when adding a module
Message-Id: <c62vcb$gii$4@mamenchi.zrz.TU-Berlin.DE>
felipe200112 <felipe200112@yahoo.com> wrote in comp.lang.perl.misc:
> This is generic to my machine. Maybe is it an initialisation problem...
Generic? What do you mean?
> Do you have an idea ??
The output below shows two problems that may well be independent from
each other. For the locale problem, unset the environment variable
LANG and try again.
Anno
> "Version_check" is not exported by the ExtUtils::MakeMaker module
> Can't continue after import errors at -e line 0
> ==============================================
>
> linux51:/usr/src/rpm/SOURCES/IO-Socket-SSL-0.93# perl Makefile.PL
> perl: warning: Setting locale failed.
[rest snipped]
------------------------------
Date: Tue, 20 Apr 2004 08:10:53 -0400
From: zentara <zentara@highstream.net>
Subject: Re: Encrypting files
Message-Id: <1l4a80tr8d5n2q2djeggqoo3cr5c10g5jm@4ax.com>
On 20 Apr 2004 02:34:58 -0700, slimclity@hotmail.com (SlimClity) wrote:
>I'm trying to encrypt file's using the Perl Crypt::Rijndeal module,
>see encrypt.pl and decrypt.pl. Because the data must be in blocks of
>16 I use "get16". Both scripts work, I can encrypt and decrypt files.
>But the decrypted file is corrupt, eg. encrypt word file --> decrypt
>--> File is corrupt.
>
>I think this has something to do with the get16, when decrypting I
>think I must remove those "\0" which were added (how??).... Or is it
>something else??
Yeah, I see the same thing, the get16 sub is padding \0's at the front
of the file, and it should be at the end. Also, I only get it to work
by slurping the whole files in, and working on them. Maybe someone
knows how to get the while loop going, but the following will work.
Notice the change in the get16 sub, and that I'm padding the whole
file, not in a while loop.
##--encrypt#############
#!/usr/bin/perl
use Crypt::Rijndael;
$cipher = new Crypt::Rijndael "1234567890123456",
Crypt::Rijndael::MODE_CBC;
my $file = shift or warn "Need a file $!\n";
$srcfile = $file;
$destfile = "$file.enc";
#my ($srcfile, $destfile) = @_;
my $buffer;
open INF, $srcfile
or die "\nCan't open $srcfile for reading: $!\n";
open OUTF, ">$destfile"
or die "\nCan't open $destfile for writing: $!\n";
binmode INF;
binmode OUTF;
#slurp file in
read( INF, $buffer, -s INF );
close INF;
#now pad the whole thing
$buffer = get16($buffer);
print OUTF $cipher->encrypt($buffer);
close OUTF;
sub get16 {
my $data = shift;
# return "\0" x ( 16 - length($data) % 16 ) . $data;
return $data . "\0" x ( 16 - length($data) % 16 );
}
__END__
##decrypt##############################################
#!/usr/bin/perl
use Crypt::Rijndael;
$cipher = new Crypt::Rijndael "1234567890123456",
Crypt::Rijndael::MODE_CBC;
my $file = shift or warn "No input file $!\n";
$srcfile = $file;
$destfile = "$file.out";
#my ($srcfile, $destfile) = @_;
my $buffer;
open INF, $srcfile
or die "\nCan't open $srcfile for reading: $!\n";
open OUTF, ">$destfile"
or die "\nCan't open $destfile for writing: $!\n";
binmode INF;
binmode OUTF;
#slurp file in
read( INF, $buffer, -s INF );
close INF;
print OUTF $cipher->decrypt($buffer);
close OUTF
or die "Can't close $destfile: $!\n";
__END__
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
------------------------------
Date: Tue, 20 Apr 2004 13:11:03 +0100
From: "Clyde Ingram" <clydenospamorham@nospamorhamgetofftheline.freeservenospamorham.co.uk>
Subject: Re: help with upload perl
Message-Id: <0r8hc.71$pl4.41@newsfe3-win.server.ntli.net>
Dear renping.liu,
"News sender" <renping.liu@eng.ox.ac.uk> wrote in message
news:c62rts$krj$1@news.ox.ac.uk...
> The code works fine on PC and Linux (both run apache 2.0.39). But when I
run
> the code on Unix (solaris7, also run Apache2.0.39), only the filename is
> uploaded, not the contents:
>
> -rw------- 1 nobody nobody 0 Apr 19 16:10 file1
> -rw------- 1 nobody nobody 0 Apr 19 16:35 file2
>
> You can see the file names are right: file1, file2. But the size of each
> file is 0.
Have a look at http://stein.cshl.org/WWW/software/CGI/
Lincoln starts the section "USING the File Upload Feature" by warning:
"The file upload feature doesn't work with every combination of browser and
server. The various versions of Netscape and Internet Explorer on the
Macintosh, Unix and Windows platforms don't all seem to implement file
uploading in exactly the same way. I've tried to make CGI.pm work with all
versions on all platforms, but I keep getting reports from people of
instances that break the file upload feature. "
In the "Frequent Problems" sub-section, look at the problem entitled "You
can read the name of the uploaded file, but can't retrieve the data":
"First check that you've told CGI.pm to use the new multipart/form-data
scheme. If it still isn't working, there may be a problem with the temporary
files that CGI.pm needs to create in order to read in the (potentially very
large) uploaded files. Internally, CGI.pm tries to create temporary files
with names similar to CGITemp123456 in a temporary directory. To find a
suitable directory it first looks for /usr/tmp and then for /tmp. If it
can't find either of these directories, it tries for the current directory,
which is usually the same directory that the script resides in."
In the section "Creating a File Upload field", Lincoln says:
"In order to take full advantage of the file upload facility you must use
the new multipart form encoding scheme. You can do this either by calling
startform() and specify an encoding type of $CGI::MULTIPART or by using the
new start_multipart_form() method. If you don't use multipart encoding, then
you'll be able to retreive the name of the file selected by the remote user,
but you won't be able to access its contents."
He offers a very detailed analysis of problems and "best practice", in
particular:
1. "use strict;"
You forgot to put this at the top of your program. You also forgot to
enable warnings:
#!/usr/bin/perl -w
use strict;
2. "To be safe, use the upload() function"
So, instead of doing this:
> while ($bytesread=read($filepath,$buffer,1024)) {
Try something like this:
1. Form Generation phase:
print
header(),
start_html(),
start_multipart_form( -name => 'myform' ),
filefield( -name => 'filename', 'maxlength' => 64, override => '1' ),
submit( -name 'Upload file', 'value' =. 'upload' ),
end_form(),
end_html();
2. Handling Form submission:
my $fh = upload( 'filename' );
while ( read $fh, $buffer, 1024 ) {
print OUTFILE, $buffer;
}
I have used code like this in a CGI script on Solaris 2.6, with Perl 5.004
(!!) and CGI.pm 2.76 with no problems.
(I was uploading text files, so did not need binmode.)
I hope this helps.
Regards,
Clyde
------------------------------
Date: 20 Apr 2004 12:04:57 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Opening Ports
Message-Id: <c633l9$m3p$3@mamenchi.zrz.TU-Berlin.DE>
Tony Curtis <tony_curtis32@_SPAMTRAP_yahoo.com> wrote in comp.lang.perl.misc:
> >> On Mon, 19 Apr 2004 14:38:38 +0100,
> >> "Connell Gauld" <connell@freebreakfast.co.uk> said:
>
> > Hey, Is there a way to open a port to an IP, send and
> > receive information. What I would like is something similar
> > to if you use telnet to open to an IP and port except that
> > the perl code has control.
>
> If you're doing something with a well-known protocol, there's
> almost certainly a module for it:
>
> http://search.cpan.org/
>
> Otherwise look at Net::Cmd and/or IO::Socket::INET
Also: Net::EasyTCP
Anno
------------------------------
Date: Tue, 20 Apr 2004 06:54:19 -0500
From: "JK" <jhalbrook@bjc.org>
Subject: Pattern matching question ...
Message-Id: <108a3qucngu5ofb@corp.supernews.com>
As I'm somewhat new to Perl, I'm having a problem with
a pattern matching section of code where I'm simply looking
for any occurrence of a URL, and converting that to a
hyperlink, i.e.
$link =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
$newurl =~ s/$link/<a href=\"$link\" target=\"_blank\">$link<\/a>/ig;
This works fine unless there are special characters in the
$link value, in which case the $newurl returns the same value
as $link.
I know there is probably some way to escape the $link value,
but not sure how.
Thank you, in advance.
Joe
------------------------------
Date: 20 Apr 2004 12:59:29 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Pattern matching question ...
Message-Id: <u91xmi2732.fsf@wcl-l.bham.ac.uk>
"JK" <jhalbrook@bjc.org> writes:
> As I'm somewhat new to Perl, I'm having a problem with
> a pattern matching section of code where I'm simply looking
> for any occurrence of a URL, and converting that to a
> hyperlink, i.e.
>
> $link =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
> $newurl =~ s/$link/<a href=\"$link\" target=\"_blank\">$link<\/a>/ig;
>
> This works fine unless there are special characters in the
> $link value, in which case the $newurl returns the same value
> as $link.
>
> I know there is probably some way to escape the $link value,
> but not sure how.
\Q
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 20 Apr 2004 12:47:37 GMT
From: axel@white-eagle.co.uk
Subject: Re: Pattern matching question ...
Message-Id: <JZ8hc.13$ID.9@pathologist.blueyonder.net>
Brian McCauley <nobull@mail.com> wrote:
> > As I'm somewhat new to Perl, I'm having a problem with
> > a pattern matching section of code where I'm simply looking
> > for any occurrence of a URL, and converting that to a
> > hyperlink, i.e.
> >
> > $link =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
> > $newurl =~ s/$link/<a href=\"$link\" target=\"_blank\">$link<\/a>/ig;
Surely you want a regular assignment without any spattern mattching
substitutions:
$newurl = "<a href=\"$link\" target=\"_blank\">$link<\/a>"
Axel
------------------------------
Date: Tue, 20 Apr 2004 13:15:11 +0200
From: =?ISO-8859-15?Q?S=E9bastien?= Cottalorda <sppNOSPAM@monaco377.com>
Subject: Pipes and non blocking writing
Message-Id: <40850640$0$17509$626a14ce@news.free.fr>
Hi all,
Several programs need to write in a pipe (created with "mknod /tmp/pipe.tub
p").
My problem is the following :
If no program read the other side of the pipe, all writing operations are
blocked.
I don't care if I lost information, but I'd like programs to try to write to
the pipe and return doing what they are programmed to.
Here is my program:
#====================================================================
#!/usr/bin/perl -w
use strict;
use Fcntl;
my $named_pipe='/tmp/pipe.tub';
unless (-e $named_pipe){
die "No way" if (system("/bin/mknod $named_pipe p"));
}
unless (sysopen(PIPE, $named_pipe, O_WRONLY|O_NONBLOCK)){
die "Can\'t open $named_pipe : $!";
}
while(1){
print "Trying to write in the pipe ...";
print PIPE "Heelo World\n";
print "Done\n";
sleep 3;
}
close(PIPE);
exit;
#=====================================================================
When I run that program, I get:
Can`t open pipe: Device not configured at line 10
What's wrong ????
My OS: Mandrake 7.1 (kernel 2.2.15-4mdk)
My Perl: perl 5.6.0
Thanks in advance for any kind of help.
Sébastien
--
[ retirer NOSPAM pour répondre directement
remove NOSPAM to reply directly ]
------------------------------
Date: 20 Apr 2004 11:42:53 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Pipes and non blocking writing
Message-Id: <c632bt$m3p$1@mamenchi.zrz.TU-Berlin.DE>
Sébastien Cottalorda <sppNOSPAM@monaco377.com> wrote in comp.lang.perl.misc:
> Hi all,
>
> Several programs need to write in a pipe (created with "mknod /tmp/pipe.tub
> p").
> My problem is the following :
> If no program read the other side of the pipe, all writing operations are
> blocked.
> I don't care if I lost information, but I'd like programs to try to write to
> the pipe and return doing what they are programmed to.
>
> Here is my program:
>
> #====================================================================
> #!/usr/bin/perl -w
>
> use strict;
> use Fcntl;
> my $named_pipe='/tmp/pipe.tub';
> unless (-e $named_pipe){
> die "No way" if (system("/bin/mknod $named_pipe p"));
> }
> unless (sysopen(PIPE, $named_pipe, O_WRONLY|O_NONBLOCK)){
> die "Can\'t open $named_pipe : $!";
> }
> while(1){
> print "Trying to write in the pipe ...";
> print PIPE "Heelo World\n";
> print "Done\n";
> sleep 3;
> }
> close(PIPE);
> exit;
> #=====================================================================
>
> When I run that program, I get:
> Can`t open pipe: Device not configured at line 10
>
> What's wrong ????
> My OS: Mandrake 7.1 (kernel 2.2.15-4mdk)
> My Perl: perl 5.6.0
Nothing is wrong, it's working to specification. A pipe can't be opened
for writing when there's no reader at the other end.
The solution is not to die when open() fails (why sysopen, btw?), but
do other things an try again later. It would also be a good idea to
install a SIGPIPE handler in case the reader disappears while you're
writing.
Anno
------------------------------
Date: Tue, 20 Apr 2004 14:23:32 +0200
From: =?ISO-8859-15?Q?S=E9bastien?= Cottalorda <sppNOSPAM@monaco377.com>
Subject: Re: Pipes and non blocking writing
Message-Id: <40851646$0$17506$626a14ce@news.free.fr>
Anno Siegel wrote:
> Sébastien Cottalorda <sppNOSPAM@monaco377.com> wrote in
> comp.lang.perl.misc:
>> Hi all,
>>
>> Several programs need to write in a pipe (created with "mknod
>> /tmp/pipe.tub p").
>> My problem is the following :
>> If no program read the other side of the pipe, all writing operations are
>> blocked.
>> I don't care if I lost information, but I'd like programs to try to write
>> to the pipe and return doing what they are programmed to.
>>
>> Here is my program:
>>
>> #====================================================================
>> #!/usr/bin/perl -w
>>
>> use strict;
>> use Fcntl;
>> my $named_pipe='/tmp/pipe.tub';
>> unless (-e $named_pipe){
>> die "No way" if (system("/bin/mknod $named_pipe p"));
>> }
>> unless (sysopen(PIPE, $named_pipe, O_WRONLY|O_NONBLOCK)){
>> die "Can\'t open $named_pipe : $!";
>> }
>> while(1){
>> print "Trying to write in the pipe ...";
>> print PIPE "Heelo World\n";
>> print "Done\n";
>> sleep 3;
>> }
>> close(PIPE);
>> exit;
>> #=====================================================================
>>
>> When I run that program, I get:
>> Can`t open pipe: Device not configured at line 10
>>
>> What's wrong ????
>> My OS: Mandrake 7.1 (kernel 2.2.15-4mdk)
>> My Perl: perl 5.6.0
>
> Nothing is wrong, it's working to specification. A pipe can't be opened
> for writing when there's no reader at the other end.
>
> The solution is not to die when open() fails (why sysopen, btw?), but
> do other things an try again later. It would also be a good idea to
> install a SIGPIPE handler in case the reader disappears while you're
> writing.
>
> Anno
Hi,
Thanks Ano,
that's helps me to solve my problem:
* intercepting SIGPIPE,
* bypassing open error,
* re-try to open again the pipe,
allow me to manage correctly my pipe.
thanks again.
Sébastien
--
[ retirer NOSPAM pour répondre directement
remove NOSPAM to reply directly ]
------------------------------
Date: 20 Apr 2004 12:24:08 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: regular expression module?
Message-Id: <u9ad1628pz.fsf@wcl-l.bham.ac.uk>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> Walter Roberson <roberson@ibd.nrc-cnrc.gc.ca> wrote in comp.lang.perl.misc:
> > I remember reading on this newsgroup, maybe about a year ago, of
> > a module that did a Finite State Machine implementation of "standard"
> > regular expressions -- i.e., just what can be built out of
> > concatenation, alternation, and repetition, (and perhaps
> > some syntactic sugar such as charactre-classes), without the perl
> > extensions that lift perl's regex's into a different parser class
> > entirely.
> >
> > Unfortunately, when I tried to find the posting again, I could
> > not, and I could not find anything like that in CPAN.
> >
> > The matter came to my mind again today when someone mentioned
> > the Yapp module and parsing speeds -- one of the points that
> > can really slow down perl's regexes is the backtracking that it
> > does.
>
> Backtracking is certainly not a Perl-specific addition. Any regular
> expression implementation must backtrack.
No, the OP is right - "standard" regular expressions can be done with
a Finite State Machine.
I don't, however, recall the thread.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 20 Apr 2004 11:47:09 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: regular expression module?
Message-Id: <c632jt$m3p$2@mamenchi.zrz.TU-Berlin.DE>
Brian McCauley <nobull@mail.com> wrote in comp.lang.perl.misc:
> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
>
> > Walter Roberson <roberson@ibd.nrc-cnrc.gc.ca> wrote in comp.lang.perl.misc:
> > > I remember reading on this newsgroup, maybe about a year ago, of
> > > a module that did a Finite State Machine implementation of "standard"
> > > regular expressions -- i.e., just what can be built out of
> > > concatenation, alternation, and repetition, (and perhaps
> > > some syntactic sugar such as charactre-classes), without the perl
> > > extensions that lift perl's regex's into a different parser class
> > > entirely.
> > >
> > > Unfortunately, when I tried to find the posting again, I could
> > > not, and I could not find anything like that in CPAN.
> > >
> > > The matter came to my mind again today when someone mentioned
> > > the Yapp module and parsing speeds -- one of the points that
> > > can really slow down perl's regexes is the backtracking that it
> > > does.
> >
> > Backtracking is certainly not a Perl-specific addition. Any regular
> > expression implementation must backtrack.
>
> No, the OP is right - "standard" regular expressions can be done with
> a Finite State Machine.
I may be confused, but I don't see the contradiction. The finite-state-
machine *does* the backtracking, no?
Anno
------------------------------
Date: Tue, 20 Apr 2004 12:32:44 +0000 (UTC)
From: Tom <t@REMOVETHISbrowse.to>
Subject: Re: Request for program test on different operating sytsems
Message-Id: <c6359b$8if$1@sparta.btinternet.com>
edgrsprj wrote...
>
> # For use with Windows XP
> #
> # If you are using Windows 98 or some other operating system:
> # Add # at the start of the first print line below.
> # Then if you are using Windows 98 remove the # at the start of
> # the second print line below.
> # If are not using either version of Windows then add # at the
> # start of the exec line below.
> open batfile, '> '.$directoryname.'Perltest.bat';
> print batfile 'c:\windows\start.exe '.$directoryname.'Perltest.txt';
> # print batfile 'c:\windows\start.exe '.$directoryname.'Perltest.txt';
> close batfile;
>
Are those print lines supposed to be the same?
FWIW start.exe is not a file on either my Win98 or Win2000
I doubt if it is in XP
it should be something like: %COMPSPEC% /c start ....
FYI on my system, that's E:\WINNT5\system32\CMD.EXE
(No C: Drive!)
in a batch file you could/should just use: start $file
HTH
------------------------------
Date: Tue, 20 Apr 2004 10:57:53 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Re: slurp not working? ideas please!
Message-Id: <4d0a80tn0o0i796dfqup3ajtc2l2tpu5s1@4ax.com>
On 20 Apr 2004 09:30:13 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:
>> print OUT ("<table width='100%' border='1'> \n");
>>
>> sub start {
>
>[rest of code snipped]
>
>I don't know what else wrong, but defining other subs inside a "wanted"
>routine for File::Find is certainly not something you want to do.
Anno
thanks for your reply ... but which part of the OOP code, if any,
would go in the Fiel::Find sub?
Cheers
Geoff
>
>Anno
------------------------------
Date: Tue, 20 Apr 2004 11:20:37 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Re: slurp not working? ideas please!
Message-Id: <8p1a80l4s2591ccv97d7t9r7canovi5irq@4ax.com>
On 20 Apr 2004 09:30:13 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:
>[rest of code snipped]
>
>I don't know what else wrong, but defining other subs inside a "wanted"
>routine for File::Find is certainly not something you want to do.
Anno
have taken all the other sub parts out of the File::Find sub but still
get same error!?
Geoff
>
>Anno
------------------------------
Date: 20 Apr 2004 11:24:01 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: slurp not working? ideas please!
Message-Id: <c6318h$gii$5@mamenchi.zrz.TU-Berlin.DE>
Geoff Cox <geoffacox@dontspamblueyonder.co.uk> wrote in comp.lang.perl.misc:
> On 20 Apr 2004 09:30:13 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
> Siegel) wrote:
>
> >> print OUT ("<table width='100%' border='1'> \n");
> >>
> >> sub start {
> >
> >[rest of code snipped]
> >
> >I don't know what else wrong, but defining other subs inside a "wanted"
> >routine for File::Find is certainly not something you want to do.
>
> Anno
>
> thanks for your reply ... but which part of the OOP code, if any,
> would go in the Fiel::Find sub?
I have no idea. Your code is too much of a mess to repair, so that
would amount to writing the program for you. This is something we
rarely do.
Anno
------------------------------
Date: Tue, 20 Apr 2004 08:19:32 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: slurp not working? ideas please!
Message-Id: <slrnc8a8r4.8qr.tadmc@magna.augustmail.com>
Geoff Cox <geoffacox@dontspamblueyonder.co.uk> wrote:
> I get error messages re "use of uninitialized value in
^^^^^^^^^^^^^^^
> pattern match"
That is *not* an "error message".
It is a "warning message".
There is a difference.
> The basic idea is that a series of html files in the oldshort2 folder
File::Find is for recursive directory searching.
You don't need it if the files are all in the same directory.
> open (OUT, ">>d:/a-keep9/short-nondb/short/members2/$name");
You should always, yes *always*, check the return value from open().
This has been pointed out to you before.
Do you actually read the followups to your posts?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 20 Apr 2004 12:55:34 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Re: slurp not working? ideas please!
Message-Id: <t96a80lbl4nu31j1vog509fl9v311kpolb@4ax.com>
On 20 Apr 2004 11:24:01 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:
.>> thanks for your reply ... but which part of the OOP code, if any,
>> would go in the Fiel::Find sub?
>
>I have no idea. Your code is too much of a mess to repair, so that
>would amount to writing the program for you. This is something we
>rarely do.
Anno,
hey! don't mind my feelings will you!!
I don't expect you to rewrite my code - just to point out, if you can,
why I am getting the particular error message, "use of uninitialized
value in pattern match at line (below)".
if ($next3 =~ /\$i\<(\d+);/) {
I am quite prepared to admit that the code is not very well written
but apart from this particular problem. it does work. I have left out
large parts of the code which do work ...
Cheers
Geoff
>
>Anno
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 6430
***************************************