[22466] in Perl-Users-Digest
Perl-Users Digest, Issue: 4687 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 9 18:06:31 2003
Date: Sun, 9 Mar 2003 15:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 9 Mar 2003 Volume: 10 Number: 4687
Today's topics:
Re: a minor point about the distinction between arrays ctcgag@hotmail.com
bug in perlcc.bat (perl 5.8 for win32) (Liu Kai)
Re: call subroutine with reference with strict in place (Mike Solomon)
Re: call subroutine with reference with strict in place <jurgenex@hotmail.com>
Re: call subroutine with reference with strict in place <uri@stemsystems.com>
Re: call subroutine with reference with strict in place <flavell@mail.cern.ch>
Re: is a hash the best way to do this? (Anno Siegel)
Re: is a hash the best way to do this? <brad@langhorst.com>
Re: is a hash the best way to do this? (david)
Re: Lightweight CGI module? <bart.lateur@pandora.be>
Re: Lightweight CGI module? <bart.lateur@pandora.be>
Re: Lightweight CGI module? <tore@aursand.no>
Re: mod_perl: why are my Handlers called twice? <No_4@dsl.pipex.com>
Re: new Perl feature request: call into shared libs <no.spam@gknw.de>
Re: new Perl feature request: call into shared libs <nospam-abuse@ilyaz.org>
perl 5.6 and threads (Scott)
Re to all <humrattle@hotmail.com>
Re: Re to all <wksmith@optonline.net>
Re: Re to all <jurgenex@hotmail.com>
Re: Regular Expressions <bach@nospamworld.com>
Re: Ugh. Better way to turn strings into trees besides <apollock11@hotmail.com>
Re: Using browser instead of Tk? (Gruebait)
Re: Using browser instead of Tk? <please@no.spam>
Re: Using browser instead of Tk? <michal@gortel.phys.ualberta.ca>
Re: Using browser instead of Tk? (Gruebait)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 09 Mar 2003 21:40:09 GMT
From: ctcgag@hotmail.com
Subject: Re: a minor point about the distinction between arrays and lists.
Message-Id: <20030309164009.148$Vn@newsreader.com>
Michele Dondi <bik.mido@tiscalinet.it> wrote:
> Having read the relevant docs (including the faq), I think I have
> mostly understood the difference between arrays and lists. However I
> still have the feeling that there are some details that are plainly
> counter-intuitive.
>
> In particular I have an issue with subscribing the return value(s) of
> a function. Thus I can use e.g. '(split /$re/)[0]' to get the first
> element or '(reverse split /$re/)[0]' to get the last one without
> assigning to an intermediate array var.
or
(split /$re/)[-1]
to get the last one.
> But how can I get, say, both the *1st* and the *last* entry?
(split /$re/)[0,-1];
> One
> obvious answer would be to just do it another way... granted! But IMHO
> there are situations in which using a slice would be elegant and
> conceptually clear.
I agree. And you can already do that with -1.
> Wouldn't it be nice if there were an automatic variable to be used
> exclusively as a subscript with the meaning of "subscript of last
> entry of *this* (possibly anonymous) array"?
There already is. But wouldn't it really be nice if the .. operator
was sufficiently DWIM to allow this:
(split)[3..-2]
to take the 4th element through the penultimate element? There are so
many times I've wanted to do this, but had to stuff the intermediate into
a named array so I could get the (@x-2).
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service New Rate! $9.95/Month 50GB
------------------------------
Date: 9 Mar 2003 10:52:34 -0800
From: lk68@sjtu.edu.cn (Liu Kai)
Subject: bug in perlcc.bat (perl 5.8 for win32)
Message-Id: <5b9a73fa.0303090559.5bcecae2@posting.google.com>
in perlcc.bat
$link .= " perl57.lib kernel32.lib msvcrt.lib";
should be
$link .= " perl58.lib kernel32.lib msvcrt.lib";
------------------------------
Date: 9 Mar 2003 12:33:10 -0800
From: mike_solomon@lineone.net (Mike Solomon)
Subject: Re: call subroutine with reference with strict in place
Message-Id: <56568be5.0303090145.29147cdb@posting.google.com>
Thanks for all the help with this issue.
I will use a despatch table to call the sub routine
Can anyone tell me why symbolic references are not allowed when using strict?
If I use them it saves me declaring the subroutine names in a despatch table.
Have i answered my own question?
Thanks
Regards
Mike Solomon
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnb6l7a6.d8c.tadmc@magna.augustmail.com>...
> Mike Solomon <mike_solomon@lineone.net> wrote:
>
> >
> > it uses a sympolic reference, which is not allowed when using strict,
>
>
> So use a Real Reference instead of a symbolic one.
>
>
> > i would appreciate any help making this work without turning off
> > strict
>
> > our $screen = "a2";
> >
> > &test;
> >
> > sub test {
> > &$screen;
> > }
> >
> > sub a1 {
> > print "A1";
> > }
> >
> > sub a2 {
> > print "A2";
> > }
>
>
> --------------------------------
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> my %subs = (
> a1 => \&a1,
> a2 => \&a2,
> );
>
> my $screen = "a2";
>
> &test;
>
> sub test {
> $subs{$screen}->();
> }
>
> sub a1 {
> print "A1";
> }
>
> sub a2 {
> print "A2";
> }
> --------------------------------
------------------------------
Date: Sun, 09 Mar 2003 21:01:06 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: call subroutine with reference with strict in place
Message-Id: <mYNaa.3634$qB5.2259@nwrddc01.gnilink.net>
[Please do not top post]
[Please do not blindly full quote]
Mike Solomon wrote:
> Can anyone tell me why symbolic references are not allowed when using
> strict?
Please see the PerlFAQ: "How can I use a variable as a variable name?" and
http://www.badtz.org/pics/bart.gif
jue
------------------------------
Date: Sun, 09 Mar 2003 21:05:38 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: call subroutine with reference with strict in place
Message-Id: <x7r89gp7xa.fsf@mail.sysarch.com>
>>>>> "MS" == Mike Solomon <mike_solomon@lineone.net> writes:
first off, don't top post. read the group FAQ and learn to edit quotes
as well.
MS> I will use a despatch table to call the sub routine
MS> Can anyone tell me why symbolic references are not allowed when
MS> using strict?
because strict disables them.
MS> If I use them it saves me declaring the subroutine names in a
MS> despatch table.
that doesn't save you anything but opens up a world of trouble.
the symbol table is just a global hash tree with special behavior
(looking up symbols). so why use it when a regular hash will do and has
many advantages?
a regular hash can be lexical which makes it private and safer. it can't
affect some other symbols by accident (as when you pass in a bogus sub
name). it can be passed around to other subs if needed and stay
safe. the symbol table is always global.
RULE: use the symbol table hashes ONLY for munging the symbol
table. most regular code never needs to mung the symbol table.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class
------------------------------
Date: Sun, 9 Mar 2003 21:51:57 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: call subroutine with reference with strict in place
Message-Id: <Pine.LNX.4.53.0303092149260.8866@lxplus066.cern.ch>
On Sun, Mar 9, Mike Solomon inscribed on the eternal scroll:
> I will use a despatch table to call the sub routine
Good choice, if I may say so.
> Can anyone tell me why symbolic references are not allowed when using strict?
Not just "somebody" already did. it's, in effect, the topic of
three articles starting here http://perl.plover.com/varvarname.html
Don't top-post with fullquote, or you'll find the regulars stop
talking to you. -> Posting guidelines for the group.
------------------------------
Date: 9 Mar 2003 16:19:39 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: is a hash the best way to do this?
Message-Id: <b4fpir$pvd$1@mamenchi.zrz.TU-Berlin.DE>
Brad Langhorst <brad@langhorst.com> wrote in comp.lang.perl.misc:
> david wrote:
>
> > Thanks. This works in all but the cases where the comment field is set
> > to "". It looks like this is happening if a comments field is
> > something like this:
> > Comment: (some text)
> > When it does the search/replace on these records, it writes the
> > $uid{$key} as a blank. Any ideas to not process these records? My
> > previous code checked to make sure it has a value before executing the
> > replace:
> > if (!($keyname eq "") && !($keyvalue eq ""))
> >
> did you try a
> next if $comment == "" after the find_comment in the first loop?
^^
You don't want "==" in a string compare, you want "eq".
Actually, the simplest test for an empty string is the length:
next unless length $comment;
Anno
------------------------------
Date: Sun, 09 Mar 2003 17:25:41 GMT
From: Brad Langhorst <brad@langhorst.com>
Subject: Re: is a hash the best way to do this?
Message-Id: <pOKaa.10756$wJ1.1026365@newsread2.prod.itd.earthlink.net>
Anno Siegel wrote:
> Brad Langhorst <brad@langhorst.com> wrote in comp.lang.perl.misc:
>> > if (!($keyname eq "") && !($keyvalue eq ""))
>> >
>> did you try a
>> next if $comment == "" after the find_comment in the first loop?
> ^^
> You don't want "==" in a string compare, you want "eq".
>
> Actually, the simplest test for an empty string is the length:
>
> next unless length $comment;
>
> Anno
doh - right...
brad
------------------------------
Date: 9 Mar 2003 11:01:31 -0800
From: dwlepage@yahoo.com (david)
Subject: Re: is a hash the best way to do this?
Message-Id: <b09a22ae.0303091101.316b2ae1@posting.google.com>
Brad Langhorst <brad@langhorst.com> wrote in message news:<eNHaa.10525$wJ1.1003344@newsread2.prod.itd.earthlink.net>...
> david wrote:
>
> > Thanks. This works in all but the cases where the comment field is set
> > to "". It looks like this is happening if a comments field is
> > something like this:
> > Comment: (some text)
> > When it does the search/replace on these records, it writes the
> > $uid{$key} as a blank. Any ideas to not process these records? My
> > previous code checked to make sure it has a value before executing the
> > replace:
> > if (!($keyname eq "") && !($keyvalue eq ""))
> >
> did you try a
> next if $comment == "" after the find_comment in the first loop?
> is that what you want to do "skip blank comment fields?
> if not you could set $comment to something else before the hash assignment
>
> brad
Well, what I want to do is not do the search and replace for records
that do not match on the new search code for the 'Comment' field. I
had to refine my search some from the original post:
while (<IN>) {
#Reset $keyname and $keyvalue for each new record
if (/^dn: sccUserId=/) {
$keyname = $keyvalue = "";
#Set $keyname to "UserId".TOK.0
if (/^dn: sccUserId=(\w+),/) {
$keyname = $1;
}
}
#Set $keyvalue to true authenticator value
if (/^sccComment: (DG-\w+)\s+/) {
$keyvalue = $1;
next if $keyvalue == "";
}
Because the file has two 'blocks' of data the correlate to 1 user,
(one section starts with 'dn: UserId' while the other starts with 'dn:
AuthenticatorId'
see below:
dn: UserId=hello,User
objectclass: User
Comment: DG-P08233
UserId: hello
UserRole: homeoffice
Authenticator: 1:hello.TOK.0
dn: UserId=KEEGAN,User
objectclass: User
Comment: This is a test record
UserId: hello
UserRole: homeoffice
Authenticator: 1:KEEGAN.TOK.0
dn: UserId=DLEPAGE,User
objectclass: User
Comment: DG-G77777
UserId: DLEPAGE
UserRole: homeoffice
Authenticator: 1:DLEPAGE.TOK.0
dn: AuthenticatorId=hello.TOK.0,Authenticator
objectclass: Authenticator
StoredAt: AuthenticatorId=hello.TOK.0
EntryId: DesAuthenticator-hello.TOK.0-2003/01/28 13:10:08.943 (GMT)
(on 10.65.63.140:5040)-2039
DBTimestamp: 2003/02/28 10:31:56.828 (GMT)
AuthenticatorId: hello.TOK.0
dn: AuthenticatorId=KEEGAN.TOK.0,Authenticator
objectclass: Authenticator
StoredAt: AuthenticatorId=KEEGAN.TOK.0
EntryId: Authenticator-KEEGAN.TOK.0-2003/01/28 13:10:08.943 (GMT)
DBTimestamp: 2003/02/28 10:31:56.828 (GMT)
AuthenticatorId: KEEGAN.TOK.0
dn: AuthenticatorId=DLEPAGE.TOK.0,Authenticator
objectclass: Authenticator
StoredAt: AuthenticatorId=DLEPAGE.TOK.0
EntryId: Authenticator-DLEPAGE.TOK.0-2003/01/28 13:10:08.943 (GMT)
DBTimestamp: 2003/02/28 10:31:56.828 (GMT)
AuthenticatorId: DLEPAGE.TOK.0
IF the user has a value starting with 'DG-something' in 'Comment' I
want to find all instances of 'UserId.TOK.0' and replace it with this
'DG-' value. If it does not match the DG- search, it should skip this
record. Currently what is happening with the current code is that it
will force a search/replace irregardless. Since im fairly new, im not
entirely sure how to implement your suggestion of reading the file
first, then implementing the foreach loop. Would it be something like
this:
#Initialize variables
my $infile = "testfile.txt";
my $outfile = "newfile.txt";
my ($keyname, $keyvalue, $search, $replace) = "";
my %uid = ();
open(IN, "<$infile") or die "Could not open: $infile $!";
flock (IN, 1); #Shared lock
open(OUT, ">$outfile") or die "Could not open: $outfile $!";
flock (OUT, 2); #Exclusive lock
while (<IN>) {
#Reset $keyname and $keyvalue for each new record
if (/^dn: sccUserId=/) {
$keyname = $keyvalue = "";
#Set $keyname to "UserId".TOK.0
if (/^dn: sccUserId=(\w+),/) {
$comment = find_comment;
$uid{$1} = $comment;
}
}
#Set $keyvalue to true authenticator value
if (/^sccComment: (DG-\w+)\s+/) {
$keyvalue = $1;
next if $keyvalue == "";
}
#Add values to hash
if ($keyname && $keyvalue) {
$uid{$keyname} = $keyvalue;
}
}
close(IN);
close(OUT);
foreach $key (keys %uid) {
s/$key/$uid{$key}/;
}
Or should I be doing the foreach before closing the file? I can print
out the hash table and get the right values after the 'close' with :
while ( ($key,$value) = each %uid ) {
print OUT "$key --> $value\n";}
so I can tell the hash table is popualated, but now how to I force
that back into the datafile I want to do the search and replace? I
think that is where my disconnect is.
Thanks,
------------------------------
Date: Sun, 09 Mar 2003 18:47:08 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Lightweight CGI module?
Message-Id: <jo2n6vktinht1ocsor38005lkm92rvna95@4ax.com>
Tore Aursand wrote:
>However, with _most_ of the other modules, I even keep them in memory
>_after_ they've been created. I didn't think I could do that with CGI.pm,
>as it then would miss out the query...?
Why not? The query is parsed when you create a new CGI object., or when
you call ReadParse in cgi-lib compatibility mode.
--
Bart.
------------------------------
Date: Sun, 09 Mar 2003 18:59:07 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Lightweight CGI module?
Message-Id: <043n6vof56j6mag2t3va252rhjhjh36ae2@4ax.com>
Helgi Briem wrote:
>On Fri, 07 Mar 2003 01:11:23 +0100, "Tore Aursand"
><tore@aursand.no> wrote:
>
>>I know. Bad use of the bottleneck from me. I _know_ that CGI.pm is
>>pretty bloated, and I _know_ that it'll give me better overall performance
>>if I had a smaller/lighter one.
>
>You don't know that *at all*.
I find it remarklable that a module called "CGI" can be used for CGI,
but is only really acceptable when *not* using CGI, i.e. with mod_perl.
--
Bart.
------------------------------
Date: Sun, 09 Mar 2003 20:45:46 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Lightweight CGI module?
Message-Id: <pan.2003.03.09.19.42.05.859833@aursand.no>
On Sun, 09 Mar 2003 18:47:08 +0000, Bart Lateur wrote:
>> However, with _most_ of the other modules, I even keep them in memory
>> _after_ they've been created. I didn't think I could do that with
>> CGI.pm, as it then would miss out the query...?
> Why not? The query is parsed when you create a new CGI object., or when
> you call ReadParse in cgi-lib compatibility mode.
Excactly my point; I wrote that I can't use the cached CGI.pm instance
from memory _after_ it's created. If I _do_ use the cached version,
'new()' won't be run.
Hmm. Maybe there is a way to tell CGI.pm _just_ to re-read the query?
--
Tore Aursand <tore@aursand.no>
------------------------------
Date: Sun, 09 Mar 2003 16:12:53 +0000
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: mod_perl: why are my Handlers called twice?
Message-Id: <3e6b6805$0$5371$cc9e4d1f@news.dial.pipex.com>
One reason tha things can get called twice is for default indexing.
If the URI is http://aserver.in.somdomain/docroot/subdir/
then the handler will be called twice, once for /docroot/subdir/, and
again for /docroot/subdir/index.html (assuming that this is you default
index file). (If you have a list of default index names it can get
called > twice).
--
-*- Just because I've written it here doesn't -*-
-*- mean that you should, or I do, believe it. -*-
------------------------------
Date: Sun, 09 Mar 2003 16:15:38 +0100
From: Guenter <no.spam@gknw.de>
Subject: Re: new Perl feature request: call into shared libs
Message-Id: <3E6B5A9A.6050506@gknw.de>
Hi Bryan,
seems you're the right man for a new Unix::API module then; please take
a look at the Win32::API module, I think that this could serve as base
for it; if you replace the inline asm with yours, and find a way to load
a .so, then it's learly done...!
Guenter.
Bryan Castillo schrieb:
>>During the time of v5.000alpha, there was a discussion on p5p about
>>adding a functionality of a call to a function with the simplest,
>>cdecl, calling convention. Again, this was not implemented due to
>>non-portability of such a call. E.g., I do not know how to write i386
>>assembler which would call a C function with n long arguments; here n
>>is a variable number given as a parameter:
>>
>> void
>> call_many_longs(void (*f)(), long n, long *array_of_arguments)
>> {
>> __asm__("???");
>> }
>
>
> (This should work on Linux/i386 using gcc/gas? I only tried 0 to 6 32 bit args)
>
> _call_fptr:
> pushl %ebp /* save register */
> movl %esp, %ebp /* setup ebp for reference */
>
> pushl %ecx /* save register */
> pushl %ebx /* save register */
>
> movl 16(%ebp), %ecx /* store count */
> sall $2, %ecx /* multiply by 4 */
> movl 12(%ebp), %ebx /* load array */
> addl %ecx, %ebx /* set position to end of array */
>
> .lp1bg:
> cmpl %ebx, 12(%ebp) /* at beginning of array ? */
> je .lp1end /* end loop */
> subl $4, %ebx /* decrement pointer */
> pushl (%ebx) /* push argument onto stack */
> jmp .lp1bg /* loop */
> .lp1end:
>
> movl 8(%ebp), %eax /* get the function pointer */
> call *%eax /* call the function */
>
> movl -4(%ebp), %ecx /* restore register */
> movl -8(%ebp), %ebx /* restore register */
> movl %ebp, %esp /* set SP to known position */
> popl %ebp /* restore SP and ebp */
>
> ret /* done */
>
>
>
>
>>But it is easy to write a wrapper which would work with e.g., n<20;
>>both for cdecl, and for regparam(3) calling conventions. Actually,
>>doing this for the OS2 port is in my TODO list. [Important since OS/2
>>API more or less always takes a series of longs (or compatibles) as
>>arguments.]
>>
>>Hope this helps,
>>Ilya
>
>
------------------------------
Date: Sun, 9 Mar 2003 20:52:44 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: new Perl feature request: call into shared libs
Message-Id: <b4g9is$1udd$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Guenter
<no.spam@gknw.de>], who wrote in article <3E6A3C3A.2010801@gknw.de>:
> > This is not possible. Shared libraries provide addresses of
> > C-callable functions, but do not describe which calling convention the
> > function implement. Without this knowledge, it is not possible to
> > call such a function. While Perl allows you to easily load a shared
> > library, and get the address of a function, you cannot provide
> > arguments to the function - unless via XS interface, which goes
> > through a C compiler, so is not a runtime method.
> well, I dont see the problem: f.e. spoken for Win32 you can get tons of
> info about the Win32 API, in addition every compiler comes with the SDK
> headers, so there's absolutely no problem to find descriptions for the
> functions.
If you *know* the calling convention, then (at least theoretically)
you can call the function. But just knowing the name of function in
the DLL, you can't do it.
And as I said, this "theoretical" part looks very hard to make
universal enough. Even calling a function of signature
void f1000(int a1, ..., int a1000)
is pretty hard (for an arbitrary value of 1000 ;-); imagine calling a
function which expects an argument in EBP.
> You really should take a look at Win32::API, it's very cool;
> and I've already done sone samples which access the Novell CLient API,
> and show that everything's possible, even with complex structs...
structs are not a problem, given pack (which was designed exactly for
this purpose).
> but I dont know: do you compile OS/2 with emx?? if so you will have
> trouble with the inline assembler, I think gcc doesnt know it...
Of course it does.
> but once you have solved that I think the rest is not so hard to port...
A simple question: can you call the function f1000 given above?
Ilya
------------------------------
Date: 9 Mar 2003 12:06:45 -0800
From: scott@scottsavarese.com (Scott)
Subject: perl 5.6 and threads
Message-Id: <8747e98f.0303090914.4b9c2d57@posting.google.com>
I know that on perl 5.8 ithreads is now the supported way to do
threads in perl. However my company uses 5.6 and because of testing
procedures getting them to update to 5.8 is not going to be likely
right now... I was wondering how stable ithreads is on 5.6 and whether
or not ithreads is safe in that version to use in a production (this
will be used to monitor ALOT of servers) application.
Can anybody help me?
Thanks,
Scott
------------------------------
Date: Sun, 9 Mar 2003 17:44:45 +0100
From: "Hum Rattle" <humrattle@hotmail.com>
Subject: Re to all
Message-Id: <b4fr1b$1vr2cd$1@ID-63849.news.dfncis.de>
Hello to all
i just wanted to know if the syntax is right cause i come
from pascal.
now it works perfectly.
The problem was my browser cache
( i write cgi programs) which showed me an error page.
i have no access to a shell so i could'nt not see any error
messages from perl.
thanks to all
regards
hum
------------------------------
Date: Sun, 09 Mar 2003 20:58:20 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Re to all
Message-Id: <MVNaa.78403$gf7.17234228@news4.srv.hcvlny.cv.net>
"Hum Rattle" <humrattle@hotmail.com> wrote in message
news:b4fr1b$1vr2cd$1@ID-63849.news.dfncis.de...
> Hello to all
>
> i just wanted to know if the syntax is right cause i come
> from pascal.
>
> now it works perfectly.
> The problem was my browser cache
> ( i write cgi programs) which showed me an error page.
> i have no access to a shell so i could'nt not see any error
> messages from perl.
>
Look in your server error log for messages from perl. They will be
intermixed with messages from other programs, but sure is better than
nothing. If you are using CGI.pm (you probably should be) readup on
FatalsToBrowser.
Good Luck,
Bill
------------------------------
Date: Sun, 09 Mar 2003 21:11:25 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Re to all
Message-Id: <16Oaa.3718$qB5.2448@nwrddc01.gnilink.net>
[You may want to come up with a better Subject line; The one you've chosen
does not convey any information whatsoever]
Hum Rattle wrote:
> i just wanted to know if the syntax is right cause i come
> from pascal.
If you want to test the syntax of a Perl program then you can run just the
Perl compiler using "perl -c"
> now it works perfectly.
What works perfectly? You didn't even state a problem...
> The problem was my browser cache
> ( i write cgi programs) which showed me an error page.
Did you check "perldoc -q 500"?
> i have no access to a shell so i could'nt not see any error
> messages from perl.
I don't believe you.
Are you seriously claiming that you are using WebTV or some other device
that doesn't have any shell as your software development platform?
Then go, no better run, to your nearest used computer dealer and get an old
486 running Windows95. Actually people are happy to give them away for free
such that they don't have to pay the recycling fee. Even that crummy piece
would be a major improvment over your current situation and is totally
sufficient to develop and test Perl programs.
jue
------------------------------
Date: Sun, 09 Mar 2003 18:12:59 GMT
From: "bach" <bach@nospamworld.com>
Subject: Re: Regular Expressions
Message-Id: <LuLaa.76112$em1.37446@news04.bloor.is.net.cable.rogers.com>
> Pseudo-code is used by experienced programmers to explain well-understood
> solutions without the syntactic restrictions of one particular programming
> language. You must know and understand the code before you can derive
> pseudo-code from it. You cannot express a problem you don't understand
> in pseudo-code.
So, you're one of them "experienced programmers", are you? I've got news
for your highness: your pseudo-code definition is flawed. Ask some folks at
Technische Universitaet Berlin, I'm sure you'll find smart ones not sharing
your view.
Peuso-code, actually spelled pseudocode, is a notation resembling a
programming language but not intended for actual compilation.
> You must know and understand the code before you can derive
> pseudo-code from it
Wrong! People usually start by writing pseudocode when brainstorming. They
use that as a template or guideline to base the actual code on. You're
talking as if programming and pseudocode were reserved for the geek and
famous only. Stop, you're cracking me up! :-)
> Far less is pseudo-code an excuse to scribble away and let the reader
> figure it out.
Here you go fluffling your little feathers again and losing sight of what
actually matters. Please refer to the actual defenition of pseudocode
above. You wanted code that would compile, you didn't get that; so now,
you're holding your breath until you turn blue. Keep holdin'.
> We see this argument "you can't criticize it, it was only pseudo-code"
> quite often. It is a pseudo-argument.
That wasn't my argument, though that is what you chose to read into it. As
I said, you can criticize the sloppiness all you want, it's irrelevant to
me. Are you hearing me? It's I-R-R-E-L-E-V-A-N-T! You should really try to
get off your high horse and look past your so-called "pseudo-argument".
Nitpicking on every little detail to show how much you know (which is
actually proving quite the contrary, if you ask me). 'Been there, done
that, nothing to gain! I'm actually enjoying the response I got from Benj.,
why can't you enjoy it with me? Why can't we just all get along? ;-)
-b@
P.S. As I'm sure your insecurity won't be at peace if you resist the
temptation to reply, go ahead and fire your last bullet, so that I can give
you your trophy. Then, we'll both be happy.
------------------------------
Date: Sun, 09 Mar 2003 11:20:43 -0800
From: Arvin Portlock <apollock11@hotmail.com>
Subject: Re: Ugh. Better way to turn strings into trees besides eval?
Message-Id: <b4g46c$1sok$1@agate.berkeley.edu>
Benjamin Goldberg wrote:
> my %struct;
> while( my ($key, $value) = each %$post_data ) {
> next unless $key =~ /^\w+(?:-\d+)+\z/;
> my @parts = split /-/, $key;
> my $node = \%struct;
> for my $subkey ( @parts ) {
> $node = $node->{children}{$subkey} ||= {};
> }
> $node->{value} = $value;
> }
>
> Note that this produces the same data structure as you're using, just
> without the eval"".
Thanks Benjamin! This is actually very close to what I was coming up
with but couldn't seem to get it to work. I think I gave up too soon.
I'll send the result of the above to another subroutine to refine it
into a more useful tree for my purposes.
I used Data::Dumper for the first time to examine the output.
Surprisingly useful little module that.
------------------------------
Date: 9 Mar 2003 11:49:30 -0600
From: gruebait@OVERSPAMMED.com (Gruebait)
Subject: Re: Using browser instead of Tk?
Message-Id: <3e6b7eaa$1@news.starnetinc.com>
On Sun, 9 Mar 2003 15:49:55 -0000, someone, possibly d.borland, scribed:
> Hi all,
>
> I was wondering if there is a way to use perl to communicate with a web
> browser without having to run a web server?
>
> Basically i am looking to create a GUI front end to for a database like
> program and would rather not have to learn pTk for this. Thus the reason
> for wondering about using a web browser as an average browsers capabilities
> will be more than sufficent. As i am wanting to make this program as
> portable as possible this would also help, unless of course the user would
> need to have a web server running on their machine, as the script/program
> and browser would need to be able to pass data to and from each other while
> running (which would obviously not be so good).
>
> I am using a Win32 macinhe though would prefer any ideas to be no-platform
> independent. Though any help you can give is much appreciated.
I faced a similar task (my daughter wanted a db-based cookbook) and I
found no way of using a web browser w/o a server - whether using MySql and
perl or C cgi's, or Perlscript, PHP. I went with PHP, some Perl and MySql,
and included a small webserver (Xitami). Could've been all Perl w/o the
PHP. If this is something you want to distribute, licensing on the server may
be an issue.
--
"You are in a maze of twisty passages, all alike." - Will Crowther
perl -e '$_="prxryyl\@qiby.pbz <Cenvt Kryyl>\n";tr/a-z/n-za-m/;print;'
------------------------------
Date: Sun, 09 Mar 2003 18:12:48 +0000
From: Chris Lowth <please@no.spam>
Subject: Re: Using browser instead of Tk?
Message-Id: <8xLaa.601$Dy3.159@newsfep3-gui.server.ntli.net>
Gruebait wrote:
> On Sun, 9 Mar 2003 15:49:55 -0000, someone, possibly d.borland, scribed:
>> Hi all,
>>
>> I was wondering if there is a way to use perl to communicate with a web
>> browser without having to run a web server?
>>
>> Basically i am looking to create a GUI front end to for a database like
>> program and would rather not have to learn pTk for this. Thus the reason
>> for wondering about using a web browser as an average browsers
>> capabilities
>> will be more than sufficent. As i am wanting to make this program as
>> portable as possible this would also help, unless of course the user
>> would need to have a web server running on their machine, as the
>> script/program and browser would need to be able to pass data to and from
>> each other while running (which would obviously not be so good).
>>
>> I am using a Win32 macinhe though would prefer any ideas to be
>> no-platform
>> independent. Though any help you can give is much appreciated.
>
> I faced a similar task (my daughter wanted a db-based cookbook) and I
> found no way of using a web browser w/o a server - whether using MySql and
> perl or C cgi's, or Perlscript, PHP. I went with PHP, some Perl and MySql,
> and included a small webserver (Xitami). Could've been all Perl w/o the
> PHP. If this is something you want to distribute, licensing on the server
> may be an issue.
>
I have had to face this one too - and wrote a simple web server in perl
using modules available on cpan.
Chris
--
These ramblings are not sanctioned by my employer,
mother or kids. My views are my own.
My real address is: chris at lowth dot sea oh em
+------------------------------------------------+
| visit: http://protector.sourceforge.net |
| for OpenSource (free) virus protection |
+------------------------------------------------+
------------------------------
Date: 9 Mar 2003 18:51:47 GMT
From: Michal Jaegermann <michal@gortel.phys.ualberta.ca>
Subject: Re: Using browser instead of Tk?
Message-Id: <b4g2g3$eui$2@pulp.srv.ualberta.ca>
Gruebait <gruebait@overspammed.com> wrote:
>
> I faced a similar task (my daughter wanted a db-based cookbook) and I
> found no way of using a web browser w/o a server
Hardly surprising. :-) OTOH 'perldoc HTTP::Daemon'.
--mj
------------------------------
Date: 9 Mar 2003 15:35:30 -0600
From: gruebait@OVERSPAMMED.com (Gruebait)
Subject: Re: Using browser instead of Tk?
Message-Id: <3e6bb3a2@news.starnetinc.com>
On 9 Mar 2003 18:51:47 GMT, someone, possibly Michal Jaegermann, scribed:
> Gruebait <gruebait@overspammed.com> wrote:
>>
>> I faced a similar task (my daughter wanted a db-based cookbook) and I
>> found no way of using a web browser w/o a server
>
> Hardly surprising. :-) OTOH 'perldoc HTTP::Daemon'.
>
> --mj
'perldoc HTTP::Daemon'...!?
aw, crap. At least the OP isn't waiting as long as my daughter for
something useful...
--
"Once agin, I wish there were a tilde rotated ninety degrees, so I could
implement an appropriate 'smiley'" - Gruebait
perl -e '$_="prxryyl\@qiby.pbz <Cenvt Kryyl>\n";tr/a-z/n-za-m/;print;'
------------------------------
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 4687
***************************************