[25207] in Perl-Users-Digest
Perl-Users Digest, Issue: 7453 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 26 18:11:01 2004
Date: Fri, 26 Nov 2004 15:10:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 26 Nov 2004 Volume: 10 Number: 7453
Today's topics:
POPL 2005 Call for Participation (David Walker)
Re: post into hash table <and11@rol.ru>
Re: post into hash table <see@sig.invalid>
Re: post into hash table <see@sig.invalid>
Re: post into hash table <tadmc@augustmail.com>
Re: post into hash table <noreply@gunnar.cc>
Re: post into hash table <noreply@gunnar.cc>
Question about implementing range operator with strings bayxarea-usenet@yahoo.com
recursive bruteforce ASCII range (bernd)
Re: recursive bruteforce ASCII range <and11@rol.ru>
Re: recursive bruteforce ASCII range <sbryce@scottbryce.com>
Re: recursive bruteforce ASCII range <tassilo.von.parseval@rwth-aachen.de>
Re: recursive bruteforce ASCII range <sbryce@scottbryce.com>
Re: Storing a substitution (similar to qr()) <apollock11@hotmail.com>
Re: Using embedded PERL with commercial applications? <tadmc@augustmail.com>
Re: Using files to transfer data between processes (Larry)
Re: Using files to transfer data between processes (Larry)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Nov 2004 10:28:43 -0800
From: dpw@cs.princeton.edu (David Walker)
Subject: POPL 2005 Call for Participation
Message-Id: <cd73c69.0411261028.5fde9801@posting.google.com>
POPL 2005 Call for Participation
32nd Annual ACM SIGPLAN - SIGACT
Symposium on Principles of Programming Languages
Long Beach, California
January 12-14, 2005
http://www.cs.princeton.edu/~dpw/popl/05/
Scope of the Conference
The annual Symposium on Principles of Programming Languages is a forum
for the discussion of fundamental principles and important innovations
in the design, definition, analysis, transformation, implementation
and verification of programming languages, programming systems, and
programming abstractions.
Important Dates
* Hotel reservation deadline: December 21, 2004
* Reduced fees deadline: December 30, 2004 (11:59 PM, EST USA)
- Register at http://www.regmaster.com/popl2005.html
* Main conference: January 12-14, 2005.
* Affiliated events: January 10-11 and January 15, 2005
Invited Speakers
* Pat Hanrahan (Stanford University)
* Rob Pike (Google): Interpreting the Data
* Peter Selinger (University of Ottawa): Programming Languages for
Quantum Computing
Location & Hotel
The POPL 2005 conference site is Hyatt Regency Long Beach, 200 South
Pine Avenue, Long Beach, CA. Complete information concerning how to
book rooms and travel to Long Beach may be found at the conference web
site (http://www.cs.princeton.edu/~dpw/popl/05/). The Hyatt Regency
is right next to a variety of entertainment areas, including the
Shoreline Village, the Rainbow Harbor, and the Shoreline Marina, which
offer sport fishing, boat rentals, personal boat rentals, shopping,
great food and other diversions. For those wishing to take in some
sun this January, one can walk east from the hotel, about a 1/4 mile,
along the Shoreline Marina, to a large, sandy, public beach. In
addition, the remarkable Aquarium of the Pacific, which houses more
than 12,500 animals and offers the possibility of coming face-to-face
or even touching the world's greatest predators, is only a 1/4 mile
west. On Thursday January 13th, we will be having a tour and banquet
on the Queen Mary ocean liner. Be sure to reserve your room by
December 21st, 2004 and register for the conference by December 30th,
2004.
Program
Wednesday, Jan 12
8:30AM -- 9:30AM: Invited talk: Interpreting the Data, Rob Pike
(Google)
10AM Session:
* Associated Types with Class
- Manuel Chakravarty, Gabriele Keller, Simon Peyton-Jones, Simon
Marlow
* Environmental Acquisition Revisited
- Richard Cobbe, Matthias Felleisen
* Polymorphic Bytecode: Compositional Compilation for Java-like
Languages
- Davide Ancona, Ferrucio Damiani, Sophia Drossopoulou, Elena Zucca
* A Simple Typed Intermediate Language for Object-Oriented Languages
- Juan Chen, David Tarditi
1:30PM Session:
* Parametric Polymorphism for XML
- Haruo Hosoya, Alain Frisch, Giuseppe Castagna
* A Bisimulation for Type Abstraction and Recursion
- Eijiro Sumii, Benjamin Pierce
* A Syntactic Approach to Eta Equality in Type Theory
- Healfdene Goguen
* Slot Games: A Quantitative Model of Computation
- Dan Ghica
4PM Session:
* Synthesis of Interface Specifications for Java Classes
- Rajeev Alur, Pavol Cerny, P. Madhusudan, Wonhong Nam
* Dynamic Partial-Order Reduction for Model Checking Software
- Cormac Flanagan, Patrice Godefroid
* Proof-Guided Underapproximation-Widening for Multi-Process Systems
- Orna Grumberg, Flavio Lerda, Ofer Strichman, Michael Theobald
* Transition Predicate Abstraction and Fair Termination
- Andreas Podelski, Andrey Rybalchenko
6PM: Business meeting / PC report
Thursday, Jan 13
8:30AM: Invited talk: Programming Languages for Quantum Computing,
Peter Selinger (University of Ottawa)
10AM Session:
* Communicating Quantum Processes
- Simon Gay, Rajagopal Nagarajan
* Downgrading Policies and Relaxed Noninterference
- Peng Li, Steve Zdancewic
* A Probabilistic Language Based Upon Sampling Functions
- Sungwoo Park, Frank Pfenning, Sebastian Thrun
* Mutatis Mutandis: Safe and Predictable Dynamic Software Updating
- Gareth Stoyle, Michael Hicks, Gavin Bierman, Peter Sewell, Iulian
Neamtiu
1:30PM Session:
* Transactors: A Programming Model for Maintaining Globally Consistent
Distributed State in Unreliable Environments
- John Field, Carlos Varela
* Theoretical Foundations for Compensations in Flow Composition
Languages
- Roberto Bruni, Hernan Melgratti, Ugo Montanari
* From Sequential Programs to Multi-Tier Applications by Program
Transformation
- Matthias Neubauer, Peter Thiemann
* Combinators for Bi-Directional Tree Transformations: A Linguistic
Approach to the View Update Problem
- Nathan Foster, Michael Greenwald, Jonathan Moore, Benjamin Pierce,
Alan Schmitt
4:30PM: Tour and conference dinner on the Queen Mary ocean liner
Friday, Jan 14
8:30AM: Invited talk, Pat Hanrahan (Stanford University)
10AM Session:
* Separation Logic and Abstraction
- Matthew Parkinson, Gavin Bierman
* Permission Accounting in Separation Logic
- Richard Bornat, Cristiano Calcagno, Peter O'Hearn, Matthew
Parkinson
* Context Logic and Tree Update
- Cristiano Calcagno, Philippa Gardner, Uri Zarfaty
* Connecting Effects and Uniqueness with Adoption
- John Tang Boyland, William Retert
1:30PM Session:
* A Semantics for Procedure-Local Heaps and its Abstractions
- Noam Rinetzky, Jrg Bauer, Thomas Reps, Mooly Sagiv, Reinhard
Wilhelm
* Region-Based Shape Analysis with Tracked Locations
- Brian Hackett, Radu Rugina
* Precise Interprocedural Analysis using Random Interpretation
- Sumit Gulwani, George Necula
* Numeric Analysis of Array Operations
- Denis Gopan, Thomas Reps, Mooly Sagiv
4PM Session:
* Scalable Error Detection using Boolean Satisfiability
- Yichen Xie, Alex Aiken
* Automated Soundness Proofs for Dataflow Analyses and Transformations
via Local Rules
- Sorin Lerner, Todd Millstein, Erika Rice, Craig Chambers
* The Java Memory Model
- Jeremy Manson, William Pugh, Sarita Adve
Program Chair:
Martn Abadi
University of California, Santa Cruz
Computer Science Department
Santa Cruz, CA 95064
E-mail: abadi@cs.ucsc.edu
General Chair:
Jens Palsberg
University of California, Los Angeles
Computer Science Dept,
4531K Boelter Hall,
Los Angeles, CA 90095
Phone: 310-825-6320
Fax: 310-794-5057
E-mail: palsberg@ucla.edu
Program Committee:
Martn Abadi, UC Santa Cruz (chair)
Rastislav Bodik, UC Berkeley
Perry Cheng, IBM (T.J. Watson Research Center)
William Cook, UT Austin
Michael Ernst, MIT
Giorgio Ghelli, Universit di Pisa
Yossi Gil, Technion
Ralf Hinze, Universitt Bonn
Martin Hofmann, Ludwig-Maximilians-Universitt Mnchen
Alan Jeffrey, Bell Labs, Lucent / DePaul University
Andrew Kennedy, Microsoft Research (Cambridge)
Naoki Kobayashi, Tohoku University
Julia Lawall, University of Copenhagen
Andrew Myers, Cornell University
Gordon Plotkin, University of Edinburgh
Franois Pottier, INRIA (Rocquencourt)
Sriram Rajamani, Microsoft Research (Redmond)
John Reppy, University of Chicago
Zhong Shao, Yale University
Henny Sipma, Stanford University
Treasurer:
Manuel Fhndrich
Publicity:
David Walker
------------------------------
Date: Fri, 26 Nov 2004 19:52:00 +0000
From: Andrew Tkachenko <and11@rol.ru>
Subject: Re: post into hash table
Message-Id: <co7n3t$n8a$1@news.rol.ru>
Bremse wrote on 26 Ноябрь 2004 14:53:
> I'm trying to put values (from form) posted by post method into hash
> table, but all entries after code execution are empty (i.e.
> $FORM_DATA{$forename} equals ""). Why?
>
>
> read(STDIN,$query,$ENV{'CONTENT_LENGTH'});
> @kv_pairs = split(/\&/, $query);
> foreach $key_value (@kv_pairs)
> {
> ($key, $value) = split ( /\=/, $key_value);
> $value =~ tr/+/ /;
> $value =~ s/%([\dA-Fa-f][\dA-Fa-f])/chr(hex($1))/eg;
> $FORM_DATA{$key} = $value;
> }
>
> What's wrong?
>
i guess you should try to avoid parsing query strings by youself since
this usually leads to hidden errs. Since CGI.pm present in all perl
distributions you'd better use code below (not tested):
use strict;
use warnings;
use CGI qw(:standard);
my %FORM_DATA;
for my $key (param) {
$FORM_DATA{$key} = param($key);
}
--
Andrew
------------------------------
Date: Fri, 26 Nov 2004 13:16:51 -0500
From: Bob Walton <see@sig.invalid>
Subject: Re: post into hash table
Message-Id: <41a77099$1_1@127.0.0.1>
Bremse wrote:
> I'm trying to put values (from form) posted by post method into hash
POST---------------------------------------------^^^^
> table, but all entries after code execution are empty (i.e.
> $FORM_DATA{$forename} equals ""). Why?
>
>
> read(STDIN,$query,$ENV{'CONTENT_LENGTH'});
> @kv_pairs = split(/\&/, $query);
---------------------^
& is not a metacharacter, so there is no reason to escape it.
> foreach $key_value (@kv_pairs)
> {
> ($key, $value) = split ( /\=/, $key_value);
------------------------------------------^
= is not a metacharacter, so there is no reason to escape it.
> $value =~ tr/+/ /;
> $value =~ s/%([\dA-Fa-f][\dA-Fa-f])/chr(hex($1))/eg;
> $FORM_DATA{$key} = $value;
> }
>
> What's wrong?
>
One possibility: The query string could use the ; character to separate
key-value pairs rather than the & character (either is permitted and
possibly generated by a web server). If you:
use CGI;
you won't have such problems, plus your CGI scripts will be a lot less work.
Another possibility: Maybe the query string returned has empty values
for the keys. Did you print out the query string to see what is in it?
Since the values are empty strings rather than undef, I would suppose
the keys are actually present in the query string. Or did you check to
see if they are empty versus undef?
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Fri, 26 Nov 2004 13:48:27 -0500
From: Bob Walton <see@sig.invalid>
Subject: Re: post into hash table
Message-Id: <41a77800$1_3@127.0.0.1>
Dimitri Papoutsis wrote:
> Bremse wrote:
...
> Try this:
> Just copy and use it...
Oh, please. At least *try* and run your code before posting it...
>
> sub getFormularFields{
> if($ENV{'REQUEST_METHOD'} eq 'GET'){
> $Data = $ENV{'QUERY_STRING'}
Making package globals in a sub. *Please* use my().
> }
> else{
> read(STDIN, $Data, $ENV{'CONTENT_LENGTH'});
> }
What if it was another method, say the HEAD method?
>
>
> my @FormularFields = split(/&/, $Daten);
------------------------------------------^^^^^^
was that supposed to be $Data? $Daten hasn't been defined in your code.
Also, this will fail to work properly if the query string has
key-value pairs separated by the ; character rather than the & character.
> foreach my $Field (@FormularFields)
> {
> ($name, $value) = split(/=/, $Field);
> $value =~ tr/+/ /;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> $value =~ s/<!--(.|\n)*-->//g;
Why would you want to remove stuff that looks vaguely like HTML
commentary from a query string? The content of a query string is not
necessarily HTML (and usually isn't). And anyway, this will remove
everything from the first start-of-comment through the last
end-of-comment, rather than just all the comments as is apparently
intended. And rather than the alternation shown, the /s switch should
be used.
> ${$name} = $value;
Oh, puke. Making symbolic references in the global namespace. What
about if the key was 'name', for example, as in
http://whatever.com?name=Dimitry
? Or any package global used by the caller? Not to mention the
security issue -- you just gave a hacker the ability to set any package
global to anything the hacker wants.
> $Formular{$name}=$value;
> }
> return %Formular;
> }
>
> bye
> dnp
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Fri, 26 Nov 2004 13:02:20 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: post into hash table
Message-Id: <slrncqevds.45v.tadmc@magna.augustmail.com>
Dimitri Papoutsis <bastard@uni-koblenz.de> wrote:
> Just copy and use it...
I strongly urge all readers to not do as asked there.
Use a module for parsing form parameters.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 26 Nov 2004 20:55:03 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: post into hash table
Message-Id: <30pgc8F307s89U1@uni-berlin.de>
Bob Walton wrote:
> Bremse wrote:
>> I'm trying to put values (from form) posted by post method into hash
>
> One possibility: The query string could use the ; character to separate
> key-value pairs rather than the & character (either is permitted and
> possibly generated by a web server).
The query string is probably empty, since it's a form submission via the
POST method, and forms always use & as the separator.
> Another possibility: Maybe the query string returned has empty values
----------------------------------^^^^^^^^^^^^
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 26 Nov 2004 20:55:11 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: post into hash table
Message-Id: <30pgcfF307s89U2@uni-berlin.de>
Bremse wrote:
> I'm trying to put values (from form) posted by post method into hash
> table, but all entries after code execution are empty (i.e.
> $FORM_DATA{$forename} equals ""). Why?
Maybe because there is no $forename variable? Do you mean
$FORM_DATA{forename} ?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 26 Nov 2004 12:55:16 -0800
From: bayxarea-usenet@yahoo.com
Subject: Question about implementing range operator with strings
Message-Id: <1101502516.198238.204570@f14g2000cwb.googlegroups.com>
I had a routine that worked fine with a range operator while looping
through a filehandle... but I have since changed the data source and it
is now already in an array... and the range operator does not appear to
be working...
I am basically extracting lines of data from a larger set.
--------------------
before -------------
open(IN,"< $file");
while (<IN>) {
if (/$start_string/ .. /$end_string/) {
if (($_ !~ /$start_string/) && ($_ !~ /$end_string/)) {
...
... do something with $_ ...
...
} # end if
} # end if
} # end while
close IN;
--------------------
now -------------
@data_from_file; # lines of data retrieved elsewhere
foreach (@data_from_file) {
if (/$start_string/ .. /$end_string/) {
if (($_ !~ /$start_string/) && ($_ !~ /$end_string/)) {
...
... do something with $_ ...
...
} # end if
} # end if
} # end foreach
Also -- there are now multiple places within the @data_from_file array
that I want to extract the data for which I am searching.
So want to be able to go inside (between the start and end strings)
each time the pair occurs within the array.
I thought of using something like this:
while ($_ = shift @data_from_file) {
if (/$start_string/ .. /$end_string/)
...
... etc
but it did not work either.
After reading the docs I thought perhaps a slice would work - but I am
not sure how to tie the range to the elements of the array.
@data_I_want = (/$start_string/ .. /$end_string/) # ????
Thanks for any clues as to how to change this to work from a while loop
on the file handle to looping through each element of the array.
And - as I mentioned - I need to do this multiple times as the block I
am searching for will occur several times - so ... multiple slices on
the same array? Is that possible?
Thanks,
John
------------------------------
Date: 26 Nov 2004 08:50:27 -0800
From: bernd@thebc.ch (bernd)
Subject: recursive bruteforce ASCII range
Message-Id: <b741babc.0411260850.157063a1@posting.google.com>
#!/usr/bin/perl -w
#
# hy group
#
# i feel really stupid. could it be that hard?
#
# i try to write a script to bruteforce the ASCII range. something
# like:
#
# a..z
# aa..zz
# aaa..zzz
# ...
#
# but there must be a smarter, solution than writing the same stuff
# over and over again. i'd tried some recursive stuff but failed.
#
# any help really appreciated!
#
# greez bernd (who just didn't see the solution)
use strict;
# one character
foreach my $a ('a'..'z','0'..'9') {
print "$a\n";
}
# two character
foreach my $a ('a'..'z','0'..'9') {
foreach my $b ('a'..'z','0'..'9') {
print "$a$b\n";
}
}
# tree character
foreach my $a ('a'..'z','0'..'9') {
foreach my $b ('a'..'z','0'..'9') {
foreach my $c ('a'..'z','0'..'9') {
print "$a$b$c\n";
}
}
}
# n character ???
------------------------------
Date: Fri, 26 Nov 2004 21:10:37 +0000
From: Andrew Tkachenko <and11@rol.ru>
Subject: Re: recursive bruteforce ASCII range
Message-Id: <co7rna$oa4$1@news.rol.ru>
bernd wrote on 26 Ноябрь 2004 16:50:
> #!/usr/bin/perl -w
> #
> # hy group
> #
> # i feel really stupid. could it be that hard?
> #
> # i try to write a script to bruteforce the ASCII range. something
> # like:
> #
> # a..z
> # aa..zz
> # aaa..zzz
> # ...
> #
> # but there must be a smarter, solution than writing the same stuff
> # over and over again. i'd tried some recursive stuff but failed.
> #
> # any help really appreciated!
> #
> # greez bernd (who just didn't see the solution)
>
> use strict;
>
> # one character
> foreach my $a ('a'..'z','0'..'9') {
> print "$a\n";
> }
>
> # two character
> foreach my $a ('a'..'z','0'..'9') {
> foreach my $b ('a'..'z','0'..'9') {
> print "$a$b\n";
> }
> }
>
> # tree character
> foreach my $a ('a'..'z','0'..'9') {
> foreach my $b ('a'..'z','0'..'9') {
> foreach my $c ('a'..'z','0'..'9') {
> print "$a$b$c\n";
> }
> }
> }
>
> # n character ???
You may try to play with Algorithm::GenerateSequence.
use Algorithm::GenerateSequence;
my $len = 3; #sequence length
my $gen = Algorithm::GenerateSequence->new(
map {['a' .. 'z', 0 .. 9]} (0 .. $len)
);
local $" = "";
while(my @c = $gen->next) {
print "@c\n";
}
--
Andrew
------------------------------
Date: Fri, 26 Nov 2004 12:07:31 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: recursive bruteforce ASCII range
Message-Id: <10qevnaml4opk34@corp.supernews.com>
bernd wrote:
> # three character
> foreach my $a ('a'..'z','0'..'9') {
> foreach my $b ('a'..'z','0'..'9') {
> foreach my $c ('a'..'z','0'..'9') {
> print "$a$b$c\n";
> }
> }
> }
>
> # n character ???
You mean like this? I don't see the point, so I'm not sure this is what
you want to do.
use strict;
use warnings;
my $max = 5;
foreach my $count (1 .. $max)
{
foreach my $char ('a'..'z','0'..'9')
{
print $char x $count, "\n";
}
}
------------------------------
Date: Fri, 26 Nov 2004 20:17:45 +0100
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: recursive bruteforce ASCII range
Message-Id: <slrncqf0ap.v3.tassilo.von.parseval@localhost.localdomain>
Also sprach bernd:
> #!/usr/bin/perl -w
> #
> # hy group
> #
> # i feel really stupid. could it be that hard?
> #
> # i try to write a script to bruteforce the ASCII range. something
> # like:
> #
> # a..z
> # aa..zz
> # aaa..zzz
> # ...
> #
> # but there must be a smarter, solution than writing the same stuff
> # over and over again. i'd tried some recursive stuff but failed.
No need for recursion. Perl can do it for you.
> # any help really appreciated!
> #
> # greez bernd (who just didn't see the solution)
>
> use strict;
>
> # one character
> foreach my $a ('a'..'z','0'..'9') {
> print "$a\n";
> }
print join "\n", 'a'..'z', '0'..'9';
> # two character
> foreach my $a ('a'..'z','0'..'9') {
> foreach my $b ('a'..'z','0'..'9') {
> print "$a$b\n";
> }
> }
The values '0a' to '9z' are a bit annoying as one can't rely on Perl's
string auto-increment.
print join "\n", 'aa'..'zz',
'a0'..'a9';
map { my $a = $_; map { "$a$_" } 'a'..'z' } '0'..'9';
'00'..'99';
> # tree character
> foreach my $a ('a'..'z','0'..'9') {
> foreach my $b ('a'..'z','0'..'9') {
> foreach my $c ('a'..'z','0'..'9') {
> print "$a$b$c\n";
> }
> }
> }
Naturally, it gets longer and more annoying for three letter ranges.
> # n character ???
You don't really need recursion. What you need is a function that
generates the next string item, so something that turns 'zz' into 'z0',
'99' into 'aaa' etc. So a program could look thusly:
sub next_item {
my ($i, $tail) = shift;
if (substr($i, -1, 1) eq 'z') {
substr($i, -1, 1, '0');
return $i;
}
if ($i =~ /^9+$/) {
return 'a' x (length($i)+1);
}
if (substr($i, -1, 1) eq '9') {
chop($i);
$i = next_item($i) . 'a';
return "$i";
}
if ($i =~ /\d.*[a-z]/) {
substr($i, -1, 1)++;
return $i;
}
return ++$i;
}
my $item = "a";
while ($item ne '999') {
print $item, "\n";
$item = next_item($item);
}
next_item() is slightly recursive, though. The recursion is used for the
case that an item ends on '9' in which case you get a carrier that
ripples from right to left until a character other than '9' is found.
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: Fri, 26 Nov 2004 12:27:51 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: recursive bruteforce ASCII range
Message-Id: <10qf0teri163c0e@corp.supernews.com>
After seeing Tassilo's solution, I re-read your post. What I posted
doesn't do what you want it to do.
------------------------------
Date: Fri, 26 Nov 2004 14:08:09 -0800
From: Arvin Portlock <apollock11@hotmail.com>
Subject: Re: Storing a substitution (similar to qr())
Message-Id: <co89ga$12og$1@agate.berkeley.edu>
> Tad McClellan <tadmc@augustmail.com> wrote:
> >my $match = 'I saw (.*) and (.*)';
> >my $repl = 'I saw $2 and $1';
> >my $regexp = qr($match);
> >$example =~ s/$regexp/$repl/;
>
> my $repl = '"I saw $2 and $1"';
> ^ ^ note the quotes
> ...
> $example =~ s/$regexp/$repl/ee;
I've never seen 'ee' at the end of a substitution before.
It's contained in an example in perlop but without any
explanation as far as I can find.
Although your example worked I haven't managed to get
it to work in my particular situation, where a list of
these substitutions are read in from a text file. In fact,
even if I got it to work I'm not sure I could use it be-
cause of the 'e' there (I'm concerned about executing
malicious code). But still I wonder how I could get it to
work in the example below (where a small here-document
replicates the external text file):
my $example = 'I saw Bob and Alice';
my $user_subs =<<'EOF';
/I saw (.*) and (.*)/I saw $2 and $1/
/I saw (.*) and (.*)/$1 and $2 saw me/
EOF
my @user_subs = split (/\n/, $user_subs);
my @substitutions;
foreach my $user_sub (@user_subs) {
$user_sub =~ s/^\///;
$user_sub =~ s/\/$//;
my ($match, $replace) = split (/\//, $user_sub);
my $pattern = {};
$pattern->{match} = $match;
$pattern->{replace} = $replace;
push @substitutions, $pattern;
}
foreach my $pattern (@substitutions) {
my $match = $pattern->{match};
my $replace = $pattern->{replace};
$example =~ s/$match/$replace/ee;
}
print "$example\n";
------------------------------
Date: Fri, 26 Nov 2004 12:54:38 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Using embedded PERL with commercial applications?
Message-Id: <slrncqeuve.3rp.tadmc@magna.augustmail.com>
[ Followups set ]
Spam <spamcollector@sympatico.ca> wrote:
> Why could not someone embed a lex/yacc based perl interpreter or compiler
> in an application?
Because parsing Perl is not truly LALR(1).
> Perl syntax is not rocket science.
*Parsing* Perl syntax _is_ rocket science.
Are you familiar with perl's internals?
Try this in a perl source directory and peek at the code around the hits:
grep -i intuit *.h *.c
The lexer and parser do a whole lot of guessing to disambiguate things.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 26 Nov 2004 09:39:00 -0800
From: lada77@yahoo.com (Larry)
Subject: Re: Using files to transfer data between processes
Message-Id: <386d5f25.0411260939.541fb50f@posting.google.com>
>
> There is a perl document called perlipc dedicated to this subject so
> that seems a fair place to start. mandoc perlipc is supposed to give
> you said document on any system with perl installed.
>
>
Thanks for the response Villy. I've actually gone through this man
page and it doesn't really help much as i'm trying to use a disk file
as a FIFO pipe between two processes. I'm hoping that a simple
solution exists but I may have to resort to having my receiving
process fork off a child reader who's dedicated to monitoring the file
and then forwarding that information via a pipe to its parent. This
just complicates things and I was hoping for a simpler solution.
------------------------------
Date: 26 Nov 2004 13:00:28 -0800
From: lada77@yahoo.com (Larry)
Subject: Re: Using files to transfer data between processes
Message-Id: <386d5f25.0411261300.2cf69ef6@posting.google.com>
K,
Never mind as I think i have a solution for this. I guess we can't
get around resetting the eof marker and polling the file to read a
file that is growing. I'll just have the process that updates the
file send a signal (or communicate via a socket) to the reading
process that there is data available to read so that I can avoid
having to poll for updates.
------------------------------
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 7453
***************************************