[12399] in Perl-Users-Digest
Perl-Users Digest, Issue: 5999 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 15 09:08:09 1999
Date: Tue, 15 Jun 99 06:00:19 -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 Tue, 15 Jun 1999 Volume: 8 Number: 5999
Today's topics:
Backtits and tainting <staab@linopress.com>
Re: Backtits and tainting (Marcel Grunauer)
Re: Backtits and tainting <staab@linopress.com>
Re: Case select statements: are they in Perl? (Abigail)
Re: Case select statements: are they in Perl? armchair@my-deja.com
Re: Case select statements: are they in Perl? (Bart Lateur)
Re: DBI connect statement <garethr@cre.canon.co.uk>
Re: doesn't work on-line (Abigail)
Re: Dynamic Regular Expression (Abigail)
Re: Dynamic Regular Expression <cschmitz@stud.informatik.uni-trier.de>
Re: Dynamic Regular Expression (Bart Lateur)
Re: examples (Abigail)
Get last execution time for a cron job <silee@hk.super.net>
Re: Get last execution time for a cron job (Malcolm Ray)
Re: how do i make a Multi Dimensional array? <simon@profero.com>
Re: overwrite "print" ? (Abigail)
Re: Perl "constructors" armchair@my-deja.com
Re: Perl "constructors" armchair@my-deja.com
Re: Perl "constructors" armchair@my-deja.com
Re: PerlScript ... what features are missing? <matt.sergeant@ericsson.com>
Re: Regular expressions against keys in a hash (Marcel Grunauer)
Re: Regular expressions against keys in a hash <garethr@cre.canon.co.uk>
STDERR & Windows <ccu@ohpleasedontspamme.sbk-ks.de>
Re: STDERR & Windows (Bart Lateur)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 15 Jun 1999 11:53:28 +0200
From: Peter Staab <staab@linopress.com>
Subject: Backtits and tainting
Message-Id: <37662298.B74B0B58@linopress.com>
Hello
Ist it possible to disable the tainting.
I want to to something like
$out = ` $com`;
and $com is delivered from a file.
For the perl-skript the s-bit is set.
I get the error : 'Insecure dependency...'
I try to solve it with .
if ($com=~ /\w/)
{
$com = $1;
}
else
{
$com = $1;
}
$out = ` $com`;
But then I get the error:
'Insecure $ENV{PATH} while running setuid '
How can I use the backtits without getting these error messages or ist
there another solution ?
Thanx
Peter Staab
------------------------------
Date: Tue, 15 Jun 1999 10:55:13 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: Backtits and tainting
Message-Id: <376b30f6.8144771@enews.newsguy.com>
On Tue, 15 Jun 1999 11:53:28 +0200, Peter Staab <staab@linopress.com>
wrote:
>How can I use the backtits ...
Shurely shome mishtake?
Marcel
------------------------------
Date: Tue, 15 Jun 1999 14:08:06 +0200
From: Peter Staab <staab@linopress.com>
Subject: Re: Backtits and tainting
Message-Id: <37664226.6341F264@linopress.com>
Marcel Grunauer wrote:
> On Tue, 15 Jun 1999 11:53:28 +0200, Peter Staab <staab@linopress.com>
> wrote:
>
> >How can I use the backtits ...
>
> Shurely shome mishtake?
of course i mean backtick
sorry .... but my question remains
>
>
> Marcel
------------------------------
Date: 14 Jun 1999 19:44:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Case select statements: are they in Perl?
Message-Id: <slrn7mb8ta.cmq.abigail@alexandra.delanet.com>
R.Joseph (streaking_pyro@my-deja.com) wrote on MMCXIII September MCMXCIII
in <URL:news:7k27bg$h32$1@nnrp1.deja.com>:
\\ In VB you have CASE, in C/C++ you have Switch(), in Perl you have ____
\\ (please fill in the blank). Is there a case select statement in Perl,
\\ or am I looking forward to a wrechted life of writing "if" and "elsif"
\\ alot? Any help is greatly apprecitaed!
Did you bother to grep the manual for 'switch'?
I didn't think so.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Tue, 15 Jun 1999 10:14:24 GMT
From: armchair@my-deja.com
Subject: Re: Case select statements: are they in Perl?
Message-Id: <7k591s$if1$1@nnrp1.deja.com>
> You could try reading the documentation that comes with perl. You'll
> find the answer faster, you'll learn your way around the
> documentation so
> you can find other answers faster, and you won't ask a FAQ.
Regarding "documentation that comes with Perl" and the "documentation
write in front of you", since O'Reilly is into Perl big time, why don't
they come out with a book version of the "perl manual".
>
> Which part of the answer to this FAQ did you not understand ?
>
> perlfaq7: How do I create a switch or case statement?
>
> Or did you completely ignore the documentation in front of you and
> decide to ask in a newsgroup instead.
> Have you ever considered that other
> people's time might actually be valuable and that you should do
> some research before wasting it?
Have you ever considered that if you had a comp.lang.perl.beginner and a
comp.lang.perl.guru you wouldn't have to spend your "valuable time"
hectoring people trying to learn Perl. But of course you have, as have
the others...
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 15 Jun 1999 12:32:35 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Case select statements: are they in Perl?
Message-Id: <37684761.22581260@news.skynet.be>
armchair@my-deja.com wrote:
>the "documentation write in front of you"
That's weird English.
Bart.
------------------------------
Date: Tue, 15 Jun 1999 10:41:17 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: DBI connect statement
Message-Id: <sir9ndzqya.fsf@cre.canon.co.uk>
weazies@yahoo.com wrote:
> DBI:mysql:mysql:localhost:port=3309:socket=/tmp/mysqld-new.sock
This isn't a valid MySQL datasource name. Options are separated by
semicolons, and it's `mysql_socket', not `socket'. Try
DBI:mysql:database=mysql;host=localhost;port=3309;mysql_socket=/tmp/mysqld-new.sock
See the DBD::mysql manpage for the details.
--
Gareth Rees
------------------------------
Date: 14 Jun 1999 21:46:14 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: doesn't work on-line
Message-Id: <slrn7mbg42.cmq.abigail@alexandra.delanet.com>
Leonid Goltser (leonid76@erols.com) wrote on MMCXIII September MCMXCIII
in <URL:news:7k1l41$88o$1@autumn.news.rcn.net>:
:: I uploaded my perl script and when I try to access it, Explorer says
:: "you might not have permission to view this directory or page using the
:: credentials you supplied."
:: The script works perfectly on my PC, but Ie can't find it.
:: Is it possible my provider's server doesn't support perl?
It could be. But wouldn't you think your provider knows better whether
they do than this newsgroup?
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 14 Jun 1999 19:48:56 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Dynamic Regular Expression
Message-Id: <slrn7mb984.cmq.abigail@alexandra.delanet.com>
Pamela Goldfarb (pamelag@interlog.com) wrote on MMCXIII September
MCMXCIII in <URL:news:7k1qcg$7qu$1@news.interlog.com>:
\\
\\ I know that I can build a string
\\
\\ $w="a|b";
\\
\\ and /$w/i will match $_ if it contains either a or b,
\\ but is there a way to do the same thing for "a" and "b"?
As found in the cookbook: /^(?=.*a)(?=.*b)/
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 15 Jun 1999 10:52:22 GMT
From: Christoph Schmitz <cschmitz@stud.informatik.uni-trier.de>
Subject: Re: Dynamic Regular Expression
Message-Id: <7k5b96$2rt$1@fu-berlin.de>
Tom Christiansen <tchrist@mox.perl.com> wrote:
: [courtesy cc of this posting mailed to cited author]
: In comp.lang.perl.misc,
: bart.lateur@skynet.be (Bart Lateur) writes:
: :>Per usual, I see no reason for an eval().
: :It is necessary, if this is modified so that the "code" string in
: :$subtext is generated dynamically from the user query.
: So what? That's what qr// is for. :-)
Ooops, mea culpa. I didn't know about qr//. It's new in 5.005, isn't it?
Of course, you'd use qr// for this task if you _knew_ about it :-)
Christoph
--
-- Christoph Schmitz <cschmitz(at)stud.informatik.uni-trier.de> --
If it is a Miracle, any sort of evidence will answer, but if it is a Fact,
proof is necessary.
-- Samuel Clemens
------------------------------
Date: Tue, 15 Jun 1999 11:10:15 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Dynamic Regular Expression
Message-Id: <37663379.17485318@news.skynet.be>
Abigail wrote:
>As found in the cookbook: /^(?=.*a)(?=.*b)/
$_ = "I got an 'a'\nand a 'b'";
print ^?'yup':'nope';
=>
nope
Make that:
/^(?=.*a)(?=.*b)/s
Bart.
------------------------------
Date: 14 Jun 1999 22:09:56 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: examples
Message-Id: <slrn7mbhgd.cmq.abigail@alexandra.delanet.com>
Lucas Hernandez (hernal@champint.com) wrote on MMCXIII September MCMXCIII
in <URL:news:7k3hrt$7m1$1@sneezy.strategicit.net>:
""
"" I'm trying to find out how to create a html code able to call a pearl script
"" under windows platform..
You might want to ask in alt.music.blueoystercult for pearl scripts.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Tue, 15 Jun 1999 18:59:39 +0800
From: "Simon Lee" <silee@hk.super.net>
Subject: Get last execution time for a cron job
Message-Id: <7k5c1k$deg$1@hfc.pacific.net.hk>
Hi all,
Does anyone know how to get the last execution time for a cron job ? For
example, I get a cron job entry:
0 23 * * * /opt/scripts/unix_backup.sh
If the current time is 'Tue Jun 15 18:57:08 1999', the last execution should
be 'Mon Jun 23:00:00 1999' <-- I just want to get this.
Any idea ?
Thanks,
Simon
------------------------------
Date: 15 Jun 1999 11:47:15 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: Get last execution time for a cron job
Message-Id: <slrn7mcfa3.vki.M.Ray@carlova.ulcc.ac.uk>
On Tue, 15 Jun 1999 18:59:39 +0800, Simon Lee <silee@hk.super.net> wrote:
>Hi all,
>
>
>Does anyone know how to get the last execution time for a cron job ? For
>example, I get a cron job entry:
>
>0 23 * * * /opt/scripts/unix_backup.sh
>
>If the current time is 'Tue Jun 15 18:57:08 1999', the last execution should
>be 'Mon Jun 23:00:00 1999' <-- I just want to get this.
>
>
>
>Any idea ?
And your perl question is...?
Some flavours of cron can be persuaded to log their actions - consult
your cron manpage. You *could* read that logfile, though this is rather
non-portable. A better method would be to modify the cron job to write
a timestamp to a file, which you could then read.
--
Malcolm Ray University of London Computer Centre
------------------------------
Date: Tue, 15 Jun 1999 13:11:44 +0100
From: Simon <simon@profero.com>
Subject: Re: how do i make a Multi Dimensional array?
Message-Id: <37664300.CE625276@profero.com>
Bastiaan S van den Berg wrote:
> just wondering if everyone ever used one of these , and could shake some
> code to explain it to me..
>
> couldn't find anything in perlref & perldata :(
Try pod/perlol (lists of lists) :)
from that very document
"A list of lists, or an array of an array if you would, is just a regular
old array @LoL that you can get at with two subscripts, like $LoL[3][2].
Here's a declaration of the array:
# assign to our array a list of list references
@LoL = (
[ "fred", "barney" ],
[ "george", "jane", "elroy" ],
[ "homer", "marge", "bart" ],
);
print $LoL[2][2];
bart
" ... and ..."
@tmp = split;
push @LoL, [ @tmp ];
"
and so on
------------------------------
Date: 14 Jun 1999 21:20:36 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: overwrite "print" ?
Message-Id: <slrn7mbejv.cmq.abigail@alexandra.delanet.com>
Tom Christiansen (tchrist@mox.perl.com) wrote on MMCXIII September
MCMXCIII in <URL:news:376515d8@cs.colorado.edu>:
!!
!! Anyway, the answer is that yes, print() is special and may not be
!! overridden.
Really? See sig.
!! And here are those keywords that *are* able to be overridden--at least
!! in theory. In practice, some of these make no sense, like the named
!! boolean operators, CORE, and a few others. The three double-underscore
!! tokens are certainly odd to contemplate.
Well, see sig.
!! The metric I use here is the one in /usr/src/perl/toke.c.
!!
!! Those functions that may be overridden are:
!!
!! % perl -nle 'print $1 if /return\s+KEY_(\w+)/' toke.c
!!
!! Those functions that may not be overridden are:
!!
!! % perl -nle 'print $1 if /return\s*-KEY_(\w+)/' toke.c
!! ^
!! This means that you ^
!! cannot override the ^
!! keyword in question --> ^
Uhm. 'grep KEY___PACKAGE__ toke.c' gives me 'return -KEY___PACKAGE__'.
Sig that overrides both print and __PACKAGE__ follows.
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Tue, 15 Jun 1999 10:56:19 GMT
From: armchair@my-deja.com
Subject: Re: Perl "constructors"
Message-Id: <7k5bgh$j3d$1@nnrp1.deja.com>
In article <7k3d72$u1n$1@nnrp1.deja.com>,
John Porter <jdporter@min.net> wrote:
> In article <7k29mh$hmv$1@nnrp1.deja.com>,
> armchair@my-deja.com wrote:
> > No amount of blather about object code, real machines, and virtual
> > machines can change the fact that we are talking about and
> > comparing source code.
>
> As I observed before, we are, it is quite apparent, talking about
> two (or more) different things. I was talking about language
> design and implementation. You are talking about irrelevant things.
As I observed before, while we were talking about source code, once you
got stuck on claiming that C was "portable assember" and were unable
to show that it was, you had to then start this charade about "real
machines" and "virtual machines" and "look at the object code a C
compiler puts out".
>
>> The equivalence of the if/while/for logic of C and C++ was
>> mentioned to
>> show a common feature with that of Perl, and to aptly
>> demonstrate that
>> any comparison of C to assembler is absurd.
>
> Even granting (which I am not) that Perl's if/while/for logic is
> identical to C's, that says nothing about C's equivalence to asm.
> Every line of C code you write has an equivalent corresponding
> construction in asm. C's intrinsic data types are all machine
> data types. Pointers in C are simply machine addresses. Perl
> doesn't know from machine data, opcodes, addresses, or anything
> else about the machine.
I'll will be happy to give you another chance to prove that C is
equivalent to assembler. Give me the equivalent assembler source code
for the following:
int i = 0,j =0;
for ( ; i < 10; i++)
for ( ; j < 10; j++)
print ("i/j %d/%d\n",i,j);
>
> > > Syntactic difference/equivalence is quite irrelevant.
> >
> > Only to fellows who repeatedly try and argue that assembler is
> > equivalent to C.
>
> Or rather, it's only relevant to fellows who lack the background
> and/or cognitive abilities to recognize the equivalence of the two.
Would that background include a tour as a Moonie?
>
> > And we are talking about syntactic equivalence/equality.
>
> Well, some of us are.
In fact, at one time we both were. That was until you got oddly stuck on
claiming that C and Assembler were equivalent, at which point you
desperately began pontificating about "machines".
>
> > Allow me to give you credit for something.
>
> What you do with your worthless credit is your own business.
I would think that fellows who persist in calling C "portable assembler"
would cherish any credit they got, and not sullenly toss it aside.
>
> > > Nope, I'm not out to show that "using C is equivalent
> > > to using asm".
> > > I'm talking about the design of the languages
> > > themselves, primarily
> > > the semantics. Too much of the usability of a
> > > language is dependent
> > > on other things, like the availability and quality of development
> > > tools.
> >
> > Ah, finally an admission that C is not equivalent to assembler.
>
> Not the admission you were hoping for.
> Interesting (well, not really) that you first demand that C and asm
> be syntactically similar for them to be "equivalent", and now you'll
> accept that having unequal tool support is sufficient for them
> to be "not equivalent".
Oh, still back to C and assembler source code are equivalent are you.
Do give me the equivalent assembler source code for:
int i = 0,j =0;
for ( ; i < 10; i++)
for ( ; j < 10; j++)
print ("i/j %d/%d\n",i,j);
>
> > > I feel confident that you will not be convinced of the
> > > equivalence of
> > > the code, regardless of who or what does the translation.
> >
> > Since we are talking about source code, looking at anything
> > else would
> > be irrelevant. But you knew that.
>
> If indeed we were talking about source code.
> But we (at least some of us) are talking about language design,
> semantics, and implementation.
We were both talking about source code, until some of us got stuck on
the rediculous claim that C source code was "portable assembler".
>
> > > > Show me how this C code is not
> > > > more powerful than the equivalent assembler code by
> > > > showing me the
> > > > equivalent assembler code...
> > >
> > > Ridiculous.
> >
> > Certainly was...
>
> Yes indeed. It's ridiculous to suppose that some code in C is
> more powerful, by any definition, than its asm equivalent.
Really, then show me the equivalently powerful assembler code for this C
code:
int i = 0,j =0;
for ( ; i < 10; i++)
for ( ; j < 10; j++)
print ("i/j %d/%d\n",i,j);
>
> > Before someone could right a C++ string class that "behaved
> > like a Perl
> > string", you would have to come up with some differences
> > in behaviour.
>
> I don't think so. I think you'd have to come up with a definition,
> or a specification, for the behavior of the Perl string.
> Frankly, writing a C++ string class that had the same behavior
> shouldn't be particularly difficult. If one wanted to do it, one
> could probably lift the C code which implements strings in perl
> with very little modification.
First Perl strings were different than Perl strings, and now it is easy
to write a C++ string that does the same thing. Are you suggesting
that no current C++ string class does what a Perl string does? And what
does a Perl string do that is keeping you from specifying it?
>
> > > > > > Were [classes] implemented in complex ways?
> > >
> > > I have enough faith in Bjarne's abilities to assume that the
> > > implementation of classes in C++ is no more complex that it has
> > > to be. And that, of course, is quite complex, by almost any
> > > standard.
> >
> > Why don't you demonstrate how the creation of a class is so
> > much more
> > complex in C++ than it is in Perl. As always, good luck.
>
> Again it's beginning to seem like we're talking about different
> things. I *thought* we were talking about how the language
> implementation supports the creation of classes and objects; now
> it seems like you want to talk about how a programmer writes
> classes in the language. I also was not aware that we were
> comparing C++ to Perl wrt the complexity of classes, but rather,
> that the addition of OO made C++ -- the implementation thereof --
> so much more complex than C. But if you want to compare C++ to
> Perl, well, at least then we'd be on-topic for this ng.
Help me out - explain this phrase "how the language implementation
supports the creation of classes and objects". And we were comparing C++
and Perl source code, as always, regardless of how often you try and
change the subject to "real machines","virtual machines", and the object
code output by a compiler.
>
> Hmm. The simplest "class definition" in Perl consists of no code
> at all. This does not stop you from having instances of the class,
> however.
>
> $foo = bless {}, 'Foo'; # make an object of class Foo.
C++ is a little more flexible with it's simplest definition of a class
not requiring you to create an instance of the object:
class Foo {};
>
> Of course, this is rarely useful. Here's how you might populate
> the Foo class with a method:
>
> sub Foo::frobbitz { }
Ah, I am populating in Perl.
Here's C++ where where merely add member functions.
class Foo { frobitz(); };
>
> Now you can do something with the object:
>
> $foo->frobbitz();
Foo foo;
foo.frobitz();
>
> Maybe Foo inherits from Bar:
>
> @Foo::ISA = qw( Bar );
class Foo : public Bar {};
>
> If the Bar class has methods, call one of 'em:
>
> $foo->blandage(); # not found in Foo, found in Bar.
Foo foo;
foo.blandage();
>
> Hmm, maybe Foo needs to modify its inheritance tree at runtime:
>
> unshift @Foo::ISA, 'Quux';
I'll bet that practice has a lot of proponents in Object Oriented
Symposiums. It certainly does show how much more complex the Perl class
implementation is.
>
> Make undefined method calls do something useful:
>
> sub Foo::AUTOLOAD {
> my $self = shift;
> my $name = $Foo::AUTOLOAD;
> $name =~ s/.*:://; # strip the qualification
> $self->{'contained_object'}->$name( @_ );
> }
Don't know what this is doing, but it again appears that Perl objects
have a lot of complexity to them versus the much simpler C++.
>
> > > > The number lines is certainly relevant. That is one of the
> > > > metrics by
> > > > which we would test to see if the source code of one language
> > > > is like
> > > > that of another.
> > >
> > > Sure, but the results of that test say nothing about
> > > the equivalence
> > > of the two languages.
> >
> > As a matter of fact they say a lot.
>
> No, they say very little indeed.
Yes, they tell a long and sad story for those who want to claim that C
is just "portable assembler".
>
> > > > implying through your inability to
> > > > even give the requested sample code,
> > >
> > > Not unable, just unwilling. I have real work to do.
> >
> > Unable. End of story.
>
> Not unable, just unwilling.
> Stories, like newsgroup threads, don't end just because someone
> declares them ended.
Didn't say the story ended, just that you were unable to write assembler
code that was anywhere equivalent to:
int i = 0,j =0;
for ( ; i < 10; i++)
for ( ; j < 10; j++)
print ("i/j %d/%d\n",i,j);
>
> > > ...C++ is far more complex than C. Unfortunate but true.
> >
> > If you find anything unfortunate about C++ specific
> > syntax, just write
> > C code.
>
> It's unfortunate that the benefits of C++ come at such a high
> cost in complexity. This was, of course, one of the motivating
> factors in the creation of Java.
You were supposed to demonstrate how C++ classes were more complex than
Perl's, and you somehow forgot to show the C++ classes at all, far from
proving C++ to be complex. Maybe you can get the Java creators to help
you demonstrate the complexity of creating classes in C++.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 15 Jun 1999 11:13:53 GMT
From: armchair@my-deja.com
Subject: Re: Perl "constructors"
Message-Id: <7k5chd$jb9$1@nnrp1.deja.com>
In article <7k30op$p12$1@nnrp1.deja.com>,
John Porter <jdporter@min.net> wrote:
> In article <7k2ae3$hsj$1@nnrp1.deja.com>,
> armchair@my-deja.com wrote:
> > my only concern is that
> > you do not consider Perl just a programming language.
>
> That is clearly not your only concern, and it's one which I have
> labored to dispel. Perl is little more than a programming language,
> although it is a great one.
Let me rephrase it - my concern is that you consider Perl more than just
a programming language. And above, you admit to that fact.
>
> > per John Porter, C++ is just object oriented portable assembler.
>
> You are attributing to C++ things I said about C.
Oh??? - can't we "look at the object code" of C++ compilers and see
assembler like code?? Can't we talk about how C++ "models the real
machine" while Perl "models a virtual machine"?? Why does your "C is
portable assember" "argument" not apply to C++.
>
> > to you power comes in the form of a lack of compile time error
> > checking.
>
> Perl does not lack compile-time error checking.
> All syntax errors, for example, are checked at compile time.
> One of the many things that makes Perl powerful is its run-time
> error checking, of a sort that would be impossible (or prohibitively
> expensive) in static languages like C and C++.
>
> > I will be happy to summarize what you said, and feel free to
> > point out
> > where you discuss Perl features:
>
> These following quotes and pseudo-quotes come nowhere near summarizing
> what I and others have said about Perl in this thread.
Okay, give me your summary regarding Perl being a high level language
and C/C++ being low level languages.
>
> > "C is merely portable assembler".
>
> > "C/C++ are low-level and Perl is high-level. In what
> > way is it higher
> > level? Why just read the manual and seek enlightenment".
>
> For the record, that is not a quote.
> And you conveniently omitted other things I did say besides RTFM.
Why don't you give me your summary then?
>
> > "Anything in C++ that is not in Perl is just a result of
> > the fact that
> > C++ is object oriented extentions to a low-level language".
>
> For the record, that is not a quote, and is not even an accurate
> summary of my attitude toward C++.
> Anything in C++ that is not in Perl is not necessary in a
> high-level language. There's a quote for you.
I hope you tell that to the programmers writing fields.pm and other
modules for function overloading and operator overloading. I am glad to
see that they agree with me, and not you.
>
> > Since I have repeatedly given you a chance to demonstrated the
> > assembler
> > source code equivalent to a nested for loop in C, and you have been
> > unable to do so, I will have to assume that you realize what you are
> > doing, and what it is.
>
> Not unable, only unwilling, in full recognition of the fact that
> you know as well as I do what the equivalent assembly code would
> look like, and that merely printing it on the page would have no
> effect on your inability to comprehend its equivalence to the C
> code.
I have never programmed in assembler. Help me out. Give me the
equivalent assembler source code to:
int i = 0,j =0;
for ( ; i < 10; i++)
for ( ; j < 10; j++)
print ("i/j %d/%d\n",i,j);
>
> > > I'm not "downgrading" anything. There's nothing despicable
> > > about being a low-level language. All these things have there
> > > strengths and their purposes.
> >
> > Sure you are downgrading it. You are equating C and assembler.
>
> I disagree with you that this is "downgrading".
> All these things have their strengths and their purposes, and I
> do not view assembler as inferior. "Low-level" does not mean
> "low-quality" or "undesirable". There's a time and a place for
> all these languages.
Since you persist in saying Assembler is equivalent to C, give me the
equivalent Assembler source code to this C source code:
int i = 0,j =0;
for ( ; i < 10; i++)
for ( ; j < 10; j++)
print ("i/j %d/%d\n",i,j);
>
> > > Object allocation and disposition is still a concern in
> > > C++. This is one of the reasons so many C++ programmers are
> > > switching to Java.
> >
> > Object allocation and disposition are not still a concern if you are
> > using the STL and commercial or homegrown object libraries.
>
> That's just plain false, and the fact that you assert it means
> either you don't know what you are talking about, or you assume
> I don't know enough C++ to know that you're lying.
>
> The truth is, object allocation and disposition are still a
> significant concern for C++ programmers, and inattention to
> to it still leads to major bugs, no matter what libraries
> may be in use.
Baloney. If I have a String class (I do) that does it's own memory
allocation and deallocation under the covers, and I have my own
StringArray class (I do) that also does it's own memory and dealocation
under the covers I can do Perl-like assignment of files to arrays,
strings to arrays, arrays to strings until the cows come home, and I
never have to do one new or delete. I give credit to Perl for giving me
new ideas on how to add functionality to both these classes (I already
had added functions from other languages string implementations
and C++ classes). Now I have no experience in C++ with a hash (called a
map in the STL), but from my Perl experience I am going to study the STL
(don't even use it to date - we have a homegrown vector equivalent) and
either use map, or code a string specific version similar to Perl's. And
either way, I won't be allocating or deallocating memory in the use of
either a homegrown or STL "hash".
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 15 Jun 1999 11:40:36 GMT
From: armchair@my-deja.com
Subject: Re: Perl "constructors"
Message-Id: <7k5e3k$jqq$1@nnrp1.deja.com>
In article <7k34la$qfp$1@nnrp1.deja.com>,
John Porter <jdporter@min.net> wrote:
> In article <7k2btb$jad$1@nnrp1.deja.com>,
> armchair@my-deja.com wrote:
> > I will be happy to repost the applicable comments "for all to see",
> and
> > encourage you to pay attention when you read it:
> >
> > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> > > Variables in Perl (scalars, arrays, hashes) are, under the hood,
> > > pointers to data structures; but the language "sugar-coats"
> > > the use
> > > of these pointers. So your objection here is null. I was
> > > trying to
> > > show how Perl works using C++ syntax. I should perhaps have used
> > > references, rather than pointers, to make my point, since that is
> > > C++'s equivalent sugar-coating.
> >
> > Scalar variables in Perl (numbers, strings, references to
> > (numbers,strings,hashes,arrays,objects)) are all identified
> > the same.
> >
> > my $variable.
> >
> > This is not the same as C++ syntax. Nor is is that same as
> > what takes
> > place under the hood.
> > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> Here is the actual relevant extract, elided appropriately,
> presented for your benefit, since I trust everyone else will
> find it excruciatingly redundant:
>
> John Porter wrote:
> > > > Scalar* p = get_next();
> >
> > Variables in Perl (scalars, arrays, hashes) are, under the hood,
> > pointers to data structures; but the
> > language "sugar-coats" the use of these pointers.
> > I was trying to show how Perl works using C++ syntax.
>
> At no point did I say, state, suggest, or imply that
>
> my $variable;
>
> is valid C++.
>
Nor did I contend that you at any point, stated, suggested, or
impled as much, so rest easy. And I give you credit for not trying to
make up any post that made it look like I did. You did however attempt
to show some C++ equivalent to the vague Perl statement:
my $variable = some_function;
yet came up short as I pointed out. Rather than deal with the
shortcomings, you have decided to ignore them and move on, after first
trying some silly obfuscation. I prefer that to going on about "virtual
machines" and "real machines" and will once again give you credit for
something.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 15 Jun 1999 11:45:33 +0100
From: Matt Sergeant <matt.sergeant@ericsson.com>
Subject: Re: PerlScript ... what features are missing?
Message-Id: <37662ECD.6967F985@ericsson.com>
Ken Snyder wrote:
>
> Anyone know the functional list of
> things that don't work under PerlScript?
The key things are die, exit and print. (and other similar things,
especially ones that assume STDOUT goes to the web browser). You can get
back the functionality of those things using Win32::ASP. (see CPAN or
type "ppm install Win32-ASP").
HTH.
Matt.
------------------------------
Date: Tue, 15 Jun 1999 09:31:46 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: Regular expressions against keys in a hash
Message-Id: <37691d18.3058958@enews.newsguy.com>
On Mon, 14 Jun 1999 22:10:19 +0200, Thomas Weholt <thomas@bibsyst.no>
wrote:
>Hi,
>
>I got a hash with a structure like this :
>
>"keyword" = "ids"
>eg.
>"perl" = "2.32,32.543,21.42,432.43,23.432";
>"python"="32.54,543.34,9.100";
>etc.
>
>The values describe id-codes telling the script where to look up for a
>word in another hash, containing filenames and info about that file.
>
>eg.
>"2.32"="/linux/development/perl.tar.gz....";
>
>What I need is a way of hitting stuff like pyth* and per*, like simple
>regular expressions. How do I get the keys that pass that test *without*
>going thru the hash key by key? ( If this is possible at all. If not
>I`ll stop trying ;->)
Well, I've got an answer using grep, so you don't step through the
hash key by key, you have a function do it for you. Still, here it
goes:
#!/usr/bin/perl -w
use strict;
my @test{qw(perl perl4 perl5 peron python pythagoras romeo)} = (1..7);
foreach (grep { /^per/ } keys %test) {
print "$_ => $test{$_}\n";
}
That will print out all hash elements that start with "per".
HTH
Marcel
------------------------------
Date: Tue, 15 Jun 1999 10:14:08 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: Regular expressions against keys in a hash
Message-Id: <sizp21zs7j.fsf@cre.canon.co.uk>
Thomas Weholt <thomas@bibsyst.no> wrote:
> What I need is a way of hitting stuff like pyth* and per*, like simple
> regular expressions. How do I get the keys that pass that test
> *without* going through the hash key by key?
You can't discover which strings match a regular expression without
matching the strings against the expression!
If your problem is more tightly constrained than that, you may be able
to do better. If your "simple regular expressions" are all in prefix
form (like "^pyth.*" or "^per.*") then a prefix tree can be searched
reasonably efficiently.
Or you could concatenate all the keys and match the concatenation
against the regular expression:
# assume that there are no newlines in the keys
$keys = join "\n", keys %hash;
if ($keys =~ /^(.*$REGEXP.*)$/m) {
# $1 is the first key that matches $REGEXP
}
--
Gareth Rees
------------------------------
Date: 15 Jun 1999 11:10:12 GMT
From: "Carl K. Cunningham" <ccu@ohpleasedontspamme.sbk-ks.de>
Subject: STDERR & Windows
Message-Id: <01beb71f$a3eadd20$490e10c1@opal>
I'm using ASPerl on Win95, and I'd like to know how to capture output that
is sent out on STDERR. Basically I've developed a nice little SMTP client
using libnet & smtp.pm that I use to generate serial e-mails (no, I'm not
spamming, I send status alerts to customers) and I sometimes need to be
able to debug the SMTP connection. I can set "Debug=>1", and it provides me
with scads of information via STDERR, that zips right on by, and as of yet
I haven't been able to redirect it into a file.
Any ideas?
--
Carl K. Cunningham
SBK Software + Systeme GmbH
<<remove stupid comment from my e-mail address to obtain valid address>>
------------------------------
Date: Tue, 15 Jun 1999 12:32:33 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: STDERR & Windows
Message-Id: <3767470c.22496016@news.skynet.be>
Carl K. Cunningham wrote:
>I sometimes need to be
>able to debug the SMTP connection. I can set "Debug=>1", and it provides me
>with scads of information via STDERR, that zips right on by, and as of yet
>I haven't been able to redirect it into a file.
>
>Any ideas?
open STDERR>,'>logfile.txt';
Bart.
------------------------------
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 5999
**************************************