[6745] in Perl-Users-Digest
Perl-Users Digest, Issue: 370 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 25 11:17:12 1997
Date: Fri, 25 Apr 97 08:00:30 -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, 25 Apr 1997 Volume: 8 Number: 370
Today's topics:
Re: C++Builder means Future. <kkev@informix.com>
Can I kill a pipe? (malgosia askanas)
DB_File and complex structures <ben@ronin.com>
Re: deleting the current element from a list (Chipmunk)
Re: Getting E-Mail Address Thorugh CGI <tchrist@mox.perl.com>
Re: help: find pattern, then go down 3 lines <merlyn@stonehenge.com>
Re: need help with a simple (i hope) question. (David Alan Black)
Notice to antispammers <tchrist@mox.perl.com>
Re: Notice to antispammers <mkruse@shamu.netexpress.net>
Re: Notice to antispammers (Nathan V. Patwardhan)
Re: Object IDs are bad (was: Ousterhout and Tcl lost th (Andrew Koenig)
Re: Odd array sizing information <merlyn@stonehenge.com>
Re: Odd array sizing information (Chipmunk)
Re: Odd array sizing information (Eric Bohlman)
Re: OOP & perl <tchrist@mox.perl.com>
Re: Ousterhout and Tcl lost the plot with latest paper (Andrew Koenig)
Perl5 script on sunOS 4.x and Solaris 2.x <hpatel1@csfp.co.uk>
Plug Gateway of Firewall Toolkit <juergen.mueller@lufthansa.com>
Putting an array of structures in a structure using Cla <tlowery@mail.voyager.net>
Re: Puzzle: Count Actual Days from MM,DD,YYY to localti (Bennett Todd)
Q: How does unpack work? <apollock@bit.net.au>
Re: Q: How does unpack work? (Honza Pazdziora)
Re: regular expression (David Alan Black)
Socket.pm and Perl (Craig A. Keefner)
Re: Socket.pm and Perl (Nathan V. Patwardhan)
Re: switch and if (Chipmunk)
Re: Sybperl for NT ? mpeppler@mbay.net
unpack() problem: bug, or just me? (E.)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Apr 1997 21:33:19 GMT
From: "Kumar KEV" <kkev@informix.com>
Subject: Re: C++Builder means Future.
Message-Id: <01bc50f6$f0d81080$2c0fa886@ix-mis-kkev.na.informix.com>
Bob Nelson <bnelson@netcom.com> wrote in article
<bnelsonE8tK0C.8H3@netcom.com>...
> Frank C. Earl <fearl-no-spam-@-no-spam-airmail.net-no-spam-> wrote:
> > On Wed, 16 Apr 1997 16:46:45 -0700, 34110s96@student.csi.cuny.edu
> > wrote:
>
> > >I just got C++Builder and I have never seen a powerful RAD tool like
> > >this one. Forget about the Visual Crap. C++Builder is the King of
the
> > >Hill and not Marketing hype of Microsoft.
Borland C++ Builder, in my book, is second (both in time and quality) to
Optima++ from Powersoft. Optima++ has been out for over a year and it is
also a RAD C++ development environment.
Ciao,
Kumar.
------------------------------
Date: 25 Apr 1997 10:46:49 -0400
From: ma@panix.com (malgosia askanas)
Subject: Can I kill a pipe?
Message-Id: <5jqg4p$kqq@panix2.panix.com>
If my Perl program opens a pipe to "sendmail", is there any way to kill
this pipe without send out the mail, if in the course of processing
it turns out that the mail shouldn't be sent out after all? I am hacking
something that opens a pipe at the very top, and I would love to hack it
without redesigning the entire logic.
Thanks in advance,
-malgosia
------------------------------
Date: Fri, 25 Apr 1997 14:41:51 GMT
From: Ben Smith <ben@ronin.com>
Subject: DB_File and complex structures
Message-Id: <3360C268.2A5CD92C@ronin.com>
Zenin wrote:
I want to use the tie "DB_File" facilities to write complex structures
to disk (hash of hashes and lists). The docs (Programming Perl) seem to
indicate that the only DB structures that come with the distribution are
scalar, list, and hash. Is this the case? Do I need to unravel the
complex structure into a simple hash before writing and then rebuild
the structure after?
------------------------------
Date: 25 Apr 1997 13:43:38 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: deleting the current element from a list
Message-Id: <5jqcea$av3$3@dartvax.dartmouth.edu>
In article <01bc5095$1ecf9100$1d34c69b@leicester.cc.ic.ac.uk>
"Jeff Wilson" <jwilson@ic.ac.uk> writes:
> You could let the array assign itself, as follows ...
>
> @list=('aaa','bbb','ccc','ddd','eee','fff','ggg','hhh','iii');
> for $n (0..$#list) {print "$list[$n] ";}
> print "\n";
>
> for $n (0..$#list) {
> if($list[$n] eq "eee" ) {
> @list=(@list[0..$n-1],@list[$n+1..$#list]);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> }}
>
> for $n (0..$#list) {print "$list[$n] ";}
> print "\n";
>
> ... it works for any element in the list.
Well, if you're going to do that, you might as well use splice:
splice(@list, $n, 1);
Chipmunk
------------------------------
Date: 25 Apr 1997 12:43:38 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Getting E-Mail Address Thorugh CGI
Message-Id: <5jq8tq$ijq$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Anil Gupta <anil@inta.net.au> writes:
:I was wondering, whether it is possible to get someone's E-Mail address
:without them having to give it to you?
This is called violation of privacy. You will be despised and
excoriated. If you want the address, ask. Do not try to secretly
steal it.
:Maybe somehow in Perl thorugh CGi?
This has nothing to do with Perl. Go post to the CGI group, where
they'll tear your head off for chutzpah.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
#ifdef USE_STD_STDIO /* Here is some breathtakingly efficient cheating */
--Larry Wall, from sv.c in the v5.0 perl distribution
------------------------------
Date: 25 Apr 1997 06:47:00 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: niksun@lconn.net (Niksun)
Subject: Re: help: find pattern, then go down 3 lines
Message-Id: <8cyba7fc4r.fsf@gadget.cscaper.com>
>>>>> "Niksun" == Niksun <niksun@lconn.net> writes:
Niksun> foreach ($i = 0; $i <= @lines; $i++) {
Niksun> if ($lines[$i] =~ /pattern/i) {
Niksun> $my_value = substr($lines[$i+3], 4, 2);
Niksun> }
Niksun> }
This code is off-by-one. If @lines has 10 items, we are now iterating
11 times (0 through 10). Personally, to avoid such pains, I keep
my iterations-over-an-array to one of two forms, precisely:
foreach $item (@list) {
...
}
if I don't care about the subscript number, and:
for ($n = 0; $n <= $#list; $n++) {
my $item = $list[$n];
...
}
if I *do* care about the subscript number (which is rare). If you are
just starting out in Perl, you'll get ahead much faster to learn these
exact two forms, and skip the rest of the ways until later. If you
treat these two ways as templates, you'll never be "off by one".
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 494 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 25 Apr 1997 12:54:36 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: need help with a simple (i hope) question.
Message-Id: <5jq9ic$bq7@pirate.shu.edu>
"Christer A. Wittusen" <christer@dtc.se> writes:
>Hi.
>I' m trying to write a message board, but now I got stuck on one line.
>I would be greatfull if someone could help me out and let me know whats
>wrong.
>I get Illegal item (LEXPR) as lvalue in file aktietavlan.pl at line 296,
>next 2 tokens ");"
>here is some is the code.
> open(TEMPLATE,"$message_template") || die "Content-type:
>text/html\n\nCannot open template!";
That's going to put a very strange string in your server's error
log, unless you've done something very fancy with STDERR.
>---->line 296 (undef, $subject, undef, $message_file) =
> split(/::/);
Well, as the error message suggests, you can't assign to undef.
You can assign undef to variables, but not the other way around.
If you want to grab fields 1 and 3, you could do:
($subject, $message_file) = (split(/::/))[1,3];
or soak up the unwanted ones:
($SOAK, $subject, $SOAK, $message_field) = split(/::/);
David Black
dblack@icarus.shu.edu
------------------------------
Date: 25 Apr 1997 12:39:17 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Notice to antispammers
Message-Id: <5jq8ll$ijq$2@csnews.cs.colorado.edu>
I am creating a web page that contains the real addresses of everyone
who posts a bogus address in their mail message. I'm tired of getting
postings I can't reply to, and I don't see why we should suffer just
because you can't keep the spammers off your back. Write your congressman
or something. Meanwhile, all bogus email address will be tracked down,
and the real addresses will be added to the "Please do not spam these
people" page.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"...this does not mean that some of us should not want, in a rather
dispassionate sort of way, to put a bullet through csh's head."
Larry Wall in <1992Aug6.221512.5963@netlabs.com>
------------------------------
Date: 25 Apr 1997 13:29:09 GMT
From: Matt Kruse <mkruse@shamu.netexpress.net>
Subject: Re: Notice to antispammers
Message-Id: <5jqbj5$2pc@news1-alterdial.uu.net>
Tom Christiansen <tchrist@mox.perl.com> wrote:
: I am creating a web page that contains the real addresses of everyone
: who posts a bogus address in their mail message. I'm tired of getting
: postings I can't reply to, and I don't see why we should suffer just
: because you can't keep the spammers off your back. Write your congressman
: or something. Meanwhile, all bogus email address will be tracked down,
: and the real addresses will be added to the "Please do not spam these
: people" page.
Since you respond to a lot of postings, and usually Cc: the author, I can
understand some frustration. But really, people have the right to try to
block email-grabbing bots if they want to. It might be futile, but I'm
seeing a LOT of people doing it these days (I've thought about it).
I say don't waste your time with such a page when you could be doing
something much more productive.
--
Matt Kruse
mkruse@netexpress.net
http://mkruse.netexpress.net/ http://www.mkstats.com/
---------------------------------------------------------------------------
------------------------------
Date: 25 Apr 1997 14:00:18 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Notice to antispammers
Message-Id: <5jqddi$nmf@fridge-nf0.shore.net>
Tom Christiansen (tchrist@mox.perl.com) wrote:
: I am creating a web page that contains the real addresses of everyone
: who posts a bogus address in their mail message. I'm tired of getting
: postings I can't reply to, and I don't see why we should suffer just
: because you can't keep the spammers off your back. Write your congressman
: or something.
I'm personally fond of whois <whatever.com>, where I give the people a
"pleasant" phone call and ask them to knock it off. It that fails, I
follow things in progression. I'm also really kean on e-mail filtering,
where I've eliminated a good portion of the trash into a spam folder (any-
thing not recognized goes into spam), which I parse and check for
addresses.
I'm me and I have my address; I don't like making things difficult for
everyone else.
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Fri, 25 Apr 1997 12:47:08 GMT
From: ark@research.att.com (Andrew Koenig)
Subject: Re: Object IDs are bad (was: Ousterhout and Tcl lost the plot with latest paper)
Message-Id: <E9726L.Aqq@research.att.com>
In article <wujsp0gz0y5.fsf_-_@wistaria.i-have-a-misconfigured-system-so-shoot-me> Peter Ludemann <ludemann@inxight.com> writes:
> ark@research.att.com (Andrew Koenig) writes:
> > Here is a somewhat simplistic example. The following ML code defines a
> > binary-tree data structure where each node contains a value and is
> > either a leaf or has two subtrees:
> >
> > datatype 'a Tree = LEAF of 'a | TREE of 'a Tree * 'a Tree
> > But now suppose we want to be able to identify a specific subtree of a tree.
> > If I had gone to the trouble of creating a tree abstraction in C++, I could
> > identify a particular subtree by the address of its root. But there's no
> > corresponding facility in ML. Trees are values, and although one can compare
> > them for equality, there is no notion of object identity.
> Absolutely correct and correctly so.
> If two things LOOK the same, then they ARE the same. It's called
> "referential transparency" and it's a Good Thing, as opposed to
> "pointers" which are a Bad Thing. Why confuse your life with "object
> identity"?
I think this paragraph, which argues against my local point, nicely proves
my global point, which I will admit is a little more subtle.
My original posting was a response to someone who said something to the
effect that languages without closures, lambda expressions, etc. were
inferior. So I gave an example of a problem I would like to be able to
solve that at least one such langauge does not make easy to solve.
The reply to that is ``You shouldn't be wanting to solve that problem;
not being able to do so is a Good Thing.''
And all I can say to that is ``Some people consider it a Good Thing,
and others do not.'' Which is exactly my global point.
> And why do you want to use the memory address for object identity to
> identify it --- an address can change during garbage collection. Why
> not use a time stamp of object creation? Oh, it's for efficiency
> reasons, you say ... ah-ha!
No, I did not say that. One reason, though, might be that the typical
textbook in classical data structures assumes object identity, so
that expressing such structures without it may require a substantial
translation.
And, although I did not say it before, efficiency sometimes does matter.
> But let's suppose that you really really really do need to identify a
> particular subtree. In other words, you want to NAME it. No problem:
> just create a dictionary (hash table) that maps names to subtrees.
> That'll let you have two differently named entries which might happen
> to have the same values. And it won't expose pointers. And it'll be
> efficient.
Yes and no. In a language that is completely referentially transparent,
generating the names can be a problem, because there is no way to define
a piece of code that represents the abstraction `Each time I build one of
these nodes, I want it to have a globally unique label.' The language
wouldn't be referentially transparent if I could write such a program.
So the knowledge of the labels now has to pervade the entire system.
I imagine that next you're going to say `But you can use monads to solve
that problem.' And indeed I can. Which only proves my point even more.
> Repeat after me: "if two things look the same and act the same, then
> they are the same". Don't depend on some hidden property (pointer) to
> differentiate them. If there are important differences, then don't be
> shy: bring them out in the open and NAME them.
Repeat after me: "Different programming cultures solve problems differently."
Don't assume that the whole world thinks the same way you do. If there
are important differences between how you think and how other people think,
don't be shy: bring them out in the open and NAME them.
But please do not assume that there is only one right way of thinking.
--
--Andrew Koenig
ark@research.att.com
http://www.research.att.com/info/ark
------------------------------
Date: 25 Apr 1997 06:40:58 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Eryq <eryq@enteract.com>
Subject: Re: Odd array sizing information
Message-Id: <8c207zgqz9.fsf@gadget.cscaper.com>
>>>>> "Eryq" == Eryq <eryq@enteract.com> writes:
>> I think Eryq meant to say:
>>
>> $#x == @x - 1
Eryq> Point taken, but actually, I meant to say it as I did: I figured
Eryq> that since it was an answer to a newbie question, I wanted them to see
Eryq> the scalar context and grouping explicitly, via the int() and
Eryq> parens.
Ahh, then to put words in Eryq's mouth one more time (:-), he meant
to say:
$#x = scalar (@x) - 1
The "int" is what's throwing me off. Taking the int of "4" is still
4. There's a fine art to knowing how to simplify text for "newbies"
so that the simple answer doesn't just raise another question. "int"
raises more questions. :-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 494 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 25 Apr 1997 13:15:54 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Odd array sizing information
Message-Id: <5jqaqa$av3$2@dartvax.dartmouth.edu>
In article <335E3E11.2B756B6E@enteract.com>
Eryq <eryq@enteract.com> writes:
> Randal Schwartz wrote:
> >
> > >>>>> "Eryq" == Eryq <eryq@enteract.com> writes:
> >
> > Eryq> $#x == (int(@x) - 1)
> >
> > Hey Eryq, have you been getting a lot of arrays with fractional sizes
> > lately? :-)
>
> Fractional? Heck, I've been working with arrays of with *irrational*
> sizes for a while now (I think a 5MB array has a pretty
> irrational size, don't you?)... I look forward to Perl5.005, which
> I understand will support arrays with both negative and imaginary
> numbers of elements as well... and since most of the work I do is
> imaginary, Perl will once again be the perfect language. ;-)
Does that mean you'll have to stop using Perl when it supports arrays
with
complex numbers of elements?
Chipmunk
------------------------------
Date: Fri, 25 Apr 1997 14:47:27 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Odd array sizing information
Message-Id: <ebohlmanE977r3.4nF@netcom.com>
Chipmunk (Ronald.J.Kimball@dartmouth.edu) wrote:
: Does that mean you'll have to stop using Perl when it supports arrays
: with
: complex numbers of elements?
Logically, a two-dimensional array is equivalent to a one-dimensional
array indexed by complex numbers. Are there any plans to allow
subscripting 2-D arrays with polar coordinates in the near future?
------------------------------
Date: 25 Apr 1997 12:36:15 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: OOP & perl
Message-Id: <5jq8fv$ijq$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
dev.null writes:
:From the lips of Jay Flaherty sprang:
:: http://www.perl.com/perl/nmanual/
:
:What's the difference between www.perl.com and perl.com ?
Today, nothing. In the future, who knows?
:Also, in the CPAN mirrors, many html documents have links pointing to a file
:on the master site, even though they have the file themselves as a mirror.
:Why?
Because I set it up to work on my machine, of course.
Listen, here's your choice: cope with it the way it is, or keep
complaining so that I just remove it all entirely, which would suit me
just fine because then I don't have to listen to any more complaints.
If I had three days free, I could fix it all. But I don't, and I'm not
going to. I cannot begin to have the time in my life right now to do any
web maintenance. In the next 6-8 weeks, I have publisher's deadlines
for one existing book to update, another one to write from scratch,
plus three books to tech-edit, and to top it off I have a bogus 7-figure
nuisance lawsuit to try to get dismissed.
Where do you propose I steal time from that has less importance than
fixing links?
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
If you want to program in C, program in C. It's a nice language. I
use it occasionally... :-)
--Larry Wall in <7577@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: Fri, 25 Apr 1997 13:07:43 GMT
From: ark@research.att.com (Andrew Koenig)
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <E9734v.BFF@research.att.com>
In article <JSA.97Apr24204757@alexandria> jsa@alexandria (Jon S Anthony) writes:
> In article <E93EJr.IBr@research.att.com> ark@research.att.com (Andrew Koenig) writes:
> > C++ built on C precisely so that it would appeal to the existing C community.
> > As a result, support tools, a body of knowledge, and a community came along
> > more readily than they would have if the language had been designed totally
> > from scratch. And that knowledge and community, and those tools, are among
> > the main reasons why C++ is now in widespread commercial use and so many
> > of the designed-from-scratch languages are not.
> I would go further and say this is pretty much the _only_ reason why
> C++ has such widespread use. But, in the current context, this is
> really just the same tired old claim that "C++ is better than X,
> because C++ is more popular than X". A claim that was always dubious
> and which has certainly long since lost any plausibility that it might
> have ever had.
Not at all. Rather, it is a claim that programming is a human phenomenon,
and there can be a huge difference between how useful a tool -- especially
a language -- is in theory and how useful it is in practice.
Several years ago, I was on vacation in Norway and overheard a conversation
in a hotel between an English woman and a member of the hotel staff. It
went something like this:
`I've come here for a week every year for many years,
but I've never been able to learn Norwegian. I'm terribly
sorry about that.'
`Don't be sorry. If you learned Norwegian, who would you
speak it to when you were outside Norway? There are only
about five million speakers of Norwegian in the world.
We know that if we don't want to isolate ourselves, we have
to learn English.'
Now, English is a mess of a language. Its spelling rules are atrocious,
its grammar is unruly, it has far too many ways to say the same thing,
and even so, it is hard to talk about people without revealing information
about them, such as their gender, that may be irrelevant.
I have no doubt that speakers of many languages consider their languages
to be superior to English. They may even be right. But for many people,
especially those who live in or near English-speaking communities,
English is more useful.
So it is also with programming languages. If C++ had not built on C, it
would never have gotten out of the starting gate. So it had no choice
but to inherit its computational model from C. Many people consider other
computational models better, but there is far from a consensus as to
which one to use. So the C model, which C++ uses, remains the common tongue.
This is a behaviorial observation, not a value judgement.
--
--Andrew Koenig
ark@research.att.com
http://www.research.att.com/info/ark
------------------------------
Date: Fri, 25 Apr 1997 14:55:08 +0100
From: Hitesh Patel <hpatel1@csfp.co.uk>
Subject: Perl5 script on sunOS 4.x and Solaris 2.x
Message-Id: <3360B7BC.41C67EA6@csfp.co.uk>
I have a very simple perl5 script which uses the Sybase CTlib package.
When I run it on sunOS it works OK, but on Solaris I get the following
error, with diagnostics turned on :
Open Client Message:
Message number: LAYER = (5) ORIGIN = (3) SEVERITY = (5) NUMBER = (131)
Message String: ct_init(): network packet layer: internal net library
error: Netlib state error - Netlib initialization may have failed
Uncaught exception from user code:
Sybase::CTlib initialize: ct_init() failed at
/usr/local/lib/perl5/DynaLoader.pm line 153.
DynaLoader::bootstrap called at
/usr/local/lib/perl5/site_perl/Sybase/CTlib.pm line 862
require Sybase/CTlib.pm called at t7 line 22
main::BEGIN called at /usr/local/lib/perl5/DynaLoader.pm line 0
eval {...} called at /usr/local/lib/perl5/DynaLoader.pm line 0
BEGIN failed--compilation aborted at t7 line 22.
The line 22 in my perl5 script (called t7) is : "use Sybase::CTlib;"
When I use DBLib by including the Sybperl package, i.e. "use
Sybase::Sybperl;" , I get :
DB-Library: Unknown network type found in interface file.
In both cases the scripts dont even get to the stage of running the
simple SQL statement. Is this a Perl OR Sybase CT lib Problem or Sun
Solaris???
Any help or ideas on this.
--
Hitesh Patel
------------------------------
Date: Fri, 25 Apr 1997 13:10:31 +0200
From: Juergen Mueller <juergen.mueller@lufthansa.com>
Subject: Plug Gateway of Firewall Toolkit
Message-Id: <33609126.BF6F19AA@lufthansa.com>
Hi!
I'm looking for a small script or module to connect to servers over a
third one. Functionality should
be the same like the plug gateway of the Firewall Toolkit, but written
in perl.
Host A -> Host B -> Host C
1234 25
The script, sitting on host B listens to port 1234. If host A connects
to that port,
host b opens a connection to host c on port 25 and passes all the
traffic from
host a to host c and back.
I played around with the server example of the blue camel book, but I
could only
astablish a one-way connection. I saw all data typed in at A appearing
on C, but
everything from C was lost in space.
Any hints?
Thanks,
Juergen
------------------------------
Date: 25 Apr 1997 13:31:38 GMT
From: "Thomas A. Lowery" <tlowery@mail.voyager.net>
Subject: Putting an array of structures in a structure using Class::Template
Message-Id: <01bc517c$b44756e0$338a19c6@tlowery.dsac.dla.mil>
I'm attempting to load data base table information into a struct:
struct( 'ParentTable' => {
schema => '$',
TableName => '$',
Columns => '%',
children => 'child' # I want this to be an array of structs
(children tables)
});
struct ('child' => { TableName => '$', Columns => 'childcolumn' } );
struct ( 'childcolumn' => { column_name => '%' } );
What I'm looking for is
ParentTable->children->Tablename[]
ParentTable->children->Tablename[]->Columns->column_name{}
ParentTable->children->Tablename[]
ParentTable->children->Tablename[]->Columns{}
or
ParentTable->children->Tablename{}
ParentTable->children->Tablename{}->Columns->column_name{}
Thank you for pointing me in the right direction.
Tom
------------------------------
Date: 25 Apr 1997 12:31:13 GMT
From: bet@network.rahul.net (Bennett Todd)
Subject: Re: Puzzle: Count Actual Days from MM,DD,YYY to localtime(time) - REQ: Easier Way
Message-Id: <slrn5m190h.qq7.bet@waltz.rahul.net>
Why not
perl -MDate::Parse -le 'print int((str2time("YYYY-MM-DD") - time) / 86400)'
I think that's pretty near to as easier as it gets.
I get Date::Parse (and it's companion Date::Format) from
<URL:http://perl.org/CPAN/authors/id/GBARR/TimeDate-1.07.tar.gz>.
-Bennett
------------------------------
Date: 25 Apr 1997 13:06:56 GMT
From: "Andrew Pollock" <apollock@bit.net.au>
Subject: Q: How does unpack work?
Message-Id: <01bc5179$8848db20$011618cb@caesar.bit.net.au>
Hi,
I'm trying to pull apart the output of a "last" under Unix, and as you can
see, with output like this
=== BEGIN SAMPLE ===
onyx tty62 Fri Apr 25 23:01 still logged in
voxel tty59 Fri Apr 25 23:01 still logged in
herbie tty55 38400/33600 LAP Fri Apr 25 23:00 - 23:01 (00:00)
berlin tty63 Fri Apr 25 22:58 still logged in
billw tty53 Fri Apr 25 22:57 still logged in
sassy tty50 38400/31200 LAP Fri Apr 25 22:52 still logged in
wildfire tty47 38400/33600 LAP Fri Apr 25 22:50 - 22:58 (00:07)
d-gamble tty45 38400/31200 LAP Fri Apr 25 22:49 still logged in
d-gamble tty44 38400/31200 LAP Fri Apr 25 22:47 - 22:48 (00:00)
terra tty42 38400/28800 LAP Fri Apr 25 22:47 still logged in
d-gamble tty38 38400/31200 LAP Fri Apr 25 22:46 - 22:46 (00:00)
tyson tty37 38400/14400 LAP Fri Apr 25 22:46 still logged in
wakerley tty35 Fri Apr 25 22:45 still logged in
adamsj tty34 38400/16800 LAP Fri Apr 25 22:44 - 22:50 (00:05)
amccall tty33 38400/31200 LAP Fri Apr 25 22:43 still logged in
fletch tty32 Fri Apr 25 22:42 - 22:44 (00:01)
fletch tty30 Fri Apr 25 22:40 - 22:42 (00:01)
mjp ttyp2 atlas.bit.net.au Fri Apr 25 22:40 - 22:41 (00:01)
=== END SAMPLE ===
splitting on whitespace (or any other regexp I can think of) doesn't cut
the mustard. Now my trusty camel book says that for fixed field splitting,
use unpack. The problem is, I can't understand what the camel book as to
say on pack/unpack. I'd like to be able to split the above listing into
it's various fields if possible.
Can anyone give me a crash course in pack/unpack or point me to something
that directly reads the /etc/wtmp file?
I'm trying to write a script to look for dormant accounts.
Thanks.
Andrew
--
----
Andrew Pollock Senior (hey I'm the only one) Programmer
apollock@bit.net.au http://www.bit.net.au/~apollock
Brisbane Internet Technology
------------------------------
Date: Fri, 25 Apr 1997 14:19:02 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Q: How does unpack work?
Message-Id: <adelton.861977942@aisa.fi.muni.cz>
"Andrew Pollock" <apollock@bit.net.au> writes:
> Hi,
>
> I'm trying to pull apart the output of a "last" under Unix, and as you can
> see, with output like this
>
> === BEGIN SAMPLE ===
> onyx tty62 Fri Apr 25 23:01 still logged in
> voxel tty59 Fri Apr 25 23:01 still logged in
> herbie tty55 38400/33600 LAP Fri Apr 25 23:00 - 23:01 (00:00)
> berlin tty63 Fri Apr 25 22:58 still logged in
> billw tty53 Fri Apr 25 22:57 still logged in
> sassy tty50 38400/31200 LAP Fri Apr 25 22:52 still logged in
> wildfire tty47 38400/33600 LAP Fri Apr 25 22:50 - 22:58 (00:07)
> d-gamble tty45 38400/31200 LAP Fri Apr 25 22:49 still logged in
> d-gamble tty44 38400/31200 LAP Fri Apr 25 22:47 - 22:48 (00:00)
> terra tty42 38400/28800 LAP Fri Apr 25 22:47 still logged in
> d-gamble tty38 38400/31200 LAP Fri Apr 25 22:46 - 22:46 (00:00)
> tyson tty37 38400/14400 LAP Fri Apr 25 22:46 still logged in
> wakerley tty35 Fri Apr 25 22:45 still logged in
> adamsj tty34 38400/16800 LAP Fri Apr 25 22:44 - 22:50 (00:05)
> amccall tty33 38400/31200 LAP Fri Apr 25 22:43 still logged in
> fletch tty32 Fri Apr 25 22:42 - 22:44 (00:01)
> fletch tty30 Fri Apr 25 22:40 - 22:42 (00:01)
> mjp ttyp2 atlas.bit.net.au Fri Apr 25 22:40 - 22:41 (00:01)
> === END SAMPLE ===
>
> splitting on whitespace (or any other regexp I can think of) doesn't cut
> the mustard. Now my trusty camel book says that for fixed field splitting,
> use unpack. The problem is, I can't understand what the camel book as to
> say on pack/unpack. I'd like to be able to split the above listing into
> it's various fields if possible.
>
> Can anyone give me a crash course in pack/unpack or point me to something
> that directly reads the /etc/wtmp file?
What exactly in the man page don't you understand?
Quick'n'dirty parsing would be:
while (<>)
{
chomp;
($name, $tty, $host, $date, $time) = unpack 'A10A13A17A11A*', $_;
print "name: $name, tty: $tty, host: $host, date: $data, time: $time\n";
}
I use A which mean ASCII string and strip triling spaces, number
behind it specifies length of the string.
Hope this helps.
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: 25 Apr 1997 12:36:52 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: regular expression
Message-Id: <5jq8h4$ahr@pirate.shu.edu>
Hello -
Philippe Febbraro <febbraro@aleatoire.mathp7.jussieu.fr> writes:
>the script:
>
>#!/bin/perl
>chop($regexp=<STDIN>);
>print "$regexp\n";
>while (chop($ch=<STDIN>)) {
> if ($ch =~ /$regexp/ ) {
>print "True\n"
>} else {
>print "False\n"
>}
>}
>Where is wrong ?
>If I want sentences who match "Got" or "Symlink" at the begining of
>the line, I write the regexp: (^(Got|symlink)), and I got what I want
>to match.
>But when I want sentences WHO NOT MATCH "Got" or "Symlink" at the begining of
>the line, I write the regexp: (^(?!(Got|symlink))) and it fails to
>match what I want: lines who begin with "Got" or "Symlink" are matched
>too !
I can't duplicate your error:
orpheus:~/perl$ perl testreg
(^(?!(Got|symlink)))
(^(?!(Got|symlink)))
Vom Himmel hoch da komm' ich her
True
Gottes Zeit ist die allerbeste Zeit
False
I notice that you've got "Symlink" in your description and
"symlink" in your regex - not direct evidence of what you
typed in, but it's the only clue I can spot.
David Black
dblack@icarus.shu.edu
David Black
dblack@icarus.shu.edu
------------------------------
Date: 25 Apr 1997 06:05:01 -0700
From: keefner@wavefront.com (Craig A. Keefner)
Subject: Socket.pm and Perl
Message-Id: <33605728.891972@news.primenet.com>
I'm trying to take a look at a program called Linkscan.pl for indexing
a www server and I am having trouble running it under the perl
on my sun. I am hoping someone can "instantly" see why I'm unable
to run it.
Current error I get...
> perl /ns-home/docs/linkscan/linkscan.pl
Can't load module Socket, dynamic loading not available in this perl.
(You may need to build a new perl executable which either supports
dynamic loading or has the Socket module statically linked into it.)
at Socket.pm line 272
BEGIN failed--compilation aborted at
/ns-home/docs/linkscan/linkscan.pl line 24.
> perl -v
This is perl, version 5.003 with EMBED
built under solaris at Sep 14 1996 22:39:00
+ suidperl security patch
Copyright 1987-1996, Larry Wall
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5.0 source
kit.
The perl install as is did not come with a copy of Socket.pm so I
downloaded it from CPAN and then ran the makefile with GCC.
In my /usr/local/perl5 directory I had to make the subdirs "auto"
for putting in the autosplit.ix etc and I did that. Before then of
course running the script would err out as not being able to find
autosplit or Socket.
Help?
Craig
------------------------------
Date: 25 Apr 1997 14:02:46 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Socket.pm and Perl
Message-Id: <5jqdi6$nmf@fridge-nf0.shore.net>
Craig A. Keefner (keefner@wavefront.com) wrote:
: Can't load module Socket, dynamic loading not available in this perl.
: (You may need to build a new perl executable which either supports
: dynamic loading or has the Socket module statically linked into it.)
: at Socket.pm line 272
Your Perl (probably) hasn't been built for dynamic loading. You should
ask your sysadmin about this, or trying re-building if you're your sysadmin;
you might read the install docs about dynamic loading on various platforms.
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: 25 Apr 1997 13:13:47 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: switch and if
Message-Id: <5jqamb$av3$1@dartvax.dartmouth.edu>
In article <335F177A.7BAF@prestel.net>
iqbal gandham <igandham@prestel.net> writes:
> Yes but that was just a thought, I need to know if it really is more
> effecient. The if and elsif statements also fall out when the "pattern"
> is matched, just as the switch statement does.
You should probably read the other posts in this thread before trying
to actually use a switch statement in Perl.
Chipmunk
------------------------------
Date: Fri, 25 Apr 1997 09:41:11 -0600
From: mpeppler@mbay.net
To: novak@microcomp.de
Subject: Re: Sybperl for NT ?
Message-Id: <861978886.1948@dejanews.com>
In article <335F81A1.31A3@microcomp.de>,
novak@microcomp.de wrote:
>
> Hallo !
>
> I tried to find Sybperl for NT. On archives I found only Unix versions.
> Any hints ?
Try ftp://ftp.name.net/pub/sybperl, or http://www.mbay.net/~mpeppler
Michael
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 25 Apr 1997 05:15:01 -0700
From: erisson@kallisti.sw-tech.com (E.)
Subject: unpack() problem: bug, or just me?
Message-Id: <slrn5m1815.c95.erisson@kallisti.sw-tech.com>
Given the following code snippet:
#!/usr/bin/perl -w
chomp($sucko=<>);
$encoded = pack("u",$sucko);
chomp($encoded);
print "encoded:\n$encoded\n";
$decoded = unpack("u",$encoded); # This is the offending line.
chomp($decoded);
print "decoded:\n$decoded\n";
if ($sucko eq $decoded) {
print "passed\n";
} else {
print "failed\n";
}
I get the following result, consistently:
% ./encode.pl
blah
encoded:
$8FQA:```
Use of uninitialized value at ./encode.pl line 7, <> chunk 1.
decoded:
blah
passed
%
I've thrown in chomp()s, I've taken out chomp()s, I've used strict, I've
used "perl -w00", I've enclosed the arguments to pack() in () and "",
I've run it under the debugger (which told me nothing I could understand),
I've checked Llama and the "Perl 5 Desktop Reference" (Camel 2 is hidden
under some clutter at the moment)... I cannot get rid of that error. I
thought that perhaps "use diagnostics;" would help, but having tried that
on two different machines now (my Linux box and my ISP's BSDI box) and
failed (the error starts out "couldn't find diagnostic data in..." and ends
"BEGIN failed--compilation aborted at ./encode.pl line 2, <POD_DIAG> chunk
507."), I'm at the end of my rope.
'perl -v' gives me:
This is perl, version 5.003 with EMBED
built under linux at Jun 27 1996 02:46:39
+ suidperl security patch
However, I fear this is not a perl problem; I fear the fault lies in my
understanding of pack() and unpack(), but what am I missing? The error
indicates an uninitialized value, and there ISN'T ONE, is there? "u"
isn't uninitialized, and since it prints it out right before the error,
I'm pretty sure that $encoded isn't uninitialized... What IS?
Please, tell me this is a bug. Or, failing that, tell me where the
glaring error that I cannot see is. Please.
-E
--
PGP Public Key Fingerprint: BE FC C5 FB 30 47 E5 5C DC DF C3 C0 AD A5 27 17
Homepage: http://www.primenet.com/~fnargle/erisson/ PGP Key available here
"Every day is like burning paper." --Slimebard
"You have *not* 'plonked' me!" --Mario1
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
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 370
*************************************