[10796] in Perl-Users-Digest
Perl-Users Digest, Issue: 4398 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 10 13:07:20 1998
Date: Thu, 10 Dec 98 10:01:36 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 10 Dec 1998 Volume: 8 Number: 4398
Today's topics:
PERL & POWERBUILDER uncle_remus@my-dejanews.com
PERL & POWERBUILDER crbain1@hotmail.com
Re: PERL & POWERBUILDER scott@softbase.com
Perl 5.005_002 and berkeley db problems pete@smtl.co.uk
Re: Perl Floating Point Rounding Algorithm? (Harry P Bloomberg)
Perl for processing HTML forms <tady@w3s.ie>
Re: Perl for processing HTML forms <sansil@pchome.com.tw>
Problem passing variable to browser. <esencan@sema.on.ca>
Re: Problem passing variable to browser. (Tad McClellan)
Re: Question on using grep to retrive directory on Wind (Tad McClellan)
Re: Question on using grep to retrive directory on Wind (umsee)
returning a socket handle or undef from a sub? <removeMike@SinglepointSys.com>
Rhode Island Perl Mongers Meeting (Brian Jepson)
running one script from another <jbo@dator.dk>
Spaces in Perl scripts. <millerc@ica.net>
Re: Spaces in Perl scripts. (brian d foy)
Re: take out periods (Craig Berry)
Re: take out periods (Matthew Bafford)
Re: Trouble getting started with DBM (Tad McClellan)
User to user email pegboy@nac.net
Re: xsubpp errors, can't dmake compiler-a3, etc. (Randy Kobes)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 10 Dec 1998 16:25:51 GMT
From: uncle_remus@my-dejanews.com
Subject: PERL & POWERBUILDER
Message-Id: <74osmb$i5q$1@nnrp1.dejanews.com>
Does anyone know how to "marry" perl programs with PowerBuilder front-ends?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 10 Dec 1998 17:09:13 GMT
From: crbain1@hotmail.com
Subject: PERL & POWERBUILDER
Message-Id: <74ov7n$kej$1@nnrp1.dejanews.com>
Anyone know how to "marry" perl with a PowerBuilder GUI?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 10 Dec 1998 18:44:05 GMT
From: scott@softbase.com
Subject: Re: PERL & POWERBUILDER
Message-Id: <36701675.0@news.new-era.net>
uncle_remus@my-dejanews.com wrote:
> Does anyone know how to "marry" perl programs with PowerBuilder front-ends?
In Windows, you could make an Automation DLL out of your PB
application (if you can do that -- RAD tools like Delphi
could) and call it from a Perl program.
Scott
------------------------------
Date: Thu, 10 Dec 1998 15:47:04 GMT
From: pete@smtl.co.uk
Subject: Perl 5.005_002 and berkeley db problems
Message-Id: <74oqdn$fub$1@nnrp1.dejanews.com>
Hi
We run a tape backup programme which used perl with the Berkeley DB
routines. The database needs to be shared between linux and SunOS 4.1.3.
The linux perl uses Berkeley db version 2, and runs with no problems. However,
trying to compile the Sun version of perl 5.005_002 with the version 2 db
libraries causes the db-* tests to fail fairly early on.
I have seen a few other posts referring to this problem, but no solutions.
Has this problem been solved (or is it a configuration problem on my part) ?
Regards,
Pete
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 10 Dec 1998 15:00:16 GMT
From: hpb+@pitt.edu (Harry P Bloomberg)
Subject: Re: Perl Floating Point Rounding Algorithm?
Message-Id: <74onm0$ovu$1@usenet01.srv.cis.pitt.edu>
In article <comdog-ya02408000R1012980849210001@news.panix.com>,
brian d foy <comdog@computerdog.com> wrote:
>
>> I think the answer is in your question. Perl does not do rounding
>> of floating point numbers for printing. This is left to the
>> C library functions which are called. Different C libraries,
>> different rounding.
>
>that is, unless you are using a modern version of Perl that
>implements these functions internally ;)
>
I'm using Version 5.004_04 (according to perl -v) which I think
qualifies as modern.
Thanks,
Harry Bloomberg
hpb+@pitt.edu
------------------------------
Date: Thu, 10 Dec 1998 15:33:30 +0000
From: Tady Walsh <tady@w3s.ie>
Subject: Perl for processing HTML forms
Message-Id: <366FE9CA.4DB64BAC@w3s.ie>
Anyone know any good sites for teaching how to process HTML forms using
Perl,
or any sites for teaching Perl at all...?
------------------------------
Date: Thu, 10 Dec 1998 23:58:53 +0800
From: Silver CHEN <sansil@pchome.com.tw>
Subject: Re: Perl for processing HTML forms
Message-Id: <366FEFBD.FEAD321F@pchome.com.tw>
www.perl.com
Tady Walsh wrote:
>
> Anyone know any good sites for teaching how to process HTML forms using
> Perl,
> or any sites for teaching Perl at all...?
------------------------------
Date: Thu, 10 Dec 1998 10:00:33 -0500
From: Emre Sencan <esencan@sema.on.ca>
Subject: Problem passing variable to browser.
Message-Id: <366FE20A.3AB2@sema.on.ca>
Hi,
I'm a beginner perl programmer and need help with a simple script I'm
working on. Basically this script looks at a text files (actually just
one line), breaks up the line using a comma a delimeter and puts each
delimeted value into a string. The string is then written to the
browser. The script runs fine in the shell window but when I call it
from the browser there are no values. In the HTML of the files I can see
that everything has been sent to the browsers except the values. I've
looked through the perl faqs and looked through the variables section in
several online books (at mcp.com). If someone has some extra time, could
they please look at the script and tell me what I am doing wrong:
---------------------------------------------------
#!/usr/bin/perl -w
open(MYFILE, "printera.txt");
$line = <MYFILE>;
($symbol, $closing, $date, $time, $change, $v1, $v2, $v3, $v4) =
split(/,/, $line);
close(MYFILE);
print "Content-type: text/html\n\n";
print qq~
<HTML>
<HEAD>
<TITLE>HI!</TITLE>
</HEAD>
<BODY BGCOLOR="#4503ff">
Symbol is $symbol<BR>
Closing Price is $closing<BR>
Change is $change<BR>
</BODY>
</HTML>~;
---------------------------------------------------
The text files contains information about a company stock in delimeted
format--example:
Printer, 1.25, 234, 11:00am, etx..
When run in the shell the output contains the values but not in the
browser. Any help would be appreciated.
Thank You.
Emre Sencan
------------------------------
Date: Thu, 10 Dec 1998 09:53:12 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Problem passing variable to browser.
Message-Id: <8pqo47.802.ln@magna.metronet.com>
Emre Sencan (esencan@sema.on.ca) wrote:
: The script runs fine in the shell window but when I call it
: from the browser there are no values.
Perl FAQ, part 9:
"My CGI script runs from the command line but not the browser.
(500 Server Error)"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 10 Dec 1998 08:10:05 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Question on using grep to retrive directory on Windows NT workstation 4.0 FAT16
Message-Id: <tnko47.q31.ln@magna.metronet.com>
umsee (NOSPAM_umsee@microasia.com) wrote:
: the following code is used:
: opendir(FH,$basedir);
: @dir = grep{-d} readdir{FH};
^ ^
^ ^ please post real code, cut/paste don't type it
: close(FH);
: I noticed that sometimes it doesn't return the directory in $basedir.
: Is this a compatibility problem? If so, what is your suggestion?
1)
I suggest checking to see if the opendir() call actually
opened the directory:
opendir(FH, $basedir) || die "could not open '$basedir' $!";
2) (I myself forgot this in a post this week, thanks LarryR)
your -d test is looking in the *current directory*, which
may be different from $basedir...
@dir = grep{-d "$basedir/$_"} readdir(FH);
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 10 Dec 1998 16:22:36 GMT
From: NOSPAM_umsee@microasia.com (umsee)
Subject: Re: Question on using grep to retrive directory on Windows NT workstation 4.0 FAT16
Message-Id: <74osfe$l88$1@canopus.cc.umanitoba.ca>
In article <tnko47.q31.ln@magna.metronet.com>, tadmc@metronet.com (Tad McClellan) wrote:
>umsee (NOSPAM_umsee@microasia.com) wrote:
>: the following code is used:
>
>: opendir(FH,$basedir);
>: @dir = grep{-d} readdir{FH};
> ^ ^
> ^ ^ please post real code, cut/paste don't type it
>: close(FH);
>
>: I noticed that sometimes it doesn't return the directory in $basedir.
>
>: Is this a compatibility problem? If so, what is your suggestion?
>
>
> 1)
>
> I suggest checking to see if the opendir() call actually
> opened the directory:
>
> opendir(FH, $basedir) || die "could not open '$basedir' $!";
>
>
> 2) (I myself forgot this in a post this week, thanks LarryR)
>
> your -d test is looking in the *current directory*, which
> may be different from $basedir...
>
> @dir = grep{-d "$basedir/$_"} readdir(FH);
>
>
After few hours of looking at the code, I finally realized that I forgot to
use the full pathname. Thanks anyway!
------------------------------
Date: Thu, 10 Dec 1998 10:05:09 -0500
From: "Mike Marshall" <removeMike@SinglepointSys.com>
Subject: returning a socket handle or undef from a sub?
Message-Id: <74oopd$t6q@sjx-ixn5.ix.netcom.com>
I'm just learning, but consider this code extract:
========= MAIN =========
use strict;
my $line;
my $Sock;
$Sock = SocketConnect($host, $port);
unless ($Sock) { die "Socket Connect failed.\n"; }
$line = <$Sock>;
=========== sub =================
# SocketConnect returns a socket handle or 'undef' on error.
sub SocketConnect() {
local *S;
#<snip various socket calls preparing to issue a connect()>
unless connect(S, $paddr) {
warn "connect(): $!\n";
return undef;
}
return *S;
=================================
This produces the message:
Can't use string ("*main::*") as a symbol ref while 'strict refs' in
line....<the SocketConnect() call>
I added a reference to the SocketConnect() call, and that got me past the
problem and working... .but it wasn't really what I wanted... like this:
$Sock = \SocketConnect($host, $port);
What I wanted was to return an (undef) if the connect failed and a useable
"handle" if it worked.... So I then changed the last line in SocketConnect
to this:
return \*S;
and changed the call to this:
$Sock = SocketConnect($host, $port);
but that didn't work either.
I've been looking through the Camel Book (and the Win32 book as well).
There are a few examples of how to return a file handle... and I tried to
follow them.
There's probably a few different ways to get this done, and I've been trying
to use 'strict' and conform to perlstyle as much as possible.. So can
anyone help me get it to work... AND pass strict AND survive the critique of
a 'real' perl programmer? In the meantime, I'm going to look through
Symbol.pm to see if I can figure out if that's got something to do with it.
Many thanks in advance.
Mike Marshall
mike@singlepointsys.CUTcom
------------------------------
Date: Thu, 10 Dec 1998 15:26:37 GMT
From: bjepson@ids.net (Brian Jepson)
Subject: Rhode Island Perl Mongers Meeting
Message-Id: <slrn76vq62.kd.bjepson@gelvis.ids.net>
Announcing the next Rhode Island Perl Mongers meeting:
Wednesday, December 16, 7PM
Near the fountain at DePasquale Square, Federal Hill, Providence
From there, we'll roam to either Caserta's or Angelo's, whichever one
will have a motley bunch...
By way of the "Invite a Perl Personality to Dinner" program, Jon Orwant,
editor of The Perl Journal, will be joining us for the evening. Whoohoo!
Rhode Island Perl Mongers skeletal home page: http://ri.pm.org
Rhode Island Perl Mongers mailing list: Send a message containing the word
SUBSCRIBE to ripm-request@as220.org
--
Brian Jepson * (bjepson@ids.net) * http://users.ids.net/~bjepson
------------------------------
Date: Thu, 10 Dec 1998 18:03:17 +0100
From: "Jesper Bork" <jbo@dator.dk>
Subject: running one script from another
Message-Id: <z6Tb2.263$t26.857@news.get2net.dk>
Hi,
I have a script which is meant to be run from the commandline and e.g. uses
getopt. I would like to execute that script from another script modifying it
and without loading a second Perl interpreter! Anyone knows if I can do this
using maybe eval ?
TIA,
Jesper
jbo@dator.dk
------------------------------
Date: Thu, 10 Dec 1998 11:05:53 -0500
From: "Chris Miller" <millerc@ica.net>
Subject: Spaces in Perl scripts.
Message-Id: <366fefe9.0@lightning.ica.net>
Is there a way to run "system" commands, or any other harmful command in
perl without using spaces?
I have a script that is sent to a unix server and the username and password
fields are enter by the user.
eg, web page asks username:________ password:________
then the script is passed the values.
if the user enters the password: blah";system "rm / -rf";
then when the password is sent to the script it will see the password, and
the unwanted command.
But spaces are not allowed in passwords so I'm curious if there is any
security risk.
Thanks,
Chris.
------------------------------
Date: Thu, 10 Dec 1998 11:58:24 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Spaces in Perl scripts.
Message-Id: <comdog-ya02408000R1012981158240001@news.panix.com>
In article <366fefe9.0@lightning.ica.net>, "Chris Miller" <millerc@ica.net> posted:
> Is there a way to run "system" commands, or any other harmful command in
> perl without using spaces?
>
> I have a script that is sent to a unix server and the username and password
> fields are enter by the user.
>
> eg, web page asks username:________ password:________
>
> then the script is passed the values.
>
> if the user enters the password: blah";system "rm / -rf";
use taint checking and thoroughly cleanse your data. see the
perlsec man page for the details.
--
brian d foy <brianNOSPAM@NOSPAM.smithrenaud.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
remove NOSPAM or don't. it doesn't matter either way.
------------------------------
Date: 10 Dec 1998 17:46:15 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: take out periods
Message-Id: <74p1d7$5mv$1@marina.cinenet.net>
adcoment@my-dejanews.com wrote:
: > How do I take the "."'s out of the variable
: > $release = "2.9.0"
: > and assign 290 to $rls_name?
:
: First, not to be critical, check the manuals at CPAN perl.com, as this is
: quite routine.
But apparently non-routine enough to get wrong. :)
: $release = "2.9.0";
: $release =~ s/.//g;
: $rls_name = $release;
:
: Mind you, this now and ascii value of "290"
No, it's actually "" (an empty string) at this point using your technique.
--
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "The hills were burning, and the wind was raging; and the
clock struck midnight in the Garden of Allah."
------------------------------
Date: Thu, 10 Dec 1998 12:50:56 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: take out periods
Message-Id: <MPG.10d9d40724f663b0989754@news.scescape.net>
In article <74ovjb$kuc$1@nnrp1.dejanews.com>, jimbob4334@my-dejanews.com
says...
=> I did check the documentation - but had problems knowing
=> where to look.
It's a really good idea to just browse the entire documentation when you
don't need it, so you'll have some idea of where you need to look when
you _do_ need it.
=> I will check the FAQ for guidance.
Read that now, and once a month for the rest of next year. By the end of
1999, you'll know it like the back of your hand. :) And, as you finish
your last reading, you'll be able to face the new year confident that
_your_ Perl code doesn't have a Y2K problem. ;-)
=> I finally got it to work using
=>
=> s/\W/$1/g;
Gosh. You know, this only works because $1 just happens to be undef in
this case. It's really quite silly (but a good try :)).
If you want to go that route, you can:
s/\W//g;
Or, like other posts have pointed out:
s/\.//g;
tr/.//d;
=> I have a problem understanding back refs and was thinking that using
=> tr was the answer.
When you want to replace one character with another, tr is indeed the
best answer. Multiple benchmarks have been posted proving this, so I
won't. Just C<use Benchmark;> and see for yourself. :)
=> So, which doc should of I have started with?
perlre for s///
perlop for tr///
Also, a quick grep in the pod directory for 'delete' turned up some
promising matches:
perlop.pod:the number of characters replaced or deleted. If no string is
perlop.pod:by SEARCHLIST not found in REPLACEMENTLIST are deleted. (Note
perlop.pod:programs, which delete anything they find in the SEARCHLIST,
period.)
perlop.pod: [\000-\177]; # delete 8th bit
=> tia,
Hope This Help(s|ed)!
=> Jim
--Matthew
------------------------------
Date: Thu, 10 Dec 1998 09:06:43 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Trouble getting started with DBM
Message-Id: <32oo47.uk1.ln@magna.metronet.com>
Bart Lateur (bart.lateur@skynet.be) wrote:
: Jeffrey R. Drumm wrote:
: >> use SDBM_File;
: > use Fcntl; # exports constants such as O_RDRW and O_CREAT
: >> tie %hash, 'SDBM_File', 'test.db', O_RDWR|O_CREAT, 0644;
: Great! This is apparently missing in the documentation for SDBM_File.
: Here is it:
: =head1 SYNOPSIS
: use SDBM_File;
: tie(%h, 'SDBM_File', 'Op.dbmx', O_RDWR|O_CREAT, 0640);
: untie %h;
: Not one mention about Fcntl.
But there is this in perl5004delta.pod about a different,
yet similar module:
---------------
Made DB_File automatically import the open() constants (O_RDWR,
O_CREAT etc.) from Fcntl, if available.
---------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 10 Dec 1998 15:40:37 GMT
From: pegboy@nac.net
Subject: User to user email
Message-Id: <366fea78.12513017@news.nac.net>
Can someone point me in the right direction?
I'm at a loss here :)
Here's what I would like to do.
Allow a user on a web based bbs to send mail to another user on the
bbs. Everything would stay local, no sendmail, no pop3 or imap.
I guess this would be a file-to-file write?
All users on the bbs would have their own email, which would ONLY be
able to send to others on the bbs...
Any pointers would be greatly appreciated!
Thanks very much,
Chris
------------------------------
Date: 10 Dec 1998 16:29:05 GMT
From: randy@theory.uwinnipeg.ca (Randy Kobes)
Subject: Re: xsubpp errors, can't dmake compiler-a3, etc.
Message-Id: <slrn76vu7s.ekt.randy@theory.uwinnipeg.ca>
On Thu, 10 Dec 1998 14:33:03 GMT, John Johnson <5412@bellsouth.net> wrote:
>Hi,
> I'm fairly new to Perl, but I've written a couple of fine apps that
>need to be compiled. To this end I downloaded Compiler-a3, and have been
>trying to make it work for days. One common error no matter what I do is:
>C:\perl\Compiler-a3>perl makefile.pl
>Usage: xsubpp [-v] [-C++] [-except] [-prototypes] [-noversioncheck]
>[-nolinenumb
>ers] [-s pattern] [-typemap typemap]... file.xs
>Writing Makefile for B
>
>That error occurs when I try to build other packages too.
Hi,
That error results probably from a make command like
command_1 > file && command_2
and the shell not understanding the > && combination. What you
could do is give the commands on either side of the &&:
command_1 > file
command_2
then proceed with the make.
If you want to change this behaviour permanently, so you won't have
to do this everytime, edit ExtUtils\MM_Unix.pm, look for the
subs xs_c and xs_o, and put the two commands on either side of
the && on separate lines, as above.
>Here's what it boils down to:
>xsubpp complains about it's syntax.
>If I run xsubpp by hand, then move b.tc to b.c, the compiler complains
>about cw32mti.lib being missing, the other libs listed that are missing
>are: odbc32.lib and odbccp32.lib. import32.lib is
>the one that comes with BCB.
I don't know about this ... Are these libs that are supposed
to have been made in the build process, but failed to be
built because of the previous problem?
--
Best regards,
Randy Kobes
Physics Department Phone: (204) 786-9399
University of Winnipeg Fax: (204) 774-4134
Winnipeg, Manitoba R3B 2E9 e-mail: randy@theory.uwinnipeg.ca
Canada http://theory.uwinnipeg.ca/
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4398
**************************************