[10620] in Perl-Users-Digest
Perl-Users Digest, Issue: 4212 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 13 08:07:41 1998
Date: Fri, 13 Nov 98 05:00:34 -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 Fri, 13 Nov 1998 Volume: 8 Number: 4212
Today's topics:
Calling a cgi script from withion a perl script. - Help <pcs26@cam.ac.uk>
Re: Calling a cgi script from withion a perl script. - <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Definition of "odd characters" in -T/-B documentati <uri@sysarch.com>
Re: Definition of "odd characters" in -T/-B documentati <ljz@asfast.com>
Re: HELP! Concat'ing multiple variables into one <uri@sysarch.com>
Help: HTML Form with attachment(s) <massimo.mercuriali@ascom.ch>
Re: How to do this without goto? (David Formosa)
Re: How to do this without goto? (Larry Rosler)
Re: Is __DIE__ a real signal? (with real signal limitat <b.d.low@unsw.edu.au>
Re: Is there a compiler for Perl? <j.bessels@wolverine.demon.nl>
Re: More efficient coding? <uri@sysarch.com>
Re: More efficient coding? <dgris@moiraine.dimensional.com>
Re: OOP or not? (for a Perl module) (Paul Winkler)
Perl Weirdness with <<END_TEXT and REDO_THIS: tag (Excession)
Re: Perl,ActiveS,run? <msergeant@ndirect.co.uk_NOSPAM>
Re: Q: are symbolic refs really needed (was Re: Modific (Bart Lateur)
Re: Raw Sockets xaqtnr@my-dejanews.com
Re: Raw Sockets <carvdawg@patriot.net>
Re: Regular Expressions in Java <Marc.Meurrens@ULB.ac.be>
Re: Return Data to Form - How? (Tore Aursand)
Re: Selena Sol's form_processor (Bart Lateur)
Re: This is flocking tricky <cgormley@netcomuk.co.uk>
Re: Trying to remove item from a list (Tad McClellan)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 13 Nov 1998 11:44:23 -0000
From: "Paul Scott" <pcs26@cam.ac.uk>
Subject: Calling a cgi script from withion a perl script. - Help!
Message-Id: <72h63j$f81$1@pegasus.csx.cam.ac.uk>
Hi all,
I have a cgi script running on a website that is called from a url with a
product value (eg myserver/abc.cgi?product=123456)
I need to preprocess this value for some products, and I am happier doing
this in Perl. My question is..... is there any way I can process in perl,
then call the cgi with the processed value without having to actually create
a page with the link on. If yes, how?
Thanks
Paul Scott
------------------------------
Date: 13 Nov 1998 13:00:36 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Calling a cgi script from withion a perl script. - Help!
Message-Id: <83r9v7n6or.fsf@vcpc.univie.ac.at>
Re: Calling a cgi script from withion a perl script. -
Help!, Paul <pcs26@cam.ac.uk> said:
Paul> this in Perl. My question is..... is there any way I
Paul> can process in perl, then call the cgi with the
Paul> processed value without having to actually create a
Paul> page with the link on. If yes, how?
perldoc LWP
perldoc HTTP::Request
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: 13 Nov 1998 01:27:10 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Definition of "odd characters" in -T/-B documentation.
Message-Id: <x7pvas6rb5.fsf@sysarch.com>
>>>>> "LZ" == Lloyd Zusman <ljz@asfast.com> writes:
LZ> I'm running version 5.005_02. The documentation for the `-T' and
LZ> `-B' operators in the `perlfunc' man pages states this:
LZ> The -T and -B switches work as follows. The first block or so
LZ> of the file is examined for odd characters such as strange control
LZ> codes or characters with the high bit set. [ ... ]
LZ> What is the meaning of "odd characters" and "strange control
LZ> codes" in this context? If this is documented somewhere outside
LZ> the Perl source code itself, could anyone point me to this
LZ> documentation? Or if I do have to get this out of the source
LZ> code, could someone point me to the appropriate source file?
well, odd chars is either high bit set (normal US ascii is 7 bits) or
funny control chars. what could those be? what are non-funny control
chars? the usual white space things like \n\r\t (and a few others) that
you might find in normal text files. so this lease the funny ones which
are not in typical text files, like ^@, ^A, ^B, etc.
with internationalization and other char issues like utf and wide chars,
this test is getting less useful. i wouldn't trust it in some cases
unless you know the data formats of the set of files being tested.
hth,
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: 13 Nov 1998 07:21:47 -500
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Definition of "odd characters" in -T/-B documentation.
Message-Id: <ltu303eqas.fsf@asfast.com>
Uri Guttman <uri@sysarch.com> writes:
> >>>>> "LZ" == Lloyd Zusman <ljz@asfast.com> writes:
>
> [ ... ]
>
> LZ> What is the meaning of "odd characters" and "strange control
> LZ> codes" in this context? [ ... ]
>
> well, odd chars is either high bit set (normal US ascii is 7 bits) or
> funny control chars. what could those be? what are non-funny control
> chars? the usual white space things like \n\r\t (and a few others) that
> you might find in normal text files. so this lease the funny ones which
> are not in typical text files, like ^@, ^A, ^B, etc.
Does this mean that the "non-funny" control characters are these? ...
\r \t \n <form-feed>
Or perhaps this is the criterion? ...
/* where isspace() is from ctypes.h ... */
if ((!isspace(character) && character < 0x20) ||
(character & 0x80) != 0)
{
/* funny character */
}
Or what?
And how large is "the first block or so" (quoted from the man page) of
the file that the `-T/-B' test examines?
> with internationalization and other char issues like utf and wide chars,
> this test is getting less useful. i wouldn't trust it in some cases
> unless you know the data formats of the set of files being tested.
Well, thank you, but the algorithm is still of interest to me. My
requirements in this particular case do not include the need to winnow
out readable data from utf or wide-character text. I just want to
know the specifics of how Perl currently makes its decision in this
`-T/-B' test.
Once again ... does anyone know where this might be documented?
--
Lloyd Zusman ljz@asfast.com
perl -le '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
$t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
$x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x"'
------------------------------
Date: 13 Nov 1998 01:37:20 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: HELP! Concat'ing multiple variables into one
Message-Id: <x7lnlg6qu7.fsf@sysarch.com>
>>>>> "RJK" == Ronald J Kimball <rjk@coos.dartmouth.edu> writes:
RJK> D. Davis <dlincoln@ultrainteractive.com> wrote:
>> # Put variables into an array... then make array row = single variable
>> # Then make array text = to single variable.
>> #
>> $searchterm[0] = ($input{'level'});
>> $searchterm[1] = ($input{'topic'});
>> $searchterm[2] = ($input{'subject'});
>>
>> $search_terms = "@searchterm";
RJK> ^^^^^^^^^^^^
>> $search_terms = $searchterm[0].$searchterm[1].$searchterm[2];
RJK> ^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^
RJK> These variable names don't match. Fix it and it will work.
sorry ronald, but that makes no sense. the 3 array elements match the 3
assignments above. whereas
$search_terms = "@searchterm";
is joining that array with $" and assigning it to a new scalar.
the original complaint made little sense in general. the following is a
list of one value assigned to a scalar so the () are not needed.
$searchterm[2] = ($input{'subject'});
as to why the various concatenations didn't work, only the perl gods and
the original poster knows. :-)
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Fri, 13 Nov 1998 12:38:02 +0100
From: Massimo Mercuriali <massimo.mercuriali@ascom.ch>
Subject: Help: HTML Form with attachment(s)
Message-Id: <364C1A1A.EEB8D7A8@ascom.ch>
Hello
I have no experience (yet) with CGI scripts, but I have
urgent need for a script which could send the content
of a HTML-Form with file attachments to a defined email
address.
Is this possible?
Has someone of you a similar script which I could adapt
to my needs?
Please reply directly to:
massimo.mercuriali@ascom.ch
------------------------------
Date: 13 Nov 1998 05:56:57 GMT
From: dformosa@zeta.org.au (David Formosa)
Subject: Re: How to do this without goto?
Message-Id: <slrn74nih6.1dq.dformosa@godzilla.zeta.org.au>
In article <364BA954.CF83C08@ttsg.com>, Scott J. Ellentuch wrote:
>Hi,
>
>Trying to figure out how to do something, wondering if people can help.
>
>open (LIST,"<list");
>
>while (<LIST>)
>{
> if ($true)
> {
> $SIG{'ALRM'} = 'toolong';
> alarm 6;
> $result=&readfile($_);
> alarm 0;
> }
>
> CONTINUE:
> print "Result for ".$_."was ".$result."\n";
>}
You could do it this way
open (LIST,"<list") or die "Can't open list due to $!\n";
while (<LIST>) {
eval {
$SIG{'ALRM'}=die "Couldn't read the file within 6 seconds\n";
alarm 6;
$result=&readfile($_);
alarm 0;
}
print $@ if $@;
print "Result for ".$_."was ".$result."\n";
}
--
Please excuse my spelling as I suffer from agraphia. See
http://www.zeta.org.au/~dformosa/Spelling.html to find out more.
------------------------------
Date: Thu, 12 Nov 1998 23:13:10 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to do this without goto?
Message-Id: <MPG.10b57be18680c384989907@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <slrn74nih6.1dq.dformosa@godzilla.zeta.org.au> on 13 Nov 1998
05:56:57 GMT, David Formosa <dformosa@zeta.org.au> says...
...
> eval {
> $SIG{'ALRM'}=die "Couldn't read the file within 6 seconds\n";
This immediately invokes 'die'. It needs to be defined into a handler
subroutine:
$SIG{'ALRM'} =
sub { die "Couldn't read the file within 6 seconds\n" };
> alarm 6;
> $result=&readfile($_);
> alarm 0;
> }
This needs a terminating semicolon.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 13 Nov 1998 17:22:28 +1100
From: Benjamin Low <b.d.low@unsw.edu.au>
Subject: Re: Is __DIE__ a real signal? (with real signal limitations?)
Message-Id: <364BD024.9478F78D@unsw.edu.au>
Thanks Tom and Zenin for the confirmations...
Zenin stated:
> : $SIG{__DIE__} = sub { print STDERR "erk..." };
>
> Safe. Just quote the '__DIE__' or use strict won't eat it.
I run under strict (and -w) (and agree with Zenin's comments re.
benefits of -w outwieghing its minor inconveniences). Anyhow, I've found
perl (5.004) doesn't have any qualms about treating {string} as a string
- I seem to recall somewhere the docs say as much ...?
The only time I've found the need to quote is with keywords:
%h = (
old => 'this is ok',
'new' => 'have to quote [new]',
);
which does look a little messy, so quoting may be aesthetically
desirable...
--
Benjamin Low, BEng (Elec)
Communications Unit, University of New South Wales, Australia
(02) 9385 1138 b.d.low@unsw.edu.au b.d.low@ieee.org
------------------------------
Date: Fri, 13 Nov 1998 09:41:59 +0100
From: Jan Bessels <j.bessels@wolverine.demon.nl>
Subject: Re: Is there a compiler for Perl?
Message-Id: <364BF0D7.636BA601@wolverine.demon.nl>
Ernst-Udo Wallenborn wrote:
>
> > On Thu, 12 Nov 1998 12:19:53 +0100, Jan Bessels
> > <j.bessels@wolverine.demon.nl> wrote:
> >
> > >When writing commercial programs distributing executables instead of the
> > >original Perl source code is very attractive. The main advantage here
> > >isn't speed but unreadability...
>
> there's two groups of people you might not want to read your
> code. 1) Hackers on the net who might scan your CGI script
> for weaknesses, and 2) legit customers, who might figure
> they don't need to pay a wizard but rather retroengineer
> your programs and do it themselves.
>
> In any decent OS you can set permissions to prevent 1) (if that's
> not true for your favourite OS, get a new OS).
I agree with that, but that isn't exactly the problem. 2) Is very much
more the problem.
> As to 2), well, if your job depends on hiding your lack of genius, get a new job.
I think you are unfair here. When you work for a company and that
company wants to hide its "crown-jewels" from being exposed and pirated
its their good right. This has nothing to do with "lack of genius". I
agree with Ernst=Udo that binary distribution are the way to go IF you
don't others have a look at your source code and also that disbruting
them is easier. No more zillion small Perl files (good programmers split
program in segments you know). Hence my initial question/post in this
group.
Jan Bessels
===========
------------------------------
Date: 13 Nov 1998 01:22:32 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: More efficient coding?
Message-Id: <x7sofo6riv.fsf@sysarch.com>
>>>>> "SA" == Susanne Austin <susanne@divine.net> writes:
SA> how about if ($fi =~ /^d[aeiou[$/
besides the typo of [, this fails on "da\n" etc. you either have to use
a negative lookahead to check for a \n or use \z (5.005) which is
matches the end of the string.
hth,
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: 13 Nov 1998 01:08:23 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: More efficient coding?
Message-Id: <m3hfw410co.fsf@moiraine.dimensional.com>
Uri Guttman <uri@sysarch.com> writes:
> >>>>> "SH" == Sam Holden <sholden@pgrad.cs.usyd.edu.au> writes:
> SH> if (length($fi)==2 && $fi=~/d[aeiou]/) {
>
> SH> I suggest you read up on regular expressions...
>
> and you too! :-)
His works fine, the test for the length of the string avoids
false positives on d[aeiou]\n.
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
Supporter of grumpiness where grumpiness is due on clpm.
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: Fri, 13 Nov 1998 09:13:44 GMT
From: zarmzarmNO@SPAMhotmail.com (Paul Winkler)
Subject: Re: OOP or not? (for a Perl module)
Message-Id: <364bf73c.32868910@news.erols.com>
Update: I've decided to go with a non-OOP approach for now just to get
some useful ideas working and see where that gets me. As one
correspondent advised me, "It's a lot easier to turn around in a
rowboat than in a battleship." And I never intended to build a
battleship anyway.
The Csound::Pscore module project will live at:
http://members.tripod.com/~slinkP/pw_linux/code.html
The first snapshot should be up there by the end of Friday. I might
eventually submit the module to CPAN, but not until it doesn't suck.
Thanks everyone for the suggestions!
--PW
==============================================================
Paul Winkler --- music & sound --- zarmzarm@hotmail.com
http://members.tripod.com/~slinkP/index.html
a member of
ARMS --- an ongoing pop music experiment
http://members.tripod.com/~slinkP/mini-arms.html
==============================================================
------------------------------
Date: Fri, 13 Nov 1998 11:20:18 GMT
From: daccles@bad.spam.no.spam.pcug.org.au (Excession)
Subject: Perl Weirdness with <<END_TEXT and REDO_THIS: tag
Message-Id: <364c148d.4358429@news.ozemail.com.au>
I have a small perl script which installs some software.
At one stage I have a heap of stuff to print out, so rather than
do the print "blah blah \n"; I decided to do the print <<END_INFO;
thing.
I then had a password checking routine which used (shock horror)
a GOTO and a REDO_THIS: tag. The tag was immediately after the
END_TEXT marker.
When I ran the program, the REDO_THIS: tag was not found.
I fixed the problem by putting a comment line (# blah) inbetween the
END_TEXT marker than the REDO_THIS tag.
This is in an ancient version of Perl (Perl 5.001, Activestate
for Windows NT), which cannot easily be upgraded, even though it is very
much out of date, because the PRODUCTION servers have perl code on them
which use some of the, erm, features of 5.001 which are different in later
versions.
I'm just curious as to whether this is a common problem, or a bug, or just
a 'documented feature' which I have failed to espy.
If you are considering replying, an email reply would be thoughtful and
appreciated. Thanks.
Dac
---
David Andrew Clayton # Please remove NO_SPAM when
dac@NOSPAM.pcug.org.au # sending email replies.
I post therefore I am. #
------------------------------
Date: Fri, 13 Nov 1998 08:55:09 +0000
From: Matt Sergeant <msergeant@ndirect.co.uk_NOSPAM>
Subject: Re: Perl,ActiveS,run?
Message-Id: <364BF3ED.F8F3D615@ndirect.co.uk_NOSPAM>
forrest reynolds wrote:
>
> Hello,
> I recently downloaded build 316 of ActiveState's Perl for Win32. I
> run Win 95 and I'm having trouble running a simple (print "hello
> world\n";) progam that I saved under the title hello.pl in the
> Perl\bin. My path is c:\Perl\bin and I try to run it from the Perl.exe
> (looks like a DOS window) that is in Perl\bin. I've checked Faqs and
> such, but when I type "perl hello.pl" or c:\Perl\bin hello.pl and
> other variations, the cursor just skips to the next line. How can I get
> this to run? I want to start practicing more complex programs....
> thanks, Forrest
To get perl to search your path for a file use "perl -S hello.pl". See
perlrun.
--
<Matt/>
| Fastnet Software Ltd | Perl in Active Server Pages |
| Perl Consultancy, Web Development | Database Design | XML |
| http://come.to/fastnet | Information Consolidation |
------------------------------
Date: Fri, 13 Nov 1998 08:39:05 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: Q: are symbolic refs really needed (was Re: Modification of a read-only??)
Message-Id: <364cec66.2187333@news.ping.be>
Zenin wrote:
>: LR> Does anyone have an example where
>: symbolic references *must* be used, where a hash wouldn't do as well?)
>: that's a good question. maybe use strict 'refs' should be on by
>: default. there might be some odd case but i doubt that you couldn't do
>: it with hashes and maybe typeglobs (the way i did it in perl4! :-).
>
> Dynamically affecting other package's global data, ala some of the
> black magic Exporter does:
>
> *{"${PackageName}::$VarName"} = "Some value";
>
> There are non-soft ref ways to do this, but they are much uglier
> normally.
Can't you do that using eval?
eval "\$$Packagename\::$VarName = \"Some Value\"";
Bart.
------------------------------
Date: Fri, 13 Nov 1998 06:46:23 GMT
From: xaqtnr@my-dejanews.com
Subject: Re: Raw Sockets
Message-Id: <72gkk0$eso$1@nnrp1.dejanews.com>
In article <364B38FE.A2D255B6@patriot.net>,
keydet89@yahoo.com wrote:
> Does anyone have links to code or information on
> creating raw sockets in Perl? I am trying to write a
> script to do just that, in order to test firewalls, ID systems,
> etc.
>
> I posted my code to comp.lang.perl.misc and comp.protocols.tcpip,
> with no responses....
>
> Thanks
>
> Carv
Here is some code for a 'server' / 'client' using sockets:
---------- Server ----------
$line = "Test\n"; #Data to send
$port = 5000;
($d1, $d2, $prototype) = getprotobyname ("tcp");
($d1, $d2, $d3, $d4, $client) = gethostbyname (`hostname`);
$serveraddr = pack ("Sna4x8", 2, $port, $server);
socket (SSOCKET, 2, 1, $prototype) || die ("No socket");
bind (SSOCKET, $serveraddr) || die ("Can't bind");
listen (SSOCKET, 1) || die ("Can't listen");
($clientaddr = accept (SOCKET, SSOCKET)) || die ("Can't accept");
select (SOCKET);
$|=1;
print SOCKET ("$line\n");
close (SOCKET);
close (SSOCKET);
------------------------------------------------
---------- Client ----------
$port = 5000;
($d1, $d2, $prototype) = getprotobyname("tcp");
($d1, $d2, $d3, $d4, $client) = gethostbyname (`hostname`);
($d1, $d2, $d3, $d4, $server) = gethostbyname ("your hostname defined in the
server code");
$clientaddr = pack ("Sna4x8", 2, 0, $client);
$serveraddr = pack ("Sna4x8", 2, $port, $server);
socket (SOCKET, 2, 1, $prototype) || die ("No socket");
bind (SOCKET, $clientaddr) || die ("Can't bind");
connect (SOCKET, $serveraddr);
$line = <SOCKET>;
print ("$line\n");
close (SOCKET);
-------------------------------------------------------
Hope this helps some as basic as it is.
--
Shay
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 13 Nov 1998 06:14:05 +0000
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Re: Raw Sockets
Message-Id: <364BCE2D.8E160172@patriot.net>
What you have provided is good, and I do appreciate your time,
but it is not at all what I am looking for...I am looking for "raw"
sockets.
I need to be able to specify the header information...TCP flags, even
addresses (to check for source routing problems).
What you have provided below for the client is the standard TCP connect()
code...I have already written port scanners, etc. What I need to do now
is craft my own packets.
Thanks again,
Carv
xaqtnr@my-dejanews.com wrote:
> In article <364B38FE.A2D255B6@patriot.net>,
> keydet89@yahoo.com wrote:
> > Does anyone have links to code or information on
> > creating raw sockets in Perl? I am trying to write a
> > script to do just that, in order to test firewalls, ID systems,
> > etc.
> >
> > I posted my code to comp.lang.perl.misc and comp.protocols.tcpip,
> > with no responses....
> >
> > Thanks
> >
> > Carv
>
> Here is some code for a 'server' / 'client' using sockets:
>
> ---------- Server ----------
>
> $line = "Test\n"; #Data to send
>
> $port = 5000;
>
> ($d1, $d2, $prototype) = getprotobyname ("tcp");
> ($d1, $d2, $d3, $d4, $client) = gethostbyname (`hostname`);
>
> $serveraddr = pack ("Sna4x8", 2, $port, $server);
>
> socket (SSOCKET, 2, 1, $prototype) || die ("No socket");
> bind (SSOCKET, $serveraddr) || die ("Can't bind");
> listen (SSOCKET, 1) || die ("Can't listen");
> ($clientaddr = accept (SOCKET, SSOCKET)) || die ("Can't accept");
> select (SOCKET);
> $|=1;
> print SOCKET ("$line\n");
> close (SOCKET);
> close (SSOCKET);
>
> ------------------------------------------------
>
> ---------- Client ----------
>
> $port = 5000;
>
> ($d1, $d2, $prototype) = getprotobyname("tcp");
> ($d1, $d2, $d3, $d4, $client) = gethostbyname (`hostname`);
> ($d1, $d2, $d3, $d4, $server) = gethostbyname ("your hostname defined in the
> server code");
>
> $clientaddr = pack ("Sna4x8", 2, 0, $client);
> $serveraddr = pack ("Sna4x8", 2, $port, $server);
>
> socket (SOCKET, 2, 1, $prototype) || die ("No socket");
> bind (SOCKET, $clientaddr) || die ("Can't bind");
> connect (SOCKET, $serveraddr);
>
> $line = <SOCKET>;
> print ("$line\n");
> close (SOCKET);
>
> -------------------------------------------------------
>
> Hope this helps some as basic as it is.
>
> --
>
> Shay
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 13 Nov 1998 10:51:57 +0100
From: "Ir. Marc W.F. Meurrens" <Marc.Meurrens@ULB.ac.be>
Subject: Re: Regular Expressions in Java
Message-Id: <364C013D.B57906C3@ULB.ac.be>
Hi,
You may want to have a look at my regex subsite
(URL below my signature)
where several Regex packages are listed/described.
Marc
--
+------------------------------------------------------------+
| Ir. Marc W.F. Meurrens |
| http://Meurrens.ML.org phone: +32-2-555.4054 (ULB) |
| Marc.Meurrens@ACM.org fax: +32-2-537.7645 |
| Computer Expert, Public Health School, Brussels Free Univ. |
| http://www.ulb.ac.be/esp |
| Prof. Computer Sciences, National School of Architecture |
| http://www.lacambre-archi.be/alice |
| Secretary of the Belgian Java User Group |
| http://www.BeJUG.org |
| ======> VISIT SOME OF OUR JAVA PAGES <==================== |
| http://Meurrens.ML.org/ip-Links/java/regex |
| (Regular Expressions in Java) |
| http://Meurrens.ML.org/ip-Links/java/codeEngineering |
| (Java bytecode, decompilers, obfuscators, etc) |
| http://Meurrens.ML.org/ip-Links/java/joodcs |
| (Java OO design & coding standards) |
+------------------------------------------------------------+
------------------------------
Date: Fri, 13 Nov 1998 08:40:03 GMT
From: tore@forumnett.no (Tore Aursand)
Subject: Re: Return Data to Form - How?
Message-Id: <364befea.54586351@news.online.no>
On Thu, 12 Nov 1998 18:05:57 GMT, Thomas Beardshear
<u2537@shurflo.com> wrote:
> I'm trying to write a cgi script which create a file containing data
> from a text area when the user submits it. But I want to do some error
> checking and tell the user whether the attempt was successful or not. If
> not successful, then I want to refill the textarea with the data that
> the user entered and allow him to retry.
I would use this method (assuming you are using CGI.pm):
1. View FORM
2. Save all FORM variables to file (using CGI.pm)
3. Validate all fields
4. If not all fields are valid, load FORM variables from file, and
return to 1.
Hope this helps!
--
Tore Aursand
ForumNett Online AS
<URL:http://www.forumnett.no/>
------------------------------
Date: Fri, 13 Nov 1998 08:39:03 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: Selena Sol's form_processor
Message-Id: <364bebd1.2039255@news.ping.be>
Jonathan Stowe wrote:
># First tell Perl to bypass the buffer. ...
>$! = 1;
I bet you ment
$| = 1;
That's a vertical bar, not a exclamation mark.
Bart.
------------------------------
Date: Fri, 13 Nov 1998 08:31:36 -0000
From: "Clinton Gormley" <cgormley@netcomuk.co.uk>
Subject: Re: This is flocking tricky
Message-Id: <72gqoj$a46$1@taliesin.netcom.net.uk>
> 1. LOCK_EX file A (and make sure other processes respect it!)
> 2. COPY A to, say, "/tmp/A.$$.ftp"
> 3. Truncate A
> 4. Call fsync() on A (use the File::Sync module).
> 5. Unlock A
>
> This way, any processes still attached (have an open descriptor) to
> A can continue to stay that way. -This is often mandatory if a
> parent open()s the file under one UID (ie, root), but hands it to
> children that run under another UID (ie, nobody). Nobody can't
> reopen the file if it wanted to (it is owned by root), but has
> no problem using a descriptor opened in a root UID process (through
> fork() or by passing a descriptor over local UDP).
>
> The fsync() is to insure that the truncate() on A is complete. -I
> remember someone saying once that some brain dead file systems
> (NTFS?) don't run truncate() as atomatic.
Sounds like just the ticket - many thanks guys
------------------------------
Date: Thu, 12 Nov 1998 22:05:24 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Trying to remove item from a list
Message-Id: <46bg27.76s.ln@flash.net>
Kole Dunn (kole@semp.net) wrote:
: I have a text file with a list of items, and I need to remove one item
: from the list.
: cannot find an answer.
Where did you look?
Perl FAQ, part 5:
"How do I change one line in a file/
delete a line in a file/
insert a line in the middle of a file/
append to the beginning of a file?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4212
**************************************