[12284] in Perl-Users-Digest
Perl-Users Digest, Issue: 5884 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 4 09:07:50 1999
Date: Fri, 4 Jun 99 06:00:22 -0700
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, 4 Jun 1999 Volume: 8 Number: 5884
Today's topics:
Re: Anyone know what is this script line meaning ?? <matt-news@sergeant.org>
Re: Auto de/increments help (Sitaram Chamarty)
Calling another Perl script <wyzelli@yahoo.com>
Re: capture the output from screen?? <Allan@due.net>
Re: DBI vs ODBC?? <rhrh@hotmail.com>
Re: execute perl on Windows NT via Netscape <dominikl@pyramid.de>
Re: FAQ 5.15: How can I open a file with a leading "E<g (Lee)
Re: how to track users (w/out cookies) and write to the (David Cantrell)
Re: how to track users (w/out cookies) and write to the <bill@fccj.org>
Installing PERL on AIX 4.1.2.0 <banas@opf.slu.cz>
Re: Is split (surprisingly, amazingly) slow? <kensai@nortel.com>
Job offer: Programming Perl at Tridion, Netherlands <jurgenh@twinspark.nl>
Re: know Perl to maintain Perl (was: Re: I pass an arra <bill@fccj.org>
Re: know Perl to maintain Perl (was: Re: I pass an arra (Eric Bohlman)
Re: mkdir() function on NT <dominikl@pyramid.de>
Multiple line read from file ?? <robert.meppelink@ict.nl>
Re: Password Generator <bill@fccj.org>
Re: Password Generator (David Cantrell)
Perl BOF @ Usenix <tchrist@mox.perl.com>
perl compilation problems on linux <conway@inimage.com>
Re: PERL FOR NT <gellyfish@gellyfish.com>
Re: Problem with Regexp (Sitaram Chamarty)
s/a*/x/g behavior (James Peregrino)
Socket problem lamj@softhome.net
Re: Socket problem <gellyfish@gellyfish.com>
Re: Socket problem (Michel Dalle)
Subscribing to this NG - how do they do that?? <ralawrence@my-deja.com>
Re: Trying to make custom start page for users via cook <gellyfish@gellyfish.com>
Re: uninitialized value? what am i doing wrong? <bill@fccj.org>
Re: uninitialized value? what am i doing wrong? <office@asc.nl>
Re: Weird Warning from conditional (Eric Bohlman)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 04 Jun 1999 13:05:03 +0100
From: Matt Sergeant <matt-news@sergeant.org>
Subject: Re: Anyone know what is this script line meaning ??
Message-Id: <3757C0EF.91E1B9FA@sergeant.org>
David Cassell wrote:
>
> If the intention is to drop the '.' and '..' directories
> [the current dir and the parent dir], then you'd be
> better off writing that line as:
>
> @files = grep !/^\.{1,2}$/, readdir(DIR);
Too many characters... :)
@files = grep !/^\.\.?$/, readdir(DIR);
Matt.
------------------------------
Date: Fri, 04 Jun 1999 10:38:17 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Auto de/increments help
Message-Id: <slrn7ldm7r.2a4.sitaram@diac.com>
On Tue, 01 Jun 1999 18:14:01 GMT, jknoll@my-deja.com <jknoll@my-deja.com> wrote:
>I am testing auto de-in crements and I keep getting hung up on this
>little script.
>
>Im trying to get this;
>Two $nums are 10 * 2 and adding one to $var makes Perl++
You want the ++ to take effect and change "Perl" to "Perm", or you
want the ++ to be printed? Cant have both with one pair of "++",
you know!
>Two $nums are 20 and adding to $var makes Perm
>
>and I get this:
>Two $nums are 10 * 2 and adding one to $var makes Perl++
>Two $nums are 20 and adding to $var makes Perl
>
>why doesn't the Perl change to Perm ??
>
>tia
>Jesse
>
>here's the code:
>
>$var="Perl";
>$num=10;
>print "Two \$nums are $num * 2 and adding one to \$var makes $var++\n";
>print "Two \$nums are ", $num * 2," and adding one to \$var makes ",
>$var++,"\n";
The first ++ doesnt get executed. perlop's dont interpolate
inside double quoted strings. If you have to have that, do this:
print "Two \$nums are $num * 2 and adding one to \$var makes @{[$var++]}\n";
But if you do that then you wont get the "++" printed, as I
mentioned before.
The simplest solution to get what you want, is to use a
pre-increment instead of a post-increment on the second print
statement.
------------------------------
Date: Fri, 4 Jun 1999 21:19:07 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Calling another Perl script
Message-Id: <34P53.3$xx4.1438@vic.nntp.telstra.net>
What is the correct (or best) way to invoke one Perl Script from another?
ie I have one script which contains some subroutines and I want to write
another to test for certain conditions (date related) before running the
first.
I have searched the FAQ, PerlDOC and all things I can think of but I guess I
am searching on exactly the wrong keywords.
Even a pointer to the correct FAQ would be appreciated!
TIA
Wyzelli
------------------------------
Date: Fri, 4 Jun 1999 08:03:13 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: capture the output from screen??
Message-Id: <7j8eql$qk4$1@nntp5.atl.mindspring.net>
John Paopeng wrote in message <3757479E.F7B433FF@ncs.com.sg>...
:Hi
:Let's say I write a perl script to "ping" some IP address.
:So, that I will get the the output that will display on screen.
:Do you know how can I capture that output and assign to $_ to do
:string matching??? Any example will be nice.
:Any help will be greatly appreciated.
One uses backticks or qx to capture output. See perlop for more
information. There is of course an excellent Net::Ping module you might
want to check out as well.
HTH
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
'Out, out brief candle!
Life's but a walking shadow,
a poor player, that struts and frets his hour upon the stage,
And then is heard no more; It is a tale, told by an idiot,
full of sound and fury, signifying nothing'
- MacBeth
------------------------------
Date: Fri, 04 Jun 1999 08:56:57 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: DBI vs ODBC??
Message-Id: <375786C9.C5446A9C@hotmail.com>
Luke wrote:
>
> Hi,
>
> Could someone tell me the difference between DBI and ODBC and which
> method is better to use to interface a program with a database?
>
> I'm currently programming on Windows, but want to be able to port the
> code to a Unix system later on.
>
> Luke
If youre going to port later onto UNIX it's far preferable to use the
DBI and DBD::ODBC modules for accessing your database (if its an ODBC
type) than to use Win32::ODBC, then find out about DBI, then spend three
hours or so re-writing and restructuring your fetches, dos, prepares and
everything else, trust me, I did it ;-).
use DBI; !
Richard H
------------------------------
Date: Fri, 04 Jun 1999 11:07:46 +0200
From: Dominik Leinfelder <dominikl@pyramid.de>
Subject: Re: execute perl on Windows NT via Netscape
Message-Id: <37579762.DC1FE2A@pyramid.de>
j.k. schrieb:
> #!/perl -- -*-perl-*-
if you can run "perl -v" from any place in a Dos-Box, and if your
http-server on yor Box
have the ability to run cgi-scripts,
try this one as header of your file.pl:
#!perl.exe
cheers
Dominik Leinfelder
------------------------------
Date: Fri, 04 Jun 1999 07:48:19 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: FAQ 5.15: How can I open a file with a leading "E<gt>" or t
Message-Id: <B37D354396681448DB@204.112.166.88>
In article <3757be0b@cs.colorado.edu>,
Tom Christiansen <perlfaq-suggestions@perl.com> wrote:
>Annex Canada now! We need the room, and who's going to stop us?
> --A Tom Neff .signature
You tried it once before. Looking to have the White House burnt to the
ground again? :)
Lee
------------------------------
Date: Fri, 04 Jun 1999 09:13:35 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: how to track users (w/out cookies) and write to them individually
Message-Id: <37579872.63550570@news.insnet.net>
On Thu, 03 Jun 1999 12:48:19 GMT, mikecard@my-deja.com said:
>if this is a cgi question and not perl related 1,000 apologies.
It is indeed not a perl question.
>suppose i have two players, player A and player B. how do i keep track
>of them for instance after player A plays a card how do i tell the
>program to write the result to player B's screen.
>
>any help, even if it's just a resource that explains this in detail
>would be appreciated
You need to look up 'server push' in the documentation on Netscape's
site.
[Copying newsgroup posts to me by mail is considered rude]
--
David Cantrell, part-time Unix/perl/SQL/java techie
full-time chef/musician/homebrewer
http://www.ThePentagon.com/NukeEmUp
------------------------------
Date: Thu, 03 Jun 1999 20:20:02 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: how to track users (w/out cookies) and write to them individually
Message-Id: <37571b61.0@usenet.fccj.cc.fl.us>
In article <7j5tih$ehh$1@nnrp1.deja.com>, mikecard@my-deja.com wrote:
> hi
>
> suppose i have two players, player A and player B. how do i keep track
> of them for instance after player A plays a card how do i tell the
> program to write the result to player B's screen.
Only cookies or using the HIDDEN tag will work
for session tracking, unless you install clickstream
module for Apache or something similar.
HTH,
-Sneex- :]
______________________________________________________________________
Bill Jones Data Security Specialist http://www.fccj.org/cgi/mail?dss
Jacksonville Perl Mongers
http://jacksonville.pm.org
jax@jacksonville.pm.org
Running LinuxPPC RedHat 5.0 (Hurricane)
__ _ http://www.linuxppc.org
/ /(_)_ __ _ ___ __ http://www.apache.org
/ / | | '_ \| | | \ \/ / http://www.redhat.com
/ /__| | | | | |_| |> < http://www.perl.com
\____/_|_| |_|\__,_/_/\_\ http://www.gimp.org
------------------------------
Date: Fri, 04 Jun 1999 12:53:02 +0100
From: Jiri Banas <banas@opf.slu.cz>
Subject: Installing PERL on AIX 4.1.2.0
Message-Id: <3757BE29.CFA84111@opf.slu.cz>
I want to install PERL from a source distribution on AIX 4.1.2.0.
But when I run ./Configure it very soon exits with the message:
Configure: Syntax error at line 141: `)' not expected.
I've found the problem is that the files which are created by Configure
includes symbol (") instead of (').
Example:
./UU/getfile incudes this line:
*) echo "Assuming $value will be in people"s path."
I don't know how to fix it, in the Configure script it is right.
Could anyone help me?
Jiri Banas
------------------------------
Date: Fri, 04 Jun 1999 08:15:06 -0400
From: digital kensai <kensai@nortel.com>
Subject: Re: Is split (surprisingly, amazingly) slow?
Message-Id: <3757C34A.B2569071@nortel.com>
Mark-Jason Dominus wrote:
> In article <37551D11.3F10EB10@nortel.com>,
> digital kensai <kensai@nortel.com> wrote:
> >I ran some tests and got about a 14 second (versus 26 second) run-time,
>
> Absolute times are meaningless. All you can conclude from this is
> that your computer is better than the one that the other person used,
> or less heavily loaded, or something like that.
The 14 second runtime and the 26 second runtime were both on my machine!
The longer one uses split, the shorter one uses unpack.
Oh, ... thanks Uri, for the tip!
------------------------------
Date: Fri, 4 Jun 1999 14:52:39 +0200
From: "Jurgen Hildebrand" <jurgenh@twinspark.nl>
Subject: Job offer: Programming Perl at Tridion, Netherlands
Message-Id: <7j8i10$92$1@news1.xs4all.nl>
Keywords: Job,Perl,XML,Multimedia,Content Management
Tridion is an ambitious company on the Internet content/website management
market. Our products are operational at major newspaper publishers in the
Netherlands (Parool, NRC, Volkskrant) and at large international companies
like Ericsson and KLM airlines, to name a few. Tridion is a spin-off from
Twinspark Interactive People (http://www.twinspark.com), a leading site
builder in the Netherlands.
For further development of our current content/website management product,
we are seeking for ambitious Perl gurus and want to be gurus. If you like to
work your way into managing, manipulating and processing of multimedia
content, Tridion is the place to be.
Here at Tridion we have a nice mix of buzz, skills and drive to make your
work both pleasant and satisfying.
If you know your way in the CPAN archives, have played with XML::Parser,
wrote serious modules using CGI.pm, then we would like to invite you to send
your CV to yvonne.martens@twinspark.nl
Regards,
Jurgen Hildebrand - Lead Programmer.
------------------------------
Date: Thu, 03 Jun 1999 20:24:54 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: know Perl to maintain Perl (was: Re: I pass an array...)
Message-Id: <37571c88.0@usenet.fccj.cc.fl.us>
In article <7j6276$5pn$2@info2.uah.edu>, gbacon@itsc.uah.edu (Greg Bacon)
wrote:
> Why is Perl the only programming language that seems to be cursed with
> this bizarre requirement of political correctness?
<snip>
> intentionally dumbed down code.
>
> Would you write software documentation in a certain way because it
> would make maintenance easier for someone who doesn't know English?
Larry did say something about Baby Talk Perl :]
But there is no reason not to program any way you
see fit, or can, program. I myself spent some time
with some of the things I've seen here in the group.
I am Baby Perl, pleased to meet you,
-Sneex- :]
______________________________________________________________________
Bill Jones Data Security Specialist http://www.fccj.org/cgi/mail?dss
PS - Please pardon my rantings as I am the proud new father
of a baby girl - Taylor Reese Jones :] No, not into perl, not yet...
------------------------------
Date: Fri, 4 Jun 1999 11:24:03 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: know Perl to maintain Perl (was: Re: I pass an array...)
Message-Id: <ebohlmanFCsvo3.FCx@netcom.com>
Ronald J Kimball (rjk@linguist.dartmouth.edu) wrote:
: Greg Bacon <gbacon@itsc.uah.edu> wrote:
: > Would you write software documentation in a certain way because it
: > would make maintenance easier for someone who doesn't know English?
: If I were planning to distribute my software to people who don't know
: English, yes, of course I would.
A better analogy would be writing software documentation in a certain way
because it would be easier to read for someone who knows nothing about
the problem domain the software is intended for.
: What is wrong with making Perl code accessible?
"Accessible" is semantically meaningless unless it's followed by a
prepositional phrase. Making Perl code accessible *to* a person whose
knowledge of Perl is at least adequate for maintaining code of a certain
level of complexity is certainly a worthy goal. There is a difference
between writing idiomatic code (good) and writing tricky-for-its-own-sake
code (bad).
But demanding that code be "accessible" to someone who doesn't know Perl,
or even worse, to someone who doesn't know programming, is a nonsensical
goal. It amounts to saying "this code needs to be maintainable by people
who don't know what they're doing." Where does such a requirement come
from? Usually from a PHB who wants the benefits of some endeavor without
the costs. TANSTAAFL. It's simply not possible to meet such a
requirement, only to achieve the *appearance* of meeting it.
------------------------------
Date: Fri, 04 Jun 1999 10:46:02 +0200
From: Dominik Leinfelder <dominikl@pyramid.de>
Subject: Re: mkdir() function on NT
Message-Id: <3757924A.A81AFA2D@pyramid.de>
Spike Henning schrieb:
> I would appreciate help with using the mkdir() function work on NT using
> perl, version 5.005_03 binary build 513.
>
> I'm having trouble getting the mkdir function to work. I'm assuming that
> it's related to the permissions aspect since the directory name seems
> straightforward enough
> .
> The actual code is
> $errNo=mkdir("$newdir",0777); where $newdir is f:/mydir.
>
> I've tried hardcoding it as well, but it doesn't change the symptoms. When
> I print $OS_ERROR($!) it says "(Invalid argument)".
I'm not shure, but on Win32 you can't give an set-rights-argument with "md"...
------------------------------
Date: Fri, 4 Jun 1999 14:04:33 +0200
From: "Robert Meppelink" <robert.meppelink@ict.nl>
Subject: Multiple line read from file ??
Message-Id: <7j8f7u$87n$1@tasmania.dev.ict.nl>
Hello everybody I have a question.
I have a file like this:
Label_1:
data
data
data
Label_2:
data
data
Label_3:
data
data
Label_1:
data
data
data
Label_2:
data
data
Label_3:
data
data
Now I want to read the all data line's from Label_1 till Label_2, Label2
till Label_3 etc.
As long as no eof(). Textfile is just normal ASCII and every line ends with
a \n.
I read the PERL FAQ 6 "I'm having trouble matching over more than one line.
What's wrong"
And the related topics, but I can't find something over here.
I use the following code snippet:
open(hVLOG_File, "<" . $VLOG_CMD) or die "Can't open file $VLOG_CMD";
$first_attribute = "Label_1:";
$second_attribute = "Label_2:";
undef $/;
while (<hVLOG_File>){
while(/$first_attribute(.*?)$second_attribute/ms){
print "Data found is: $1\n";
last;
}
}
It read's it correctly once, but it must read several times until eof(). And
when I remove the last; statement it never stops?
Can somebody help me with this ??
Thanx !
------------------------------
Date: Thu, 03 Jun 1999 20:37:20 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: Password Generator
Message-Id: <37571f74.0@usenet.fccj.cc.fl.us>
In article <7j695t$ivs$1@nnrp1.deja.com>, jatgal@my-deja.com wrote:
> Does any one know, any good perl password generators, that will generate
> easy to remember but secure passwords. Please let me know if you know
> any scripts/modules/programs for it or the best way to do it.
>
>
> Thanks
> J
Easy to remember and secure do not
really go together :)
Some ideas at -
http://jacksonville.pm.org/source/xGuessPasswdII
HTH,
-Sneex- :]
______________________________________________________________________
Bill Jones Data Security Specialist http://www.fccj.org/cgi/mail?dss
Jacksonville Perl Mongers
http://jacksonville.pm.org
jax@jacksonville.pm.org
------------------------------
Date: Fri, 04 Jun 1999 09:24:10 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Password Generator
Message-Id: <375899b6.63874867@news.insnet.net>
On Thu, 03 Jun 1999 20:37:20 -0400, "Bill Jones" <bill@fccj.org> said:
>In article <7j695t$ivs$1@nnrp1.deja.com>, jatgal@my-deja.com wrote:
>
>
>> Does any one know, any good perl password generators, that will generate
>> easy to remember but secure passwords.
>
>Easy to remember and secure do not
>really go together :)
A good method is to use a large dictionary, choose two random words
and concatenate them with a random non-alphabetic character in the
middle, eg
vanity5trump
morning$disc
The passwords won't easily fall to a dictionary attack and are long
enough to keep a brute-force cracker busy. It is fairly easy to
remember 'morning-dollar-disc'. Certainly easier than remembering
fos9vn$n.
[Copying newsgroup posts to me by mail is considered rude]
--
David Cantrell, part-time Unix/perl/SQL/java techie
full-time chef/musician/homebrewer
http://www.ThePentagon.com/NukeEmUp
------------------------------
Date: 4 Jun 1999 06:28:45 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Perl BOF @ Usenix
Message-Id: <3757c67d@cs.colorado.edu>
There will be a Birds-of-a-Feather session on Perl this Tuesday night
from 6pm - 8pm at the Usenix General Technical Conference in Monterey CA.
The BOFs are open to all, even walk-in bag ladies. I'm sponsoring
it, but I'll have just taught lecture-only classes to hundreds of
Usenixers for three days in a row there, so my flashy young assistant,
Vanna Torkington, may be doing more of the cat-herding. Larry should
be there, too, so who knows what might happen.
--tom
--
"My past is my own."
--The Shadow (DC Comics)
------------------------------
Date: Fri, 04 Jun 1999 03:15:36 -0400
From: Lev Iserovich <conway@inimage.com>
Subject: perl compilation problems on linux
Message-Id: <37577D18.DE2A0013@inimage.com>
Hey all.
I'm trying to compile a perl 5.005 (currently have 5.003 and the DBI
module wants 5.004)
It compiles finein static mode, but then I can't load the DBI modules
dynamically which was the whole point. :)
When I compile it dynamically, and run 'make test' it fails on many
tests like goto_xs, lib/anydmb, and whole bunch more.
I'm running a glibc2 system (which was upgraded all the way from
Slackware with 1.2.x kernels way back when), so its not exactly your
stock Redhat distro.. My kernel is 2.0.36, my gcc is 2.7.2.3, ld 2.8.1,
any other info I can provide if interested. :)
Also when compiling Perl, make continually complains with something like
this :
Writing Makefile for Errno
==> Your Makefile has been rebuilt. <==
==> Please rerun the make command. <==
false
make[1]: *** [Makefile] Error 1
make[1]: Leaving directory `/home/conway/sybase/perl5.005_03/ext/Errno'
make config failed, continuing anyway...
Is this normal behavior? (I've noticed it does a similar thing when
doing make realclean, etc.)
Well, hope someone got some ideas about this..
--Lev Iserovich
New York University
------------------------------
Date: 4 Jun 1999 10:57:31 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: PERL FOR NT
Message-Id: <3757a30b@newsread3.dircon.co.uk>
sam@cheapnet.co.uk <sam@cheapnet.co.uk> wrote:
> I need some sample scripts for Perl with NT
> I want to create user accounts etc
Apart from the Win32 FAQ that ships with the ActiveState distribution
you might try some of the links from :
<http://www.activestate.com/reference/related_sites.htm>
You also might look at:
<http://dmoz.org/Computers/Programming/Languages/Perl/Win32/>
/J\
--
Jonathan Stowe <jns@gellyfish.com>
------------------------------
Date: Fri, 04 Jun 1999 10:38:19 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Problem with Regexp
Message-Id: <slrn7ldnvu.2b4.sitaram@diac.com>
On Tue, 01 Jun 1999 21:57:47 GMT, stuckenbrock@my-deja.com
<stuckenbrock@my-deja.com> wrote:
>Hello,
>
>i've got a Problem with Regular Expressions. I want to do the following:
>
>I want to match (for example) "Cake" or "Cookies" (insensitive) but both
>have NOT to be leaded by (also for example) "Apple". So that I will
>match "Plumcake","Plumcookies", only "Cake",only "Cookies" but not
>"Applecake" or "Applecookies".
from "man perlre"
(?<!pattern)
A zero-width negative lookbehind assertion. For example
/(?<!bar)foo/ matches any occurrence of "foo" that isn't
following "bar". Works only for fixed-width lookbehind.
Read the fine manual, Sir!
------------------------------
Date: Fri, 4 Jun 1999 08:22:30 -0400
From: james_peregrino@harvard.edu (James Peregrino)
Subject: s/a*/x/g behavior
Message-Id: <1dsv8cx.g67gaf3gp97yN@dcepf5.harvard.edu>
Hi,
I was explaining regular expressions to someone, and as I was
changing expressions around and showing how the results differed, I said
that
$_ = "Haas";
s/a*/x/g;
print "$_\n";
should print out "xxxx". But instead it prints out "xHxxsx". My
reasoning falls apart at the beginning - why doesn't "H" match /a*/ ?
--
James Peregrino (617)496-6288 (v)
Manager of Comp. Services (617)495-5685 (f)
Harvard Div. Cont. Ed.
james_peregrino@harvard.edu
------------------------------
Date: Fri, 04 Jun 1999 06:36:36 GMT
From: lamj@softhome.net
Subject: Socket problem
Message-Id: <7j7s5j$4ur$1@nnrp1.deja.com>
I have tried to write a perl script to connect to telnet port and then
display what is send from that host (basics of socket programming). But
it is kind of strang for the telnet port, it send some garbbage back to
me, it happens in my C program as well, is the telnet port special ???
Anyways, I was trying with SOCK_STREAM, wonder if that is right...
I pulled this script somewhere and tried to modify it to conect to port
23 and display the message from the server... But grabbage comes out....
Can anyone please look at it and tell me what's wrong?
#!/usr/bin/perl -w
use strict;
use Socket;
my ($remote, $port, $iaddr, $paddr, $proto, $line, $m);
print ("Connect OK");
$remote = shift || 'localhost';
$port = shift || 23;
if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') }
die "No port" unless $port;
$iaddr = inet_aton($remote) || die "no host:
$remote";
$paddr = sockaddr_in($port, $iaddr);
$proto = getprotobyname('tcp');
socket(SOCKET, AF_INET, SOCK_STREAM, $proto) || die "socket: $!";
connect(SOCKET, $paddr) || die "connect: $!";
#while (defined($line = <SOCKET>)) {
# $line = <SOCKET>;
# print $line;
#}
$m = ("127.0.0.1");
send(SOCKET, $m, 50, 0);
recv(SOCKET, $line, 500, 3);
print $line;
close (SOCKET) || die "close: $!";
exit;
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 4 Jun 1999 10:09:38 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Socket problem
Message-Id: <375797d2@newsread3.dircon.co.uk>
lamj@softhome.net wrote:
> I have tried to write a perl script to connect to telnet port and then
> display what is send from that host (basics of socket programming). But
> it is kind of strang for the telnet port, it send some garbbage back to
> me, it happens in my C program as well, is the telnet port special ???
> Anyways, I was trying with SOCK_STREAM, wonder if that is right...
>
> I pulled this script somewhere and tried to modify it to conect to port
> 23 and display the message from the server... But grabbage comes out....
>
> Can anyone please look at it and tell me what's wrong?
As tou have pointed out what you are experiencing happens with both
your Perl program an one written in C - reason therefore would suggest
that it is something that the server is doing.
What you are seeing is the server attempting to negotiate the terms of
its connection with your client.
If you want to read more about whats going on you should check out
RFC854 :
<ftp://ftp.isi.edu/in-notes/rfc854.txt>
If you want to play with Sockets you might want to try connecting to a port
which bears a simpler protocol.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
------------------------------
Date: Fri, 04 Jun 1999 12:53:17 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Socket problem
Message-Id: <7j8i8j$57j$1@news.mch.sbs.de>
In article <375797d2@newsread3.dircon.co.uk>, Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>lamj@softhome.net wrote:
[snip]
>If you want to play with Sockets you might want to try connecting to a port
>which bears a simpler protocol.
Many of the low port number were specifically introduced to test socket
programs.
I would recommend port 7 (echo) : send something, and the server will send it
back.
Also port 13 (daytime) : the server will send you the day and time, and close
the connection.
Have fun,
Michel.
------------------------------
Date: Fri, 04 Jun 1999 09:16:58 GMT
From: Richard Lawrence <ralawrence@my-deja.com>
Subject: Subscribing to this NG - how do they do that??
Message-Id: <7j85i6$8bo$1@nnrp1.deja.com>
Not *strictly* a Perl question but vaigly relevant:
I've noticed that when I subscribe to this newsgroup, I get a lovely
email full of information, FAQ's and sites to check out.
How is this done? I'd like to have something like that on a couple of
other newsgroups but I have no idea where to start.
Can anyone give me any pointers?
Cheers
Rich
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 4 Jun 1999 09:09:31 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Trying to make custom start page for users via cookie and perl. Help please?
Message-Id: <375789bb@newsread3.dircon.co.uk>
David Cassell <cassell@mail.cor.epa.gov> wrote:
>
> The person using the name 'Randal Schwartz'
> is actually a little old lady in Kansas who knits afghans.
>
Hmm knit one, perl one, knit one,perl one - Anyhow thats cruelty to those
poor dogs.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
------------------------------
Date: Thu, 03 Jun 1999 21:00:32 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: uninitialized value? what am i doing wrong?
Message-Id: <375724e8.0@usenet.fccj.cc.fl.us>
In article <7j5rnn$kic$1@zonnetje.NL.net>, "Bastiaan S van den Berg"
<office@asc.nl> wrote:
> but billy boy , i have a faint feeling that you might know the answer to the
> question that i posted here ..
>
> do you??
Hmmm, 'faint feeling'?
[Many many retorts flowing thru CPU...]
I will resist...
-Sneex-
------------------------------
Date: Fri, 4 Jun 1999 13:42:31 +0200
From: "Bastiaan S van den Berg" <office@asc.nl>
Subject: Re: uninitialized value? what am i doing wrong?
Message-Id: <7j8e5r$cc3$1@zonnetje.NL.net>
>I will resist...
>-Sneex-
to quite the favorite line in everyone's microsoft-active mind :
resistance is futile..
------------------------------
Date: Fri, 4 Jun 1999 11:44:06 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Weird Warning from conditional
Message-Id: <ebohlmanFCswLJ.Gr3@netcom.com>
Terry Mealy (spike1965@worldnet.att.net) wrote:
: I am writing a rather large script to generate some prices, and I am having
: problems with the following snippet which recurs in a for loop:
: ************************************
: if ( $cities[$#flight] ne $cities[$#flight + 1] ) {
I've got a hunch that you're handling a boundary condition incorrectly.
If you're checking the last city in the list, you're going to be poking
past the end of the list and trying to read an undefined value. Without
looking at more code, it's impossible to say whether this is the case,
but it's a good thing to check for.
------------------------------
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 5884
**************************************