[11210] in Perl-Users-Digest
Perl-Users Digest, Issue: 4810 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 2 20:07:16 1999
Date: Tue, 2 Feb 99 17:00:18 -0800
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, 2 Feb 1999 Volume: 8 Number: 4810
Today's topics:
Re: ancestry of perl features (Larry Rosler)
Re: are regular expression rationaly designed ? (Bart Lateur)
Re: are regular expression rationaly designed ? <uri@ibnets.com>
Re: Bath.pm-ish Meetings (Adam Turoff)
Re: Can "push" be used on anonymous arrays - syntax hel <aqumsieh@matrox.com>
END blocks for subs? (Marc Haber)
explanation of a regular expression question PETER@yaleads.ycc.yale.edu
Re: explanation of a regular expression question <palincss@his.com>
Re: explanation of a regular expression question (M.J.T. Guy)
Re: help: perl scripting on .org group remnants@my-dejanews.com
Re: How can I use HTML code in PERL? <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: London, highly skilled perl programmer required <gellyfish@btinternet.com>
Re: Pass username and password with a cgi-perl script <beske@worldnet.att.net>
Re: Perl Criticism (Sam Holden)
Re: Perl programmers needed in London <gellyfish@btinternet.com>
Re: Perl syntax ( URGENT ) <aqumsieh@matrox.com>
problem forking with perl: child sometimes dies k2k2@my-dejanews.com
Re: Regex for e-mail addresses? <wade@cs.ualberta.ca>
Re: Regex for e-mail addresses? <rra@stanford.edu>
replacing non-printable characters <andrewf@beausys.demon.co.uk>
Shared library and Perl hoangngo@usa.net
Re: STDOUT redirect on NT <revjack@radix.net>
tie, hash problem <andrewf@beausys.demon.co.uk>
Re: What characters are illegal in referer strings? <aqumsieh@matrox.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 2 Feb 1999 16:05:11 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: ancestry of perl features
Message-Id: <MPG.112132941400ff3e9899fa@nntp.hpl.hp.com>
In article <797j8e$kdu$1@nnrp1.dejanews.com> on Tue, 02 Feb 1999
19:22:02 GMT, droby@copyright.com <droby@copyright.com> says...
> > Larry Rosler <lr@hpl.hp.com> wrote in article
> > <MPG.111027517359d2ef9899b2@nntp.hpl.hp.com>...
> > > In article <393e5531xn.fsf@ibnets.com> on 20 Jan 1999 19:27:32 -0500,
> > > Uri Guttman <uri@ibnets.com> says...
> > > > i have been pondering perl's ancestry and for curiosity's sake i have
> > > > been thinking about which languages (if any) influenced various perl
> > > > feature.
> > ...
> > > > statement modifiers perl?
> > >
> > LR> I believe Snobol, but it's been SOOOO long!
I've looked back at a bit of Snobol. What I remembered as postfixed
statement modifiers (do something if condition) are actually post-
statement transfer decisions (do something, and on success/failure, go
somewhere else).
So I still don't know where the postfixed statement modifiers come from.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 02 Feb 1999 21:12:37 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: are regular expression rationaly designed ?
Message-Id: <36b86858.1538559@news.skynet.be>
olivier_pelletier@my-dejanews.com wrote:
>I would like to know if there is a theory hidden behind regular expression
>matching ? Could anyone point me out a link to a document explaining this
>theory if it exists ? In particular can any pattern be matched by a regular
>expression ?
It's part of the course if you're learning about compilers. I think
regexen fall under the part of "finite automata". So yes, any decent
theoretical book about compilers should discuss the theory.
Can any pattern be matched? Only regexes and some extensions on them.
Perl regexes have a built-in memory (for submatches), which theoretical
regexes do not. But, OTOH, Perl regexes do not contain a stack, so it is
not possible (yet?) to check recursively declared patterns. Those fall
under "grammars" (but I'm not sure if they have to be "context free").
As for online documentation: maybe you should look at:
http://reference.perl.com/query.cgi?regexp+index
HTH,
Bart.
------------------------------
Date: 02 Feb 1999 17:03:52 -0500
From: Uri Guttman <uri@ibnets.com>
Subject: Re: are regular expression rationaly designed ?
Message-Id: <394sp4foon.fsf@ibnets.com>
>>>>> "IZ" == Ilya Zakharevich <ilya@math.ohio-state.edu> writes:
>> if (/\Qmain(){while(1);}/) { print "This program loops forever!\n";
>> }
IZ> This matches
IZ> #ifdef LINUX main(){while(1);} #else main(){return 1;} #endif
IZ> and does not match many other loopers.
ilya,
he was pulling your leg and commenting on your statement below. if you
had said "ALL correct C" you would have been more accurate. his regex
matches A correct C looper.
uri
>> decidable, >they can do it. They cannot recognize a correct C
>> program which loops >forever. ;-)
--
Uri Guttman Hacking Perl for Ironbridge Networks
uri@sysarch.com uri@ironbridgenetworks.com
------------------------------
Date: 2 Feb 1999 19:50:39 -0500
From: ziggy@panix.com (Adam Turoff)
Subject: Re: Bath.pm-ish Meetings
Message-Id: <7986gv$20f$1@panix.com>
Leon Brocard <leon@netcraft.com> wrote:
>brian d foy wrote:
>
>> now, just how many groups do you plan on starting? ;)
>
>Actually, I was thinking of doing it alphabetically: Amsterdam.pm,
>Bath.pm, ....... Hmmmm, where shall I move to next? Any suggestions /
>job offers in Cairo? ;-)
Cairo.pm is nice in that it'll finally establish mongers in Africa,
leaving one continent to go (RossIceShelf.pm anyone?).
I think that starting Cork.pm and Dublin.pm would be nicer, though.
More interesting local beverages for visiting mongers, not to mention
being more convenient when you meet with all of the *.pm's that you've
started, Leon. :-)
Z.
------------------------------
Date: Tue, 2 Feb 1999 14:18:35 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
To: Brett Randall <brett_s_r@hotmail.com>
Subject: Re: Can "push" be used on anonymous arrays - syntax help?
Message-Id: <x3yd83smx6d.fsf@tigre.matrox.com>
Brett Randall <brett_s_r@hotmail.com> writes:
[snip]
> push(@rows, [@fields]);
[snip]
> --- start code snip ---
> push(@$sorted_rows->[0], $new_field);
> --- end code snip ---
>
> to which I get the compilation error :-
>
> Type of arg 1 to push must be array (not array element)
>
> However, I can print $$sorted_rows[0] . "\n";, which displays
> ARRAY(0x80c48d0) (an anonymous array?).
>
> Can anyone please help?
Your problem is precedence. The statement @$sorted_rows->[0] is
actually seen as {@$sorted_rows}->[0] (note, this is not valid Perl
code). So the reference $sorted_rows is dereferenced *FIRST*, and the
first element is extracted, which is a reference to an array.
What you want is to resolve this ambiguity using braces:
push @{$sorted->[0]} => $new_field;
this should do the trick.
HTH,
Ala
------------------------------
Date: Tue, 02 Feb 1999 23:10:33 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: END blocks for subs?
Message-Id: <7980l9$am0$2@news.rz.uni-karlsruhe.de>
Hi!
Given is the following code transcribed from a C program:
|sub test
|{
|
| unless( open FH, "<$configFile" )
| {
| message(MESS_ERROR, "failed to open config file $configFile: $!\n");
| return 1;
| }
|
| unless( !-f FH)
| {
| message(MESS_DEBUG, "Ignoring $configFile because it's not a regular file.\n");
| close FH;
| return 1;
| }
|
| do something else
| return 0;
|}
This doesn't look very perlish. Especially taking care about the file
being closed in the second unless statement doesn't strike me as being
a perlism. If this were a standalone program, I'd establish an END
block to close the file after closing. Do I have such a mechanism
available for subs too?
Would eval be a better way to code this? How would a perl wizard do
this?
Any hints will be appreciated.
Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Karlsruhe, Germany | Beginning of Wisdom " | Fon: *49 721 966 32 15
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29
------------------------------
Date: Tue, 02 Feb 99 18:10:41 EST
From: PETER@yaleads.ycc.yale.edu
Subject: explanation of a regular expression question
Message-Id: <182D9FFA1S86.PETER@yaleads.ycc.yale.edu>
Hi. This post has a slightly different twist. I have a regular expression
that works correctly, but I don't understand one small part of it.
The following regular expression works for trimming leading and trailing
blanks from a string.
/^\s*(.*?)\s*$/;
I don't understand the necessity of having the "?" in there. I would think
that the (.*) would be sufficient. Would someone kindly explain to me in
'english' what the (.*?) means/does? And I don't mean: "any character except
newline, 0 or more times, zero or once". Thanks. I would be really grateful
as I'm trying to understand how the "*" followed by the "?" interact.
- peter
------------------------------
Date: Tue, 02 Feb 1999 18:30:52 -0500
From: Steve Palincsar <palincss@his.com>
Subject: Re: explanation of a regular expression question
Message-Id: <36B78AAC.7748A278@his.com>
? after the * makes the match stingy rather than greedy. Since
. matches any character including a space, if the .*? were greedy
it would suck up all the rest of the string -- since the \s*$
would match zero whitespace characters at the end of the string.
PETER@yaleads.ycc.yale.edu wrote:
>
> Hi. This post has a slightly different twist. I have a regular expression
> that works correctly, but I don't understand one small part of it.
> The following regular expression works for trimming leading and trailing
> blanks from a string.
> /^\s*(.*?)\s*$/;
> I don't understand the necessity of having the "?" in there. I would think
> that the (.*) would be sufficient. Would someone kindly explain to me in
> 'english' what the (.*?) means/does? And I don't mean: "any character except
> newline, 0 or more times, zero or once". Thanks. I would be really grateful
> as I'm trying to understand how the "*" followed by the "?" interact.
>
> - peter
------------------------------
Date: 3 Feb 1999 00:17:13 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: explanation of a regular expression question
Message-Id: <7984i9$oc8$1@pegasus.csx.cam.ac.uk>
<PETER@yaleads.ycc.yale.edu> wrote:
>Hi. This post has a slightly different twist. I have a regular expression
>that works correctly, but I don't understand one small part of it.
>The following regular expression works for trimming leading and trailing
>blanks from a string.
> /^\s*(.*?)\s*$/;
>I don't understand the necessity of having the "?" in there.
Have you tried it without the "?" ? The results should make it obvious.
And that's a rather bad way to do the job. perlfaq4 knows better:
"How do I strip blank space from the beginning/end of a string?"
Mike Guy
------------------------------
Date: Tue, 02 Feb 1999 23:27:12 GMT
From: remnants@my-dejanews.com
Subject: Re: help: perl scripting on .org group
Message-Id: <7981k5$296$1@nnrp1.dejanews.com>
> I am looking for help in developing the site and am looking for
> a Perl programmer to help me with some short routines. The
> script would capture the visitors time,date,domain,IP and email.
Excluding email, the information you're looking for is redundant as your
server should *ALREADY* be 'capturing' the date/time of all requests,
along with the associated IP and/or hostname, the file they viewed, etc.
-qr
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 03 Feb 1999 00:34:50 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: How can I use HTML code in PERL?
Message-Id: <83iudk2xd1.fsf@vcpc.univie.ac.at>
Re: How can I use HTML code in PERL?, blazek
<blazek@sisblansko.cz> said:
blazek> I have Drop-Down Menu in HTML language like
blazek> this. <select name="D1" size="1"> <option
blazek> value="1">a</option> <option
blazek> value="2">b</option> </select>
blazek> HTML code into PERL program but how I can
blazek> test user`s choice in PERL program?
enlightenment = perldoc CGI
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien. | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: 2 Feb 1999 23:11:31 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: London, highly skilled perl programmer required
Message-Id: <7980n3$ok$1@gellyfish.btinternet.com>
On Sun, 31 Jan 1999 12:34:22 GMT danny@dircon.co.uk wrote:
> A special job is available for you if you are a talented perl
> programmer.
>
I have forwarded this to the London.pm mailing list.
Not to over egg the thing but these posts are better off in some jobs.*
newsgroup or if you want to send London jobs to:
owner-london-list@hfb.pm.org
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 3 Feb 1999 00:47:54 GMT
From: Bryan Beske <beske@worldnet.att.net>
Subject: Re: Pass username and password with a cgi-perl script
Message-Id: <36B79C44.8E978310@worldnet.att.net>
Use the http module to generate the accesses.
------------------------------
Date: 3 Feb 1999 00:53:09 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl Criticism
Message-Id: <slrn7bf7fk.orc.sholden@pgrad.cs.usyd.edu.au>
On Tue, 02 Feb 1999 19:55:50 GMT, topmind@technologist.com wrote:
>.
>Reply to Sam Holden (2 msgs):
>
>
>>> Name a language that passes variable length arrays and hashes around without
>using pointers, the language would have to allow both pass by reference and
>pass by value of course. <<
>
>Are you talking about IMPLEMENTING them into the
>language or using them?
>
>Most languages pass explicit arrays by reference,
>but pointer syntax is not needed. Example:
Pointer syntax just makes what is happening explicit. This is a _good_ thing
in my opinion. Otherwise you have a language in which code which is identical,
except for the type of argument causes completely different effects. I'd much
prefer the language to indicate that there was something different.
>
> array a[*,*]
> a[1,2] = "this"
> mysub(a)
> show a[1,2] // result: "that"
> ...
> sub mysub(p)
> p[1,2] = "that"
> endsub
I'll give an example using your code above...
int a
a = 10
mysub(a)
show a // result 10
sub mysub(p)
p = 20
endsub
So there we have identical code except one is dealing with an array and
one is dealing with an integer. The mysub() call however is different,
without any indication that will be different. One passes by reference the
other passes by value.
That is what happens when you try to hide things from the programmer. C++ does
this by allowing you to pass references (as opposed to pointers), the problem is
that the calling code looks identical, the only way to know if a reference or
by value is being used is to look at the function definition. This makes it
harder to see what it is going on (but makes writing the original function
much easier).
If the language said mysub(\a) we would know it was passing by reference and
if it said mysub(a) we would know it was passing by value. Unless it always
passes by reference, or always passes by value.
Perl always passes by reference (ie. if you modify tha values of @_ in a sub
then the originals get modified as well), to pass by value the sub needs to
make a copy itself. C always passes by value, so to pass by reference you
need to pass a pointer. C++ and pascal allow both passing by value and
by reference.
I guess all I was trying to point out was that if the same function can accept
to arrays as arguments, and those arrays are not of fixed size at compile time,
then a pointer must be used somewhere. The language may hide it from the
programmer but they are there.
You still haven't named a language though. I know it can be done. I just want
the name of an existing language that does it. If you are designing your own
language then I'm assuming you've done some research into what has gone before
and thus you should know at least one language with said property.
>
>One does not have to use "\" operators to pass them.
I don't care about "\" operators, that is just the perl syntax.
>
>
>>> Name an OO language that doesn't use pointers. <<
>
>It may depend on one's definition of pointers, but Java
>has no direct pointers. It is true that if you
>assign an object reference to another, then you
>have something similar to an address of the object
>instead of its value, but one can never directly
>access the memory address.
Java and perl have exactly the same kind of pointers.
In java you just can't get a reference to a built-in type (that I know of
anyway) and you can't get a class in any other way than a reference.
In perl you have to ask for a reference.
Once you have a reference in both those languages they are treated in the same
way (of course in perl you can bless something to be a different 'type', but
that is a matter of strong versus weak typing and not references).
So Java has pointers, you just can't do pointer arithmetic, and Java is
strongly typed.
So the question still stands : Name an OO language that doesn't use pointers?
>
>No "\" equiv. in Java.
That's because in Java the \ is there by default, there is not way _not_ to
have a reference. You can write perl code like that as well, if you wrote
perl in an OO fashion (but OO is another part of perl I don't like much, I
prefer closures myself).
>
>(BTW, I am not a fan of OOP anyhow, so I don't
>care about whether OO languages
>use or need pointers or not.)
>
>>> Name a language that uses by-reference semantics without using references. <<
>
>
>I am not sure what you mean by "semantics".
I's the same as the first question just worded differently.
>
>
>>> Of course a little evidence
>on your part for you statements would be a novel idea. <<
>
>I am not the one who claimed they are necessary, so
>I cannot provide the evidence. You would have to
>tell me exactly what you use them for and I could
>then show you an alternative.
No but you made some statements without any backup. You claimed some things
without bothering to give an example to back up your claim. I have simply
asked for that backup, and you have provided it in this post.
>
>
>>> References are useful in Perl because they enable the efficient construction
>of dynamic data structures that make code more efficient and more readable. <<
>
>
>Efficient perhaps, readable, no.
Using references in perl makes code much more readable than using
soft-references. I did say in perl. I have written data structures with soft
references and they are not as readable as the equivalent with real references.
This is simply because the existance of a reference gives the reader a hint
that this references something else. And also because dereferencing is much
easier to do.
>
>
>>> That way instead of having pages and pages of if elses, or cases you have
>simple readable code that lets the data structure handle the special cases.
>I think it's generally called encapsulation which most consider a good
>thing. <<
>
>I am not sure what you mean by "pages and pages of if elses".
>An example would be nice.
I mean something along the lines of having a data structure which contains
sub components which can be of many different types. When we want to
walk the data structure for example we could do something like this :
switch(n) {
case (type1) : //do some stuff or call a function
case (type2) : //do some stuff...
case (type3) : //do some stuff...
...
case (typeN) : //do some stuff...
}
Instead we could store a reference to the appropriate 'stuff' in the data
structure and do :
n->do_some_stuff();
Where do_some_stuff is a reference to the appropriate code. This is what OO
languages do for you, however, it's done in procedural languages a lot as
well, and since the language doesn't do it for you, you need to roll your
own...
>
>
>>> I have asked simple things like this before and you haven't bothered
>answering. <<
>
>What do you mean "like this"? I have not purposely
>ignored (not replied to) any request unless it was personal.
>There were cases when I had no examples of bad production
>Perl code to show you, but I stated that. (And why you
>did not accept signitures as evidence I don't know.)
I have asked for evidence from you a lot, you gave some this time so the
statement is not applicable any more.
Because signatures are not production code, they are intentionally written
to be hard to understand.
>
>>> References are one of the most powerful constructs in procedural
>programming. <<
>
>Example?
Graphs, skip lists, etc...
>
>
>>> You can
>claim all you want that you don't need them but if you do you are simply
>wrong. Take a graph for example, each node can have 0 or more edges which
>lead to other nodes. If you didn't have references how would you point
>to those other nodes? <<
>
>Indexed Relational Tables! That is how. They also provide
>auto-persistence, something RAM-oriented people struggle with.
>
>Take this simple graph (view with a fixed-pitch font
>such as Courier)
>
>A ---- B
> |-- C ----- F --- A [circular]
> |-- D |-- G
> |-- E
>
>Here are at least two ways to represent graph and tree
>structures with tables:
>
>The first method has a finite branching limitation
>that depends on the field-size of ChildrenList, but
>it is simple to implement:
>
>NodeID Value ChildrenList
>
> A x B, C, D, E
> C x F, G
> F x A
> B x
> D x
> E x
> G x
See those ChildrenList things, they are soft-references. You are storing a
reference to a Node there, instead of storing a pointer to a memory location
you are storing an ID. It's the same as implementing a graph as an array of
nodes, and the edges as indexed into that array.
You still have references, the just aren't pointers to bits of memory. That is
fine if your data structure is not in memory, but if some of the data
structure has been cached in memory then using soft-references like that
causes an extra level of redirection which makes things less efficient.
Now I don't care much about efficiency, but I don't like sacrificing one thing
for no gain. Here you are sacrificing the fast access of a reference, with
some added information that the data is a reference and not something else, and
all you get in return is a different way of storing the reference.
>
>NodeID would be indexed for fast traversals.
>Note that this example is a directional graph.
>
>The second method is more complex, but does not
>have a branching limit (other than disk space):
>
>LinkTable
>
>NodeID Link
> A B
> A C
> A D
> A E
> C F
> C G
> F A
Again this is a simple list of references to nodes, but instead if storing the
memory location, or the file offset of the node, you are storing the NodeID
of the node. You are using a reference, you just aren't calling it a reference.
>
>NodeTable
>
>NodeID Value
> A x
> B x
> C x
> etc...
>
>
>Note that implementing this using SQL API's is not very
>pleasant, but doable. That is why I am promoting
>table-oriented languages that have more table-friendly
>syntax.
That's fine you can do that, you shouldn't however do that at the expense of
every other paradigm out there. I'm sure table-oriented programming is very
useful, when your underlying data maps well onto tables. When it doesn't though
you are forcing a fit which makes the code less readable.
OO does the same thing, there are many programming problems that don't map very
well onto the object idea and implenting them in an OO fashion means you are
forcing a fit which makes the code less readable. The obvious example of this
is GUI programming, which is done amost exclusively in an OO fashion these days
I believe however, that it is much more suited to a concurrent model and the
complexity of most GUI toolsets is due to forcing them to be OO.
>
>Also, I don't think trees and graphs are the most
>common use of "\" anyhow in Perl. My observation
>is that they are mostly used to overcome the
>1D array limitation and parameter passing
>limitations of Perl. This observation is not at all
>scientific nor thorough, so you are welcome to
>challenge it.
I expect that references in perl are most often used when programming in perl
using perl's OO style. Passing multiple arrays and hashes to subs would be
second. If the subs are prototyped in perl however, then that \ is not needed,
so the problem is not with perl, but with the way people use perl.
>
>It is not the fact that Perl has explicit pointers,
>it is that they are overused because they appear
>to compensate for weaknesses.
No. As in almost everything in perl, perl makes it very easy to do the easy
things. Most of the time when passing arguments to a sub you do not need to
pass more than one array or hash, thus perl makes this easy. Perl also makes
passing arrays or a bunch of scalars the same thing, since that is what is
mostly wanted. When you want to do something a little more complex which is
used less often, perl still lets you do it. Since it is done less often it
is a little more complex to do (this is known as huffman encoding an interface).
And as a technical note, they are references not pointers. The two words are
not interchangeable, they have different connotations. If you don't call
Java references pointers, then don't call perl references pointers.
--
Sam
compiling kernels is what I do most, so they do tend to stick to the
cache ;) --Linus Torvalds
------------------------------
Date: 2 Feb 1999 22:29:22 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Perl programmers needed in London
Message-Id: <797u82$oa$1@gellyfish.btinternet.com>
On Fri, 29 Jan 1999 15:53:14 -0000 Internet Advertising Limited wrote:
> We have recently received funding to work on a new, exciting project based
> in London.
>
> We require programmers that have extensive knowledge of Perl and CGI.
>
> Excellent pay and prospects for the right people.
>
I have forwarded this to the London.pm mailing list.
In general though it is probably better to mail these to :
owner-london-list@hfb.pm.org
in order that we can take a view on them.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Tue, 2 Feb 1999 14:31:59 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Perl syntax ( URGENT )
Message-Id: <x3yaeywmwk0.fsf@tigre.matrox.com>
Frank de Bot <debot@xs4all.nl> writes:
> > chop ------------> what's the meaning of "chop" ?
> >
>
> Chop get the \n of a string. chop($var);
Ummm... no.
chop() removes the last character of a string, whatever that character
might be.
> > @arr= split; ------------------->?
>
> Split makes from a string an array. This seems to do nothing. Use: @array =
> split(/ /, $string). Every word has it own place in the array
Ummm... no.
The expression:
@arr = split;
is exactly equivalent to:
@arr = split ' ', $_;
perldoc -f split
> > @val=split(/:/,arr[2]); $tt=val[0]; -------->?
>
> Some more difficult to explain. I do it with examples. This is now the
> Array. Each value separted by an space. Val1 Val2 Val3 Val4
what array? what value? what space?
------------------------------
Date: Tue, 02 Feb 1999 23:17:22 GMT
From: k2k2@my-dejanews.com
Subject: problem forking with perl: child sometimes dies
Message-Id: <79811p$1nn$1@nnrp1.dejanews.com>
I have a perl script that forks off a child to do some work in the
background that can take a long time. It works somthing like this:
if (!defined($child_pid = fork())) {
die "cannot fork $!\n";
} elsif ($child_pid) { #parent process
print "this is the parent";
} else { #child process
open STDERR, ">/dev/null"; #must close STDERR & STDOUT or the
open STDOUT, ">/dev/null"; # process will wait for the fork
# before finishing if run via CGI.
open (LOG, ">$logfile")||die "Can't open $logfile: $!\n";
flock(LOG,2);
select LOG; #LOG is default filehandle now
$| =1;
print "this is the child\n";
&write_a_bunch_of_data_to_some_files;
}
This script works fine on my machine. However, when I upload it to my ISP's
machine, the parent runs fine, but the child dies at some point. It writes
some of the files its supposed to, but never quite finishes. It dies in
different places each time its run.
If I run it on my ISP's machine without the fork, it works fine.
If I replace &write_a_bunch_of_data_to_some_files;
with &write_LESS_data_to_some_files;
...the child has a better chance of finishing but still usually dies before
completion.
My machine:
Linux mymachine.com 2.0.35 #1 Tue Jul 14 23:56:39 EDT 1998 i686 unknown
This is perl, version 5.004_04 built for i386-linux
My ISP's machine:
Linux myisp.com 2.0.35 #3 Mon Jul 20 10:51:25 PDT 1998 i686
This is perl, version 5.004_01
If anybody can help me I'd really appreciate it. Thanks in advance.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 02 Feb 1999 16:36:39 -0700
From: Wade Holst <wade@cs.ualberta.ca>
Subject: Re: Regex for e-mail addresses?
Message-Id: <r7ww20bcoo.fsf@rimbey.cs.ualberta.ca>
Ed Hitler <revjack@radix.net> writes:
> Is there a single perl regular expression that will allow me to extract the
> e-mail addresses from the following header lines?
>
> ... snip ...
>
> Right now I'm doing something like this:
>
> $_ =~ s/^.*[ <(]([^ ]+\@[^ ]+)[ >)].*/$1/;
> $_ =~ s/From: //;
>
> There's got to be a better way.
Usually best to extend the work of others
Mail::Address is a good place to start.
--
Wade Holst wade@cs.ualberta.ca
University of Alberta http://www.cs.ualberta.ca/~wade
------------------------------
Date: 02 Feb 1999 15:47:37 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Regex for e-mail addresses?
Message-Id: <yln22wpduu.fsf@windlord.stanford.edu>
Ed Hitler <revjack@radix.net> writes:
> What I'm after is, "the stuff on either side of the @ sign, but not
> brackets or parentheses".
Mail::Address is probably about as close as you'll get to a working answer
to this question, with the caveat that everything you can do in this
situation is going to fail with some border case or another.
Note that the full power of Mail::Address is not required to parse news
From: headers according to RFC 1036, which madates a simplified syntax,
but lots of people ignore that part of RFC 1036.
Mail::Address is part of Graham Barr's MailTools package.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Tue, 2 Feb 1999 23:46:50 +0000
From: Andrew Fry <andrewf@beausys.demon.co.uk>
Subject: replacing non-printable characters
Message-Id: <lfnnjBAq54t2Ewsy@beausys.demon.co.uk>
I am trying to write a Perl module that decodes
a trace of network traffic, and I need a bit of
Perl that replaces all non-printable characters
by, say, a '.' (...to display each octet in
hex on one side and ASCII on the other side).
Does anyone have such a piece of code to hand ?
(...to do the replacing, that is).
---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).
------------------------------
Date: Tue, 02 Feb 1999 23:42:49 GMT
From: hoangngo@usa.net
Subject: Shared library and Perl
Message-Id: <7982hn$31c$1@nnrp1.dejanews.com>
Hello-
I have a shared library (.so) that i would like to link with Perl. This
library has a function that looks something like this:
void (char *buf, uint , uint)
What i would like to be able to do is to link this library in such a way
so that i can change the library without recompiling Perl.
Is is possible? Please drop me a line if you have the answer.
Thanks,
Hoang
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 2 Feb 1999 21:05:45 GMT
From: Ed Hitler <revjack@radix.net>
Subject: Re: STDOUT redirect on NT
Message-Id: <797pb9$fd2$2@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Peter Slaughter explains it all:
: test.pl > out.txt
:A zero line 'out.txt' file is created.
Try
perl test.pl > out.pl
Works on my system, which is the same as yours.
--
/~\ occlude brazier twin annuli nearby bagpipe requited wind giblet
C oo feather bestial florid mommy exegete walk mode volcanic octant
_( ^) 1 , 0 0 0 , 0 0 0 m o n k e y s c a n ' t b e w r o n g
/___~\ http://3509641275/~revjack 02/02/99 16:04:24 revjack@radix.net
------------------------------
Date: Tue, 2 Feb 1999 23:34:00 +0000
From: Andrew Fry <andrewf@beausys.demon.co.uk>
Subject: tie, hash problem
Message-Id: <x$nirBAot4t2Ewsq@beausys.demon.co.uk>
I am trying to use tie to bind to a database, using
a statement of the form...
tie(%DBHASH,$i,$dbname,$flags,0666)
where $i = SDBM_Type or DB_Type or NDBM_Type
and $dbname = database/file name
and $flags = O_CREAT, O_RDWR or whatever
However, I am getting the following error every
time...
"Cant locate object method "TIEHASH" via package (xxx)"
Any suggestions ?
(BTW, I have read the on-line documentation ...
it doesnt seem to help).
---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).
------------------------------
Date: Tue, 2 Feb 1999 14:04:33 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: What characters are illegal in referer strings?
Message-Id: <x3yemo8mxtq.fsf@tigre.matrox.com>
"Robert White" <richly@samart.co.th> writes:
> I'd like to do a split on each line, simplest solution,
> so what I need is a character on which to split.
> Character should be illegal within a URL or within
> the REFERER string, which could include search engine
> form data, launches from email, or newsgroups.
> Suggestions for something safe?
I would use some binary character like \034 ... which happens to be
the defualt value of $; (aka $SUBSEP if use English == TRUE;)
Note that if your data contains binary stuff (I don't think so, but
maybe), then there might not be a safe solution.
Ala
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 4810
**************************************