[19343] in Perl-Users-Digest
Perl-Users Digest, Issue: 1538 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 16 06:05:31 2001
Date: Thu, 16 Aug 2001 03:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <997956309-v10-i1538@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 16 Aug 2001 Volume: 10 Number: 1538
Today's topics:
Re: Any way of detecting running in eval? <lapplisa-no-spam@cotse.com>
Re: Any way of detecting running in eval? <bart.lateur@skynet.be>
Re: Avoiding symbolic references. <ilya@martynov.org>
Re: Avoiding symbolic references. <ilya@martynov.org>
Re: DBI:CSV SQL 'order by' problem <goldbb2@earthlink.net>
Re: Encrypted Email <goldbb2@earthlink.net>
File::Find not recursing on Win32 Perl 5.001 (Phil Hibbs)
Finding Computer name for user. (John F.)
Re: Ignoring The First Line <ilya@martynov.org>
Re: Ignoring The First Line <ilya@martynov.org>
Re: Need Perl module or regexp to slurp specific XML re (Eric Bohlman)
Re: Newbie Perl Installation - "%1 is not a valid Windo <paul@net366.com>
Perl OO needs the opposite of SUPER:: (John Lin)
Re: Perl OO needs the opposite of SUPER:: <ilya@martynov.org>
Re: Perl OO needs the opposite of SUPER:: <Tassilo.Parseval@post.rwth-aachen.de>
Re: perldoc is like Greek to a beginner?? (Anno Siegel)
Re: perldoc is like Greek to a beginner?? (Yves Orton)
Re: perldoc is like Greek to a beginner?? (Rafael Garcia-Suarez)
Re: perldoc is like Greek to a beginner?? <ilya@martynov.org>
Re: perldoc is like Greek to a beginner?? (Rafael Garcia-Suarez)
Re: perldoc is like Greek to a beginner?? (Rafael Garcia-Suarez)
pipe STDERR <philippe.perrin@sxb.bsf.alcatel.fr>
Re: pipe STDERR <philippe.perrin@sxb.bsf.alcatel.fr>
Re: Session Variables <info@rippo>>REMOVE<<.co.uk>
Re: Session Variables <ilya@martynov.org>
SQL (MySQL) Windows <paul@net366.com>
Re: This is not a question ... call me slow if you like <goldbb2@earthlink.net>
Re: This is not a question ... call me slow if you like <paul@net366.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 16 Aug 2001 03:13:49 -0400 (EDT)
From: <lapplisa-no-spam@cotse.com>
Subject: Re: Any way of detecting running in eval?
Message-Id: <bGFwcGxpc2E=.62493bf3332e7aec70b1b14de2873a62@997946029.cotse.com>
OK, gentlepeople, I see I really didn't phrase that well.
My bad. Let's try another tack.
What I _really_ meant to ask was if there was a way to detect
running in _nested_ evals. Look at this program:
--------------
#!/usr/bin/perl -w
use strict;
require 5;
my $lev2="print \"[\",caller,\"]\n\";";
my $lev1="print \"[\",caller,\"]\n\"; eval $lev2";
eval $lev1;
print "[",caller,"]\n";
exit 1;
---------------
Output:
[main./evltst.pl8]
[main./evltst.pl8]
[]
So I don't see no way to distinguish beween the first
and the second level eval. Is there?
I'm running with "perl, version 5.005_03 built for i386-freebsd"
if it matters.
TIA!
------------------------------
Date: Thu, 16 Aug 2001 08:52:41 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Any way of detecting running in eval?
Message-Id: <mf2nnt4ckuo18ucvuhu427f02ucpauscsl@4ax.com>
<lapplisa-no-spam@cotse.com> wrote:
>my $lev2="print \"[\",caller,\"]\n\";";
>my $lev1="print \"[\",caller,\"]\n\"; eval $lev2";
^^^^
You must have forgotten putting a backslash in front of $lev2. It does
make a difference.
And you might explore using caller with a parameter. That will allow you
to descend into the call stack.
--
Bart.
------------------------------
Date: 16 Aug 2001 13:15:12 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Avoiding symbolic references.
Message-Id: <87u1z8pdr3.fsf@abra.ru>
BG> I have in a module a for loop which creates a number of subroutines from
BG> a closure. Normally, one would do something like:
BG> while( my ($name,$args) = each %whatever ) {
BG> no strict 'refs';
BG> *{"Package::$name"} = sub { .... };
BG> }
BG> I'm trying to replace this with something like:
BG> while( my ($name,$args) = each %whatever ) {
BG> $Package::{$name} = sub { .... };
BG> }
BG> Which *should* do what I want, but doesn't seem to work.
Strange. It should work. At least on my home computer following
script works under Perl 5.6.1:
use strict;
use warnings;
$main::{test} = sub { print "test\n" };
test();
It does prints 'test' without any errors;
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: 16 Aug 2001 13:17:43 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Avoiding symbolic references.
Message-Id: <87pu9wpdmw.fsf@abra.ru>
IM> Strange. It should work. At least on my home computer following
IM> script works under Perl 5.6.1:
IM> use strict;
IM> use warnings;
IM> $main::{test} = sub { print "test\n" };
IM> test();
IM> It does prints 'test' without any errors;
Just tested it under 5.005 (after I've removed 'use warnings'). Works
too.
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: Thu, 16 Aug 2001 04:33:52 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: DBI:CSV SQL 'order by' problem
Message-Id: <3B7B8570.EF8300CE@earthlink.net>
Bill Neisius wrote:
>
> "Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
> news:3B74CF5C.5A3265F4@earthlink.net...
>
> > my $number = qr[\A
> > (?>\s*) # leading whitespace ok when numerifying a string.
> > (?>[-+]?) # optional plus/minus.
> > (?>\d+\.\d*|\.\d+) # required mantissa
> > (?>[eE][-+]?\d+)? # optional exponent
> > (?>\s*) # trailing whitespace ok, too
> > \z]x;
>
> I think you missed a "?" up there. Should be:
>
> (?>\d+\.\d*|\.?\d+) # required mantissa
>
> otherwise "123" isn't a number.
you're absolutely right, though I would have put it on the left side:
(?>\d+\.?\d*|\.\d+)
This should be faster.
> Looks like this will correct the problem in the original
> sort... but now I'm having doubts about the design of
> the whole sort routine.
>
> If the string or numeric comparison depends on the
> data in the field, aren't you likely to get some
> 'unusual' sorts when some of the rows match the
> numeric pattern and some of them don't?
You're right. What it should do is on the first pass through the data,
when it's loading, check for fields being numeric:
my @numeric = (1) x @fields;
foreach my $row (@rows) { for(0..$#$row) {
$numeric[$_] &&= $$row[$_] =~ m/$numeric/;
} }
or somesuch. If there's even one item which is non-numeric, the whole
column is non-numeric. This should be done in the same loop as the
loading of the data, not as a seperate set of loops.
> For example, the list:
> '100', '+101', '100A', '102'
> is 'sorted' based on this routine...
Hmm. Sorting only needs to return consistant results, ie, no things
like a > b > c, c > a. Can anyone think of an example of how this could
happen due to mixed string and numeric comparisons?
> Maybe I shouldn't worry about it... but since CSV only
> has the 'character' column data type, shouldn't the sort
> only use string compares? Otherwise the results
> are unpredictable.
Regardless of whether it checks whole columns for numeric, or just does
string compare for everything, it *should* try to be consistent for
entire columns.
And not just unpredictable... there are some C sort implementations
which will seg fault if the comparison function returns inconsistant
results. Does anyone know of a perl which uses such a sort?
--
I'm not a programmer but I play one on TV...
------------------------------
Date: Thu, 16 Aug 2001 04:06:04 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Encrypted Email
Message-Id: <3B7B7EEC.CFFBC1CF@earthlink.net>
Jeff Snoxell wrote:
>
> Hi,
>
> Thanks for everyone's help with my BigInt and other problems.
>
> I'm still no closer to a solution however.
>
> I need a way to send 128-bit (minimum) encrypted emails from my ISP's
> linux server to my Outlook Express inbox. I have CGI and FTP access to
> the server but I don't have telnet and hence cannot easily install
> modules (I never seem to have any luck with installing modules even
> when I do have telnet access). I'm willing to spend a small amount of
> money to register some shareware if necessary.
>
> Please help, I've been stuck on this problem for 48 hours now and my
> mind is melting.
Try the Crypt::OpenPGP module. It's pure perl, so all you need is to
put the .pm files in appropriate places, and you're set.
I assume you know how to make a lib directory and do "use lib
qw(whatever);"
--
I'm not a programmer but I play one on TV...
------------------------------
Date: 16 Aug 2001 02:59:09 -0700
From: phil.hibbs@capgemini.co.uk (Phil Hibbs)
Subject: File::Find not recursing on Win32 Perl 5.001
Message-Id: <153e25f0.0108160159.4f6ffb6f@posting.google.com>
I tried this from the cookbook:
@ARGV = qw(.) unless @ARGV;
use File::Find;
find sub { print $File::Find::name, -d && '/', "\n" }, @ARGV;
It doesn't recurse into subdirectories. Ideas why not? I can't upgrade
my perl, as this has to function on other machines with standard
installs.
Phil.
------------------------------
Date: 16 Aug 2001 01:08:00 -0700
From: menorevs@aol.com (John F.)
Subject: Finding Computer name for user.
Message-Id: <1db0f15a.0108160008.23b4c5e3@posting.google.com>
Hello to everyone! I have a problem where I need to know what
computer or computers a user is logged into on an NT/2000 network.
Does anyone know the modules or code that will allow me to do that. I
want something in the effect of the "nbtstat -a" command in DOS that
allows you to find the last user logged in to that computer. I
appreciate it.
Thanks
John
------------------------------
Date: 16 Aug 2001 12:04:12 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Ignoring The First Line
Message-Id: <873d6ssa6b.fsf@abra.ru>
>>> print NEWFILE <OLDFILE> reads even line and prints its
TM> Reads *all of the rest of the lines* (and outputs them to NEWFILE).
TM> OLDFILE is at EOF after the above statement. The loop must execute
TM> only one time.
TM> print() puts list context on its arguments.
TM> perldoc -f print
Right, I've missed this point when I used perl interpreter embded
in my brains :)
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: 16 Aug 2001 12:08:20 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Ignoring The First Line
Message-Id: <87y9okqvez.fsf@abra.ru>
>> Should not it be s/\000//;?
PL> Found that doesn't work as Perl thinks that the '\000' is an octal char,
PL> just like the shell (I'm running linux); so I do need the quotes or
PL> use an escape like 's/\\000//'.
Right. I thought you want \000 as an octal char.
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: 16 Aug 2001 07:06:28 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Need Perl module or regexp to slurp specific XML records
Message-Id: <9lfrdk$qos$2@bob.news.rcn.net>
In comp.lang.perl.misc M.L. <mel2000@hotmaildot.com> wrote:
>> If you're using the latest version of XML::Records (the one based on
>> XML::TokeParser), you can call begin_saving() at the beginning of a
>> record, use get_tag() and get_text() to determine if there's a match, and
>> then call restore_saved() and get_record().
>>
> I recently downloaded version 0.01 dated Fri Jan 26 18:03:59 2001
> (according to the Changes file) and it either didn't include those methods
> or
> did not describe them. Thanks for the update. While this looks interesting,
> I'll use it as a backup if the regexp method (recommended by other posters)
> is not suitable.
You need 0.10, released July 21.
------------------------------
Date: Thu, 16 Aug 2001 08:28:03 +0100
From: "Paul Fortescue" <paul@net366.com>
Subject: Re: Newbie Perl Installation - "%1 is not a valid Windows NTApplication"
Message-Id: <997946807.22271.0.nnrp-01.d4f094e4@news.demon.co.uk>
"Ash Turner" <ash@turnernewmedia.com.au> wrote in message
news:B7A1A4B2.6B5%ash@turnernewmedia.com.au...
> Hi
>
> I've just installed perl on my NT Server. I know it's working. When I try
> and access through my web scripts though I get the error "%1 is not a
valid
> Windows NT Application".
>
> I think It's the pathname which I've set to "c:/perl/bin/" in my perl
> scripts, which is the pathname on the NT box.
>
> Any help greatly appreciated.
>
>
> Ash Turner
>
In your applications extensions for .pl files, you should have:
C:\Perl\bin\Perl.exe %s %s
Presumably it is ActivePerl you're using? Is it for old NT (4.0) or new NT
(2000)? What v of IIS r u on?
Paul
$s="Jack runs most fast however, a snoot from Bart brashly accelerates
further spammongers. Paul sees Martynovs curly hair; has Tad picking tick
processes rather carefully.";
$i=0;$1=~m/[,.;]/?($i=0,print" "):print substr($1,$i++,1) while
$s=~m/(\w+[,.;]?)/g;
------------------------------
Date: 16 Aug 2001 01:19:33 -0700
From: johnlin@chttl.com.tw (John Lin)
Subject: Perl OO needs the opposite of SUPER::
Message-Id: <a73bcad1.0108160019.2d7b9b81@posting.google.com>
Dear all,
I encounter a problem and figured out that for Perl OO, we need
an expression which is opposite to SUPER:: (let's say VIRTUAL::)
SUPER:: inheritor-class calls base-class
VIRTUAL:: base-class calls inheritor-class
Let's considering the following situation:
When I designed a Base class, in Base::init() I want to call the
inheritor-class's init().
sub Base::init {
my $self = shift;
print "do something beforehand\n";
$self->init; # how can I call the init() of inheritor-class here?
print "do something afterward\n";
}
In current version of Perl, if A::init overwrites Base::init,
A->init calls A::init and won't reach Base::init at all,
let alone calling A::init from Base::init.
Unless SUPER:: is used. But it can not solve the problem either.
(Can you use SUPER:: to generate the above running sequence?)
OK, here is a emulated version to work around. From it, maybe you can
better understand what I want:
package Base;
sub new { bless [],shift }
sub init {
my $self = shift;
print "do something beforehand\n";
$self->VIRTUAL::init;
print "do something afterward\n";
}
package A;
our @ISA = 'Base'; # inherit 'Base'
sub VIRTUAL::init { print "A::init called\n" }
package main;
A->new->init;
__END__
do something beforehand
A::init called
do something afterward
My proposed grammar is like:
package Base;
sub init : virtual {
my $self = shift;
print "do something behorehand\n";
$self->VIRTUAL::init;
print "do something afterward\n";
}
... other things
package A;
our @ISA = 'Base';
sub init { print "A::init called\n" } # don't need to say VIRTUAL:: here
... other things
__END__
(1) Define a "virtual" attribute to sub
Under "virtual" declaration, any inheritor-class's method with
the same sub name will just "virtually" overwrite the base method.
That is, by default A->init() will call Base::init() first, then A::init().
(2) Define a VIRTUAL:: call
When the base method wants a different sequence of calling A::init
(default sequence is Base::init then A::init), it can use VIRTUAL:: calls.
If Base::init contains VIRTUAL:: calls, it will not call A::init again.
Let's see the above example, by default
sub Base::init : virtual;
will execute in the sequence
Base::init
A::init
If Base::init wants to call A::init in the middle of its statements
instead of at the end, he can write
print "do something behorehand\n";
$self->VIRTUAL::init;
print "do something afterward\n";
Since VIRTUAL:: is used, after Base::init, A::init will not be called again.
I think, with this extension, Perl OO will become more complete.
What do you think about it?
John Lin
--
Of course, you can also extend it with a "pure" attribute
sub Base::init : pure;
which is like C++'s
virtual void init()=0;
and will die if A::init is not implemented.
------------------------------
Date: 16 Aug 2001 12:43:29 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Perl OO needs the opposite of SUPER::
Message-Id: <87k804qtse.fsf@abra.ru>
JL> Dear all,
JL> I encounter a problem and figured out that for Perl OO, we need
JL> an expression which is opposite to SUPER:: (let's say VIRTUAL::)
JL> SUPER:: inheritor-class calls base-class
JL> VIRTUAL:: base-class calls inheritor-class
If you don't use SUPER:: base-class will call inheritor-class
JL> Let's considering the following situation:
JL> When I designed a Base class, in Base::init() I want to call the
JL> inheritor-class's init().
JL> sub Base::init {
JL> my $self = shift;
JL> print "do something beforehand\n";
JL> $self->init; # how can I call the init() of inheritor-class here?
It will call init of inheritor-class.
JL> print "do something afterward\n";
JL> }
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: Thu, 16 Aug 2001 10:43:57 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Perl OO needs the opposite of SUPER::
Message-Id: <3B7B87CD.3060004@post.rwth-aachen.de>
John Lin wrote:
> Dear all,
>
> I encounter a problem and figured out that for Perl OO, we need
> an expression which is opposite to SUPER:: (let's say VIRTUAL::)
>
> SUPER:: inheritor-class calls base-class
> VIRTUAL:: base-class calls inheritor-class
No, this would be against the idea of inheritance. sub-classes should
know their super-classes but never the other way round.
> Let's considering the following situation:
>
> When I designed a Base class, in Base::init() I want to call the
> inheritor-class's init().
>
> sub Base::init {
> my $self = shift;
> print "do something beforehand\n";
> $self->init; # how can I call the init() of inheritor-class here?
> print "do something afterward\n";
> }
I think you are confusing something here. Base is obviously the
base-class (hence the name). Base-classes are most often abstract so you
can't sensibly instantiate one. Likewise, you seldom call any method
from a base class directly.
As for your problem, to have a base-class sort of multiplex the calls to
the appropriate subclass, you need something like:
package Base;
sub new {
my $class, @additional_args = @_;
if ($class eq __PACKAGE__) {
use Carp;
my $package = __PACKAGE__;
croak <<USAGE;
$package should not be directly instantiated.
USAGE
}
my $self = bless {}, $class;
$self->init(\@args);
}
package Subclass;
use base 'Base';
sub init {
my ($self, $args) = @_;
$self->do_something();
$self;
}
package Main;
use Subclass;
my $object = Subclass->new; #
__END__
As you see, Subclass does not have a new-method. When calling this new
method, the super-class 'Base' instead is searched for this method.
Base::new will get 'Subclass' as first argument (stored in $class) and
hence it will call $class->init which in this case really is Subclass->init.
If you said: "my $object = Base->new" in the Main-package, you would
invoke the above croaking since we do not want a direct invokation of
superclass.
Tassilo
--
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};
------------------------------
Date: 16 Aug 2001 08:14:18 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: perldoc is like Greek to a beginner??
Message-Id: <9lfvcq$agb$1@mamenchi.zrz.TU-Berlin.DE>
According to Abigail <abigail@foad.org>:
> Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMCMVI September
> MCMXCIII in <URL:news:9le3g8$scc$1@mamenchi.zrz.TU-Berlin.DE>:
[a traditional language...]
> "" allows only a few context-sensitive constructs. Perl's designer seems
> "" to have thrown all caution to the winds :)
>
> Just because Larry did doesn't mean every programmer wants the
> language (s)he uses to be context sensitive. Many people prefer
> their language to be context free - that's one of the main reasons
> Perl is disliked in large groups of people.
More generally, it's Perl's unconcernedness with consistency of which
context-sensitivity is only a part. I know I was appalled when I
first learned Perl. Using it anyway because it got things done,
I came to appreciate the flexibility and expressiveness such
inconsistencies can buy you.
Anno
------------------------------
Date: 16 Aug 2001 02:21:36 -0700
From: demerphq@hotmail.com (Yves Orton)
Subject: Re: perldoc is like Greek to a beginner??
Message-Id: <74f348f7.0108160121.47f74c15@posting.google.com>
abigail@foad.org (Abigail) wrote in message news:<slrn9nlrlb.9sn.abigail@alexandra.xs4all.nl>...
<SNIP>
<Damn, I knew I should of brought the red dragon to work....>
> Could you give examples from some well known languages, like C, Java
> and ADA that proves they are not truely context free?
Hi Abigail. C requires variables and subs to be declared prior to use
if I remember correctly, as does Java, and I think Ada as well. This
fact alone them makes them non-context free if I remember from the red
dragon. I could be wrong (but I am %99.99 sure) however I will find
the page/section etc and post it pronto.
> Note that if you can write a BNF for a language, or a Parse::RecDescent
> grammar that doesn't use dirty tricks like rewriting the string it is
> parsing it's context free.
Are you sure about this? My understanding is different. (I beleive
you probably know this stuff 1000 time better than I do, so Im
reluctant to contradict. On the other hand debate is the backbone of
scientific thought...
:-)
> Also, Aho, Hopcroft and Ullman claim that almost every computer language
> is context free, so it would be interesting to see you prove them wrong.
Id be interested to see the cite on this one. It contradicts my
recollection of the red dragon.
The annoying thing is that when I left for work today I briefly
considered taking it with me... But ive got the hardcover version and
I didnt want the weight when I rode my bicycle to work....
Anyway,
Cheers Abigial
ps (Have you ever thought of writing a book or article on your JAPHs?
I for one would buy/read it from top to bottom....)
------------------------------
Date: 16 Aug 2001 09:38:00 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: perldoc is like Greek to a beginner??
Message-Id: <slrn9nn5du.8em.rgarciasuarez@rafael.kazibao.net>
Abigail wrote in comp.lang.perl.misc:
}
} Could you give examples from some well known languages, like C, Java
} and ADA that proves they are not truely context free?
}
} Note that if you can write a BNF for a language, or a Parse::RecDescent
} grammar that doesn't use dirty tricks like rewriting the string it is
} parsing it's context free.
IIRC, the perl tokenizer does some things like this : reordering tokens
before feeding them to the parser ; and also it maintains an internal
state to guess correctly "ambiguous" tokens.
I don't know whether this makes Perl completely unable to be expressed
using a BNF grammar. Technically, I think it's probable that Perl could
be parsed with a stateless lex-like lexer and an LL-infinite parser.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
"Les poules du couvent couvent."
------------------------------
Date: 16 Aug 2001 13:47:10 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: perldoc is like Greek to a beginner??
Message-Id: <87lmkkpc9t.fsf@abra.ru>
RG> I don't know whether this makes Perl completely unable to be expressed
RG> using a BNF grammar. Technically, I think it's probable that Perl could
RG> be parsed with a stateless lex-like lexer and an LL-infinite parser.
'perldoc -q BNF':
Can I get a BNF/yacc/RE for the Perl language?
[..skip..]
In the words of Chaim Frenkel: "Perl's grammar can not be
reduced to BNF. The work of parsing perl is distributed
between yacc, the lexer, smoke and mirrors."
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: 16 Aug 2001 09:40:46 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: perldoc is like Greek to a beginner??
Message-Id: <slrn9nn5j5.8em.rgarciasuarez@rafael.kazibao.net>
Yves Orton wrote in comp.lang.perl.misc:
}
} Hi Abigail. C requires variables and subs to be declared prior to use
} if I remember correctly, as does Java, and I think Ada as well. This
} fact alone them makes them non-context free if I remember from the red
} dragon. I could be wrong (but I am %99.99 sure) however I will find
} the page/section etc and post it pronto.
Technically, this is not verified by the parser automaton itself, but by
actions triggered by the parser : e.g. check if some symbol used in an
expression has already an entry in the symbol table...
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 16 Aug 2001 09:57:24 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: perldoc is like Greek to a beginner??
Message-Id: <slrn9nn6ib.8hj.rgarciasuarez@rafael.kazibao.net>
Ilya Martynov wrote in comp.lang.perl.misc:
}
} RG> I don't know whether this makes Perl completely unable to be expressed
} RG> using a BNF grammar. Technically, I think it's probable that Perl could
} RG> be parsed with a stateless lex-like lexer and an LL-infinite parser.
}
} 'perldoc -q BNF':
}
} Can I get a BNF/yacc/RE for the Perl language?
} [..skip..]
}
} In the words of Chaim Frenkel: "Perl's grammar can not be
} reduced to BNF. The work of parsing perl is distributed
} between yacc, the lexer, smoke and mirrors."
Yes. And I've another objection to myself : here-docs can't be parsed
with a stateless lexer.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Thu, 16 Aug 2001 08:53:24 +0200
From: Philippe PERRIN <philippe.perrin@sxb.bsf.alcatel.fr>
Subject: pipe STDERR
Message-Id: <3B7B6DE4.19D0C62F@sxb.bsf.alcatel.fr>
Hi
Using open(F, "command |"); will let me pipe the stdout of "command".
But how can I pipe its stderr ? (not using 2>&1, because I'm on a
Windows system... I'd like a Perl solution).
Thanks !
--
PhP
($r1,$r2,$r3,$r4)=("19|20","0|1","28|29","5|24");($r5,$r6)=("9|10|15|16|$r1|$r2","9|10|$r3");%h=("1|",$r6,"1=","[1-5]|2[0-4]","1/","0|19","1\\","6|25","2|","0|6|19|25|$r6","2/","1|20","2\\",$r4,"3|","$r2|6|$r1|25|$r6","3/",$r4,"4|","$r2|$r1|$r6","4=","2|3|4|11|12|13|14|21|22|23","4/",$r4,"4\\",15,"5|","$r2|9|15|$r1|20|$r3","5/",10,"6|",$r5,"7|",$r5,"7/",$r3);for($l=1;$l<8;$l++){b:for($i=0;$i<30;$i++){c:foreach(keys
%h){next c if(!(/^$l(.*)$/));$a=$1;if($i=~/^($h{$_})$/){print $a;next
b;}}print " ";}print "\n";}
------------------------------
Date: Thu, 16 Aug 2001 10:12:38 +0200
From: Philippe PERRIN <philippe.perrin@sxb.bsf.alcatel.fr>
Subject: Re: pipe STDERR
Message-Id: <3B7B8076.BBE2676C@sxb.bsf.alcatel.fr>
Philippe PERRIN wrote:
> Using open(F, "command |"); will let me pipe the stdout of "command".
> But how can I pipe its stderr ? (not using 2>&1, because I'm on a
> Windows system... I'd like a Perl solution).
OK, I found IPC::Open3 which works fine.
However, it seems that on Windows systems, stderr is read through a
buffer :
- on Solaris (where stderr is NOT read through a buffer), reading the
stderr of "command" with open3() happens as soon as "command" produces
the output (line by line, instantly)
- on Windows2000, I have to wait for "command" to terminate to get its
stderr, which is very annoying, since I need to parse it as it is
produced...
Is there any Perl solution to force a FILEHANDLE to be non-bufferized ?
Thanks
--
PhP
($r1,$r2,$r3,$r4)=("19|20","0|1","28|29","5|24");($r5,$r6)=("9|10|15|16|$r1|$r2","9|10|$r3");%h=("1|",$r6,"1=","[1-5]|2[0-4]","1/","0|19","1\\","6|25","2|","0|6|19|25|$r6","2/","1|20","2\\",$r4,"3|","$r2|6|$r1|25|$r6","3/",$r4,"4|","$r2|$r1|$r6","4=","2|3|4|11|12|13|14|21|22|23","4/",$r4,"4\\",15,"5|","$r2|9|15|$r1|20|$r3","5/",10,"6|",$r5,"7|",$r5,"7/",$r3);for($l=1;$l<8;$l++){b:for($i=0;$i<30;$i++){c:foreach(keys
%h){next c if(!(/^$l(.*)$/));$a=$1;if($i=~/^($h{$_})$/){print $a;next
b;}}print " ";}print "\n";}
------------------------------
Date: Thu, 16 Aug 2001 08:51:05 GMT
From: "Rippo" <info@rippo>>REMOVE<<.co.uk>
Subject: Re: Session Variables
Message-Id: <ZPLe7.4$X%4.219@newreader.ukcore.bt.net>
> Look at CPAN module Apache::Session.
I have looked into this and it appears that you need mySQL installed on the
apache server. If I dont want to go down this route then is there another
way?
Please can you give me the solution and any rpm's that needs to be installed
on the server.
We have LINUX 7.0 installed
Thanks
Rippo
------------------------------
Date: 16 Aug 2001 12:55:25 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Session Variables
Message-Id: <877kw4qt8i.fsf@abra.ru>
>> Look at CPAN module Apache::Session.
R> I have looked into this and it appears that you need mySQL installed on the
R> apache server. If I dont want to go down this route then is there another
R> way?
No. It doesn't require MySQL. It can use various backends for session
storages. It can store sessions in flat files and SQL databases
(AFAIK Oracle, Postgres, Sybase and MySQL are supported). If you are
not satisfied with existing backends you can even roll your own.
Please read docs carefully.
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: Thu, 16 Aug 2001 10:45:28 +0100
From: "Paul Fortescue" <paul@net366.com>
Subject: SQL (MySQL) Windows
Message-Id: <997955061.25473.0.nnrp-01.d4f094e4@news.demon.co.uk>
I think I'm being a donkey. I have installed MySQL on Win2K, and downloaded
the modules DBI and DBD which I have put into the /perl/lib directory
When I try to run a .pl script using use DBI I get 'Compilation failed in
require at ... '
I assume that the require is in the DBI.pm module, and it is looking for DBD
Am I being stupid? Does anyone know the MINIMUM installation for MySQL?
------------------------------
Date: Thu, 16 Aug 2001 04:02:49 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: This is not a question ... call me slow if you like...
Message-Id: <3B7B7E29.E1423382@earthlink.net>
Anno Siegel wrote:
>
[snip]
> We can compress better than that. The banner uses only two characters, so
> a single bit can tell which. It's less true than yours (I had to unify the
> line length) but it fits in four lines:
>
> use MIME::Base64; $vec = decode_base64( q( vMj5OCHni76DRBEhGkVEFCQkMghfKSK+ry
> IRQ/hSERF9k4giQh SLiCgog+MQopBDRF8CAAAAAAAAAAAAAAAAAAAAAM93gshx0ncGiIIURFFUgj
> RA9JXg+4LxlQGebwTRF4xvDBAEJYiiqAQFgOBLTxQ5 6UsDAA==));for($i=0;$i<8*length
> $vec;$i++) { print "\n" unless $i % 67; print vec( $vec, $i, 1) ? '8' : '_' }
And using just uuencoding works even better, and doesn't require an
external module:
$u=q{M``````````#@1<['"3E?]!TDB@C1*"*B("&10?A*$?%]%8D8PI>*B.B;1!01
}. q{MHEA$1$$9'(<0A1PB^A(``````````/!\)X@<)WUG@"A(011%)4@#1%\)OB\8
}. q{<7QG@^480?<'XQ@!!4((HBDI0``B^]$21D[XT````};$j=unpack("u",$u);
for(0..938){print vec($j,$_,1)?"8":" ";print"\n"unless(($_+1)%67)}
--
I'm not a programmer but I play one on TV...
------------------------------
Date: Thu, 16 Aug 2001 10:49:13 +0100
From: "Paul Fortescue" <paul@net366.com>
Subject: Re: This is not a question ... call me slow if you like...
Message-Id: <997955280.25587.0.nnrp-01.d4f094e4@news.demon.co.uk>
"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3B7B7E29.E1423382@earthlink.net...
> Anno Siegel wrote:
> >
> [snip]
> > We can compress better than that. The banner uses only two characters,
so
> > a single bit can tell which. It's less true than yours (I had to unify
the
> > line length) but it fits in four lines:
> >
> > use MIME::Base64; $vec =
code_base64( q( vMj5OCHni76DRBEhGkVEFCQkMghfKSK+ry
> > IRQ/hSERF9k4giQh
SLiCgog+MQopBDRF8CAAAAAAAAAAAAAAAAAAAAAM93gshx0ncGiIIURFFUgj
> > RA9JXg+4LxlQGebwTRF4xvDBAEJYiiqAQFgOBLTxQ5
6UsDAA==));for($i=0;$i<8*length
> > $vec;$i++) { print "\n" unless $i % 67; print vec( $vec, $i, 1) ? '8' :
'_' }
>
> And using just uuencoding works even better, and doesn't require an
> external module:
>
> $u=q{M``````````#@1<['"3E?]!TDB@C1*"*B("&10?A*$?%]%8D8PI>*B.B;1!01
> }. q{MHEA$1$$9'(<0A1PB^A(``````````/!\)X@<)WUG@"A(011%)4@#1%\)OB\8
> }. q{<7QG@^480?<'XQ@!!4((HBDI0``B^]$21D[XT````};$j=unpack("u",$u);
> for(0..938){print vec($j,$_,1)?"8":" ";print"\n"unless(($_+1)%67)}
>
> --
> I'm not a programmer but I play one on TV...
Cool!
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.
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 V10 Issue 1538
***************************************