[8047] in Perl-Users-Digest
Perl-Users Digest, Issue: 1672 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 19 12:07:24 1998
Date: Mon, 19 Jan 98 09:00:30 -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 Mon, 19 Jan 1998 Volume: 8 Number: 1672
Today's topics:
Re: Basic Date Functions for Win32 Perl? <barnett@houston.Geco-Prakla.slb.com>
beginner question <eyalb@bvr.co.il>
Re: beginner question (Marek Rouchal)
Re: CGI security with internal users (brian d foy)
Re: CGI security with internal users (brian d foy)
Re: Create file <rootbeer@teleport.com>
Daemon for connection with Oracle <mn@mint.se>
DBI, fetchrow and arrays <morten@mediafarm.no>
Deleting specific lines from text files. <James@cydaps.nospam.co.uk>
Re: Detecting the presence of a sub declaration (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: Detecting the presence of a sub declaration <joseph@5sigma.com>
Re: Detecting the presence of a sub declaration <rra@stanford.edu>
Re: Determining file type <joseph@5sigma.com>
Example of select listening to socket and STDIN needed (Paul Ryder)
Re: Free Cgi-Bin <lovegod@earthling.net>
Re: Help poor performance with Oraperl for perl5 (DBI O <Tim.Bunce@ig.co.uk>
Re: Help with MakeMaker, DBI, DBD::DB2, DBD::ODBC <barnett@houston.Geco-Prakla.slb.com>
how do I emulate csh's "set verbose" in Perl <john.crawshaw@london.pgs.com>
Re: I am still a virgin <dhoover@textwise.com>
Re: I need a man to lick me in to a frenzy!!! <andrew.spiers@virgin.net>
Re: installing perl5.004_04 under Linux (Bernard M. Piller)
is libperl.a threadsafe? <dhoover@textwise.com>
localtime: <jahnel@xarch.tu-graz.ac.at>
Re: Looking for better Text::GenderFromName (Clay Irving)
Re: MacPerl carriage returns (John Moreno)
newbie question about ipc <sanct@dlc.fi>
Re: Oraperl / DBD / Perl5 Performance for Oracle query? <Tim.Bunce@ig.co.uk>
PERL forking <an@oso.chalmers.se>
Perl5 NT FTP Library <david.mohorn@sourcebbs.com>
Re: Puzzling behavior of c.l.p.* readers (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: Question about @INC and require <barnett@houston.Geco-Prakla.slb.com>
Re: Random Access File Methods? (Tad McClellan)
Re: Random Access File Methods? <doug@tc.net>
Re: Reading a .dat filefor a password (Clay Irving)
Re: Reading a .dat filefor a password (Andrew M. Langmead)
Re: returning values out of a recursed sub <joseph@5sigma.com>
Re: The SITE commands, will it ever be implemented in W <joseph@5sigma.com>
Using Menus in Perl-5 <david.mohorn@sourcebbs.com>
XS and array creation problem <mallwitz@intershop.de>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 19 Jan 1998 09:57:04 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Basic Date Functions for Win32 Perl?
Message-Id: <34C377D0.C7AA2D2D@houston.Geco-Prakla.slb.com>
Kendall Whitehouse wrote:
>
> I have an application that uses the Win32 implementation of Perl, and I
> need to do some basic date manipulations. For example, I need to
> convert a local time string into GM time and I need to be able to
> calculate the correct day, date, and time N hours from now.
>
Using time returns the number of seconds since the epoch (1/1/70 @
00:00:00) on Unix. Should return number of seconds since the Epoch on a
Win32 machine also (but may not be since 1/1/70 @ 00:00:00). i.e.
Right now $now = time; would set $now to 885224701
To add a day, take:
$now += (24 * 60 * 60);
24 hours per day * 60 minutes per hour * 60 seconds per minute = 1 day.
To subtract a day, take:
$now -= (24 * 60 * 60);
To get two days, change (24 * 60 * 60) to (24 * 60 * 60 * 2);
> I started doing this on my own, but quickly realized I was sinking into
> a pit of quicksand -- You have to keep track of when the hour "rolls
> over" after 23:59, calculate the next day and date, worry about whether
> the date rolls over after day 30, or 31, or 28, or 29 depending on both
> the month and the year. What a nightmare!
Not with the above. The localtime routine handles this for you.
>
> I looked at the Date::Minip module which appears to do everything I need
> (and much more), but I'm beginning to get the sinking feeling that this
> doesn't easily transport to the Win32 environment.
>
It should be able to be loaded onto a win32 machine, but I don't have
such an animal available to work with. :-)
> Does anyone know of any date functions that already exist that I can
> plug into any Perl implementation to give me the capabilities I need?
>
> Thanks for your help.
>
> :Kendall
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> Kendall Whitehouse
> Associate Director, Wharton Computing and Information Technology
> The Wharton School of the University of Pennsylvania
>
> (215) 898-2742
> whitehouse@wharton.upenn.edu
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
HTH
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: Mon, 19 Jan 1998 16:16:25 +0200
From: Eyal <eyalb@bvr.co.il>
Subject: beginner question
Message-Id: <34C36039.167E@bvr.co.il>
Hi,
I need to write a subroutine in perl
which gets as a parameter a method name of a C++ file
(e.g CoordControl::updateView) and simply deletes it from the C file
including the braces and whats in it.
Thanks
--
\\\|///
\\ ~ ~ //
( @ @ )
================oOOo=(_)=oOOo================
Eyal Bar Ilan BVR Technologies
eyalb@bvr.co.il
=========================Oooo================
oooO ( )
( ) ) /
\ ( (_/
\_)
------------------------------
Date: 19 Jan 1998 16:12:04 +0100
From: Marek.Rouchal@-nospam-hl.siemens.de (Marek Rouchal)
Subject: Re: beginner question
Message-Id: <69vqg4$4f9@buffalo.HL.Siemens.DE>
In article <34C36039.167E@bvr.co.il>, Eyal <eyalb@bvr.co.il> writes:
> I need to write a subroutine in perl
> which gets as a parameter a method name of a C++ file
> (e.g CoordControl::updateView) and simply deletes it from the C file
> including the braces and whats in it.
Why don't you just simply read the file in, search for the text, replace
the sub with '', and write the file? "perldoc perlfunc" and "perldoc perlop"
and "perldoc perlre" will provide everything you need. Note that the latest
development version has even a new mechanism for balanced pair matching
(needed for the { } around the sub) in it. It's 5.004_56 (look in t/op/pat.t
for the occurance of "matchit") Where you can get it? CPAN!
What's CPAN? Have a look at http://www.perl.com. There are infos about fine
books there, too.
Hope this helps!
M.R.
PS. If you want to reply by Email, please remove -nospam- from
the address. Thank you.
--
Marek Rouchal Phone : +49 89/636-25849
SIEMENS AG, HL CAD SYS Fax : +49 89/636-23650
Balanstr. 73 mailto:Marek.Rouchal@-nospam-hl.siemens.de
81541 Muenchen PCmail:Marek.Rouchal.PC@-nospam-hl.siemens.de
------------------------------
Date: Mon, 19 Jan 1998 09:02:04 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: CGI security with internal users
Message-Id: <comdog-ya02408000R1901980902040001@news.panix.com>
Keywords: from just another new york perl hacker
In article <01bd24d5$be8eb760$3c42100a@nl-amv-dsk5002>, "Mike" <mike@NOSPAM.interways.com> posted:
>I wish I could give actual source examples, but I'm not an expert.
>Try to search in engines on: +perl +security
why do all that work when one could see the CGI Meta FAQ's section
on security, not to mention the perlsec man page...
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Mon, 19 Jan 1998 09:04:37 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: CGI security with internal users
Message-Id: <comdog-ya02408000R1901980904370001@news.panix.com>
Keywords: from just another new york perl hacker
In article <asgv96.ffj.ln@localhost>, tadmc@flash.net (Tad McClellan) posted:
>Steve Michaels (dyang@mork.uni.uiuc.edu) wrote:
>: What are the risks I am taking as a sys admin to allow people to have perl
>: cgi scripts in their own cgi-bins?
>
>
>The same risks as allowing C or C++ or Visual Basic or shell cgi (sic)
>scripts in their own cgi-bins.
well, Perl has gotchas that C doesn't have and the other way
around as well, but the security FAQs and docs should cover most
of them :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Mon, 19 Jan 1998 08:25:53 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Create file
Message-Id: <Pine.GSO.3.96.980119082436.9757L-100000@user2.teleport.com>
On Sun, 18 Jan 1998, Chipmunk wrote:
> Tom Phoenix wrote:
> >
> > Even when your script is "just an example" (and perhaps especially in that
> > case!) you should _always_ check the return value after opening a file.
> > Thanks!
>
> From 'Saving State with CGI.pm', by Lincoln Stein
> The Perl Journal, Vol 1, Iss 2
> Page 20:
>
> [I reformatted the comments so the code would fit in an 80 column line)
>
> sub fetch_old_state {
> # Open the existing file if any, and read the current state.
> my $session_key = shift;
> # We use the CGI object here, because it's straightfoward to do so.
> open(SAVEDSTATE, "$STATE_DIR/$session_key");
> my $state = new CGI(SAVEDSTATE);
> # We don't check for success of the open, because if there is
> # no file yet, the new CGI(FILEHANDLE) call will return an empty
> # parameter list, which is exactly what we want.
> close SAVEDSTATE;
> return $state
> }
You should write a letter to the editor and complain. :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Mon, 19 Jan 1998 15:10:25 +0100
From: Mattias Niklasson <mn@mint.se>
Subject: Daemon for connection with Oracle
Message-Id: <34C35ED0.F48703F1@mint.se>
Hello,
We are using Perl, as CGI, to create a GUI to modify data in a Oracle
database using the Oraperl module. The problem is that each execution of
a script using DB access makes a new connection to the DB, which takes
about 5 seconds. Therefor the GUI feels slow.
Now to my question; we are planing to develope a daemon which handles
the DB connections, and keeping them alive to reduce the responstime.
How do you recommend that we solve the communication between out CGI
scripts and the daemon? Is RPC the right way to go?
Is there a simular product/module on the market already?
Thanks for you time!
Regards,
Mattias Niklasson
------------------------------
Date: Mon, 19 Jan 1998 16:11:33 +0100
From: "Morten Tvedten" <morten@mediafarm.no>
Subject: DBI, fetchrow and arrays
Message-Id: <69vqiv$f86$1@thelma.netpower.no>
I have a script that ues DBI and ODBC to retrieve data form an Access
database. One of the fields in the database is a long comment field. When
the data is read the text in the comment field is cut after 80 characthers.
This is My code:
$dbh = DBI->connect('dbi:ODBC:TKKOMMENTAR', '', '', { RaiseError => 1 });
$cursor = $dbh->prepare("SELECT * FROM FEEDBACK ORDER BY ID");
$cursor->execute;
while (@row = $cursor->fetchrow_array) {
print "<TR><TD nowrap valign=\"top\"
bgcolor=\"#C0C0C0\"><b>$row[0]-$row[1]</b></TD><TD>$row[2]</TD></tr><tr><TD>
$row[3]</TD><TD>$row[4]</TD></TR><TR><TD></td></tr>\n";
}
I also use DBI and OBDC to write tha same comments to the database, and that
works OK.
Any ideas????? please!
Morten
morten@mediafarm.no
------------------------------
Date: Mon, 19 Jan 1998 16:16:07 +0000
From: James <James@cydaps.nospam.co.uk>
Subject: Deleting specific lines from text files.
Message-Id: <pzCs3AAHx3w0Ew+v@cydaps.co.uk>
Hello,
Forgive me if I am being thick but just a quick question regarding
deleting information from files using Perl on a UNIX server.
I am setting up a registration page where a user enters various
information (ie email address, name, password, username, likes,
dislikes) and this is sent to a perl script I have created that stores
this information in a pipe delimited text file which is then read by the
server when the user logs in. Each user that registers is placed in this
one file but the problem I have is that sometimes a user wants to
unregister and this means that I have to manually remove his/her listing
from the file which can be difficult with 10,000 users in there or so!
I am wondering if anyone knows how I can allow the user to delete
his/her information from this file without deleting anything else. They
would enter their usename and password and click a button that would
delete them from the server.
An example of the file would be:
me@here.com|David Raymond|sK134/deshe83Z|draymond|Windows|MacOS
134.55@dislike.co.uk|Jeremy Jones|eig34653se|jjones|Eggs|Jaguar cars
dj@djsilver.au|Derek James|nsl234lkj9|djames|Basingstoke|Dockenfield
Say user Jeremy Jones (second line) wanted out of the system, how could
I allow him to delete just that one line and leave the rest in tack
simply by clicking a button on the website? I was wondering if it was
possible for him to enter his username and password and they would act
as a matching tool to delete just his line?
Thank you for any help with this
Best wishes
James
Please remove nospam. if emailing
------------------------------
Date: Mon, 19 Jan 98 10:35:18 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Detecting the presence of a sub declaration
Message-Id: <34c3731d$2$ofn$mr2ice@speaker>
In <m3wwfwiscw.fsf@windlord.Stanford.EDU>, on 01/19/98 at 04:02 AM,
Russ Allbery <rra@stanford.edu> said:
+-----
| sub sub_exists {
| my $sub = shift;
| defined *{$sub}{CODE};
| }
+--->8
I'd probably have written (not having fully assimilated the Perl5 mindset yet
--- the combination of *{} and references didn't occur to me):
sub sub_exists {
local(*the_sub) = $_[0];
defined *the_sub{CODE};
}
...but the approach should be correct and the implementation appears valid,
barring incompatible changes to Perl's innards.
It should probably be cleaner, though, if only by encapsulation in a standard
module that changes along with Perl when necessary.
--
use 5.004;sub AUTOLOAD{print$_{$_.++$x{$_}}}sub new{my%x;%_=map{++$a%2?$_.++$x{
$_}:$_}split(//,pack('N*',unpack('w*',unpack('u*','M@H*HP\'2"@\C`88+SE/!EA(F!'.
"A'6\$LZV0+(3;C9QRA9NAPG2&D\\G(88:KL=A0\n4AN.5W\"\"&\\[W>;H>3S>0\@A\\N\@PB\$`")
)));bless{}}$b=(new main);map{$b->_}split(//,' Brandon S. Allbery KF8NH') # :-)
------------------------------
Date: Mon, 19 Jan 1998 07:26:18 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Detecting the presence of a sub declaration
Message-Id: <34C36228.6D3229C@5sigma.com>
defined *{$sub}{CODE} does not appear to work in cases like:
sub foo;
There is no obvious way to identify an undefined subroutine, and I
think there is *no* way to identify it in perl alone without trying to
call it in an eval or wherever.
I am pretty sure the only way to solve this is with an XSUB that
includes something like the logic in pp_hot.c/pp_entersub, e.g.
if (!CvROOT(cv) && !CvXSUB(cv)) {
So, resolve the subroutine name (a project in itself), then see
if there are opcodes for it or an XSUB. I suppose in this case you
would not want to see if it could be autoloaded. I think you could
pretty much lift the sub call code from pp_hot.c to write this.
You can see it if you Dump *foo{CODE} using Devel::Peek.
-joseph
http://www.effectiveperl.com
Russ Allbery wrote:
>
> I'd like to be able to take different actions depending on whether a sub
> has been predeclared. In other words, consider the following code:
------------------------------
Date: 19 Jan 1998 08:37:06 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Detecting the presence of a sub declaration
Message-Id: <m3wwfwfmj1.fsf@windlord.Stanford.EDU>
Joseph N Hall <joseph@5sigma.com> writes:
> defined *{$sub}{CODE} does not appear to work in cases like:
> sub foo;
> There is no obvious way to identify an undefined subroutine, and I think
> there is *no* way to identify it in perl alone without trying to call it
> in an eval or wherever.
Seems to work for me.
windlord:~> perl -e 'sub foo; $sub = "foo";' \
? -e 'print ((defined *{$sub}{CODE}) ? "yes\n" : "no\n");'
yes
windlord:~> perl -e 'sub bar; $sub = "foo";' \
? -e 'print ((defined *{$sub}{CODE}) ? "yes\n" : "no\n");'
no
windlord:~> perl -v
This is perl, version 5.004_04 built for sun4-solaris
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Mon, 19 Jan 1998 03:58:46 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Determining file type
Message-Id: <34C3318B.DEAFB7EE@5sigma.com>
I am told that Apache can now identify files by contents rather
than extension. If that's true, see http://www.apache.org.
I haven't checked ....
For graphics files, I think pbm utilities contains some file(1)
extensions.
-joseph
http://www.effectiveperl.com
Joseph N. Hall wrote:
>
> I am sure that I have seen some discussion of a module along the
> lines of the file(1) command, but now I can't find it. Well, ok,
> maybe I was dreaming.
------------------------------
Date: Mon, 19 Jan 1998 15:16:49 GMT
From: paul@f1world.com (Paul Ryder)
Subject: Example of select listening to socket and STDIN needed
Message-Id: <34c36dfe.540217852@news.u-net.com>
Hi,
Could someone post an example (of just this if possible) using select
to listen to a tcp/ip socket connection and the keyboard STDIN at the
same time and acting upon both .. so i can make a connection and send
data to the server via STDIN through the keyboard
Thanks in advance
replys to : paul@f1world.com
Thanks
_________________________________________________
Paul Ryder http://www.f1world.com
paul@pry.u-net.com ICQ : 262573
paul@f1world.com
paul@quake2.com
------------------------------
Date: Mon, 19 Jan 1998 10:01:27 -0600
From: Rich Grise <lovegod@earthling.net>
Subject: Re: Free Cgi-Bin
Message-Id: <34C378D7.34D1@earthling.net>
Tom Phoenix wrote:
>
> On Mon, 19 Jan 1998, Ho Seng Yip wrote:
>
> > Anyone knows if any company or website offers free cgi-bin access which
> > anyone can apply ? Will like to run some perl scripts but my current
> > provider hosting my webpage does not allow telnet access to their
> > cgi-bin.
>
> Of course, there's nothing Perl-specific about this; the cgi-bin directory
> doesn't care what language the programs are written in. But would you
> really trust your data to a sysadmin who allows just _anybody_ to install
> scripts? That's like sending your children to the daycare center in the
> state penitentiary's license plate factory. :-)
>
> --
> Tom Phoenix http://www.teleport.com/~rootbeer/
> rootbeer@teleport.com PGP Skribu al mi per Esperanto!
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
> Ask me about Perl trainings!
If you trust a free server, there's http://free.prohosting.com
and http://www.neocerf.com -
And there are pay servers all the way from $7.00/month on up.
Rich Grise
------------------------------
Date: Mon, 19 Jan 1998 15:37:28 GMT
From: Tim Bunce <Tim.Bunce@ig.co.uk>
Subject: Re: Help poor performance with Oraperl for perl5 (DBI Oraperl)
Message-Id: <En1FEH.C0E@ig.co.uk>
Keywords: oraperl, dbi, oracle
In article <69j1gn$oop$1@rdsunx.crd.ge.com>,
Mark Kornfein <kornfein@.crd.ge.com> wrote:
>
> We have an application that we are developing using the Oraperl interface
> to DBI. (DBD-Oracle-0.47).
>
> After doing some timing tests we have found the queries have very poor
> perfromance. A query that takes 4-5 seconds to complete in sqlplus takes
> 50 seconds from perl. We have similiar ratios for other queries. The time is
> being spent in the fetch loop (not login or open).
>
> Also the query we are using is very simple "select x from table where y =2;"
> it does not contain a join and returns about 600 records 1 field each.
I don't recall anyone reporting such performance problems for fetches
before. Thousands of users on many platforms have no such problems.
> We have been told by folks who use Oraperl for perl 4, that we need to
> increase the cache size, but this is evidently not an option in DBI.
DBD::Oracle 0.47 has a (very effective) row cache. Use $h->trace(2) to
see it in operation.
Tim.
------------------------------
Date: Mon, 19 Jan 1998 09:11:06 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
To: eatonn@email.msn.com
Subject: Re: Help with MakeMaker, DBI, DBD::DB2, DBD::ODBC
Message-Id: <34C36D0A.90936A33@houston.Geco-Prakla.slb.com>
Well, I haven't a clue about what the initial problem from your posting
was, but you will be more likely to get help if you post an original
question, as an original question, rather than a followup to someone
elses (unrelated) question.
HTH.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: Mon, 19 Jan 1998 15:28:38 +1100
From: John Crawshaw <john.crawshaw@london.pgs.com>
Subject: how do I emulate csh's "set verbose" in Perl
Message-Id: <34C2D676.5A0ABD8B@london.pgs.com>
Dea All,
How do I emulate csh'c set verbose syntax in Perl ? I cant seem to find
a flag that will
do it for me. set verbose in csh I find really usefull for debugging.
Also is there a way
I can find out what % of time my program spends in each subroutine to
find possible
slow-bits in my code, I know this can be done in a C debugger but havent
come across
it in Perl.
Cheers.
Mike Renshaw
michaelr@lndn.tensor.pgs.com
------------------------------
Date: Mon, 19 Jan 1998 09:16:36 -0500
From: Dean Hoover <dhoover@textwise.com>
Subject: Re: I am still a virgin
Message-Id: <34C36044.3560@textwise.com>
Kati wrote:
>
> Hello,
>
> Could someone help me get started.
>
> I made a simple test and placed
> it in my cgi bin:
>
> #!/usr/bin/perl
>
> print "Content-Type: text/html\n\n";
> print "This is my first test\n";
>
> exit;
>
> Naturally - this should return the
> words "This is my first Test".
>
> I do the chmod a+x test.pl, then
> type test.pl and the shell returns
> correctly "This is my first test".
>
> But when I access the same file
> via Netscape browser, the phrase
> is not printed, the above file
> is shown in full as ASCII characters.
>
> How can I could make this work,
> please kindly help me out.
>
> Kati
on my system you have to use the extension
.cgi instead of .pl in order to have the
netscape server run it.
Dean Hoover
------------------------------
Date: Mon, 19 Jan 1998 16:47:33 +0000
From: Andrew Spiers <andrew.spiers@virgin.net>
Subject: Re: I need a man to lick me in to a frenzy!!!
Message-Id: <34C383A4.DA86A95B@virgin.net>
Which module does this ? cgi - or is it lwp
gonna@lick.com wrote:
> Any takers???
>
> See my pic at http://pirate.ddns.org
>
> =><><=<<><<>==>=><<=
------------------------------
Date: Mon, 19 Jan 1998 15:10:42 +0100
From: bernard@look.in.signature (Bernard M. Piller)
Subject: Re: installing perl5.004_04 under Linux
Message-Id: <199801191510421139708@cybertron132.cybertron.at>
Shimpei Yamashita
<shimpei+nospam+nospam+caltech.edu@socrates.caltech.edu> wrote:
> If your setup is screwy enough that the Configure script couldn't
> figure it out, I doubt config.sh generated by the same Configure
> script out of a more "normal" system would do you much good....
I have a pritty stock Slackware 96 installation with gcc upgrade to
2.7.2.3 and newer libraries. Everything else compiles fine.
Bernard
--
* bmp System Support http://www.bmpsystems.com Vienna, Austria *
* reply to: bernard at bmpsystems dot com *
* spam these: root@localhost postmaster@fbi.gov jquello@fcc.gov *
------------------------------
Date: Mon, 19 Jan 1998 10:56:59 -0500
From: Dean Hoover <dhoover@textwise.com>
Subject: is libperl.a threadsafe?
Message-Id: <34C377CB.63F0@textwise.com>
I am using perl embedded in a C program and am *very*
happy with it. I need to re-architect the program so
that it uses pthreads though, and am wondering if
the perl library is thread-safe. I am using
perl5 (5.0 patchlevel 4 subversion 4) on solaris 2.6.
Thanks.
Dean Hoover
------------------------------
Date: Mon, 19 Jan 1998 17:34:44 +0100
From: Jahnel Klaus <jahnel@xarch.tu-graz.ac.at>
Subject: localtime:
Message-Id: <34C380A4.6DCA6BA0@xarch.tu-graz.ac.at>
i get the time with localtime:
i ve now a problem:
how can i handle it to delete files which are older than 2 days of
actual date?
Klaus
------------------------------
Date: 19 Jan 1998 10:16:09 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Looking for better Text::GenderFromName
Message-Id: <69vqnp$bck@panix.com>
In <dspw.94$Mf2.1493555@news2.voicenet.com> nospam@domain.com writes:
>Clay Irving (clay@panix.com) wrote:
>: Text::GenderFromName returns undefined for Mark, Bob, Bill, Ralph, etc.
>: Has anyone built better regexps to catch more male names?
>I'm a newbie here, so please forgive me for speaking up...
>Isn't it basically futile to use regexes here? This module
>can't possibly guarantee any accuracy, just a reasonable guess,
>based on names it already knows about. This sounds like a lookup table.
>Why not just use an exhaustive list of names? The number of
>all names everywhere is finite.
Text::GenderFromName does a surprisingly good job -- I was looking for ways
to make it do a better job.
>I once had a friend from China whose name was Chi.
>Quick: Boy or girl?
Undefined. :)
>I mean, couldn't you also write a module which applied a regex
>to the text name of a city and attempted to report on its climate?
>Sure, you could -- but why bother?
Direct marketing companies like to have an idea of the gender of a person...
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Mon, 19 Jan 1998 11:01:57 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: MacPerl carriage returns
Message-Id: <1d33now.15q8l9ur3f0upN@roxboro0-016.dyn.interpath.net>
brian d foy <comdog@computerdog.com> wrote:
> In article <aaron-1801982151190001@digi2-059.wwa.com>, "Aaron Young"
> <aaron@soltec.net> posted:
>
> >I am trying to write a client that talks to a pop server on a macintosh.
> >When I send the USER command like this
> >
> >USER username\n
> >
> >The server seems to be timing out on me
> >
> >Is there another way I should be sending the carriage return since it is
> >sitting on a macintosh?
>
> check the data to sure what you are sending (i.e. what \n gets
> translated to) and make sure that is what the Mac is expecting
> (which is a little goofy on the \r, \n issue).
>
> intercepting the POP data then looking at the hex dump of that
> will tell you what your script received. once you know what
> data are coming in (i.e. what terminates a line of input), you
> can adjust your server code to recognize that line ending.
There is the excellent program StreamWatcher from Stairways.com.au that
allows Mac users to watch the tcp connection - it would be perfect for
this.
--
John Moreno
------------------------------
Date: Mon, 19 Jan 1998 10:36:26 -0600
From: Aleksi Asikainen <sanct@dlc.fi>
Subject: newbie question about ipc
Message-Id: <885226720.531693573@dejanews.com>
(Sorry if this is a double, my newsserver works "fine")
Hello
I'm trying to do only a simple server and 2(-x) clients networking so
that depending on running parameters the one client can send to the
server or to the other client simple message, that appears to be "Hello
world" ;)
In the documentation of perl there is a simple example, that sends from
the server to the client a message, but because I've not worked with any
languages on networking, I don't have a clue what to do. Another problem
is that I don't understand how to communicate with to clients via server
(i.e how to access "my"-code).
So I would be more than pleased, if someone just colud help, and tell me
where to find documentation/explanation/FAQ about this, or some source
code.
-aleksi asikainen
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Mon, 19 Jan 1998 15:31:44 GMT
From: Tim Bunce <Tim.Bunce@ig.co.uk>
Subject: Re: Oraperl / DBD / Perl5 Performance for Oracle query?
Message-Id: <En1F4w.By1@ig.co.uk>
In article <68r3rr$6hv$1@rdsunx.crd.ge.com>,
Mark Kornfein <kornfein@.crd.ge.com> wrote:
>
> I've recently come on board a web project that uses the Oraperl emulation
> interface for DBD. The performance is horrible, a query that returns in 4-5
> seconds from sqlplus takes 50 seconds, This is just to do the "fetch"
> without calling any cgi scripts.
>
> The documentation hints at a "cache value" that one can set but then
> goes on to say that it not implemented yet. I should point out that the
> query is trival and just brings back a lot (about 1000) small rows (1 field)
> from Oracle.
There's no way that anything to do with the DBI or DBD::Oracle itself
would cause such a slow down.
I'd hazzard a guess that this is the cause (from the README.help file):
----------------------------------------------------------------------
Oracle 7.1 and 7.2: Connection takes a long time and may coredump
Oracle bug number: 227321 related to changing the environment before
connecting to oracle.
To work around this bug, do not set any environment variables in your
oraperl script before you call ora_login, and when you do call
ora_login, the first argument must be the empty string. This means
that you have to be sure that your environment variables ORACLE_SID
and ORACLE_HOME are set properly before you execute any oraperl
script. It is probably also possible to pass the SID to ora_login as
part of the username (for example, ora_login("", "SCOTT/TIGER@PROD",
"")), although I have not tested this.
This workaround is based on information from Kevin Stock.
----------------------------------------------------------------------
Tim.
------------------------------
Date: Mon, 19 Jan 1998 17:44:25 +0100
From: Anders Nilsson <an@oso.chalmers.se>
Subject: PERL forking
Message-Id: <34C382E9.6CBA41C2@oso.chalmers.se>
Hello!
I am working with a perl program to administrate a large number of
calculations. When a subprocess terminates from a fork it becomes a
zombie. I haven't checked everything all through but judging from
the simple csh program I wrote, the problem seems to be that perl
refuses to release the control until the mother process dies. It is
a real problem since the the actual loop will not be formed as below
in the future. It will probably include a couple of thousand runnings
and I don't think that a thousand zombies is particularly healthy for
a linux machine. It's not a linux problem since it works the same on
a HP-UX machine.
The active part of my test program is included below. Let me also tell
that I have tried with: system("cmd"); and: `cmd`; for the row exec cmd;
with the same result. The command cmd is a simple csh program for
testing
purposes including a find and an echo terminated by exit(0).
The subroutine get_load extracts the load using csh uptime.
My question is: is this a bug in perl or is there another way to do it?
I would prefer not to kill the main program and restart it.
for ( $z=0; $z< 100 ; $z++ ) {
print "Lap $z\n";
( $load_01_min, $load_05_min, $load_15_min) = get_load();
if ( $load_01_min < 0.6 ) {
if ( $pid = fork ) {
print "Main Process\n";
} else {
print "Starting child process $pid\n";
exec cmd;
exit 0;
}
} else {
print "Not starting any process\n";
}
sleep 5;
}
Thankful for help,
Anders Nilsson, an@oso.chalmers.se
------------------------------
Date: Mon, 19 Jan 1998 11:20:42 -0500
From: "David Mohorn" <david.mohorn@sourcebbs.com>
Subject: Perl5 NT FTP Library
Message-Id: <01bd22bf$f3ac5fa0$315c5499@user.ncr.com>
Does anyone know if there is any Perl-5 for NT libraries for using FTP?
...david
david.mohorn@norfolkva.ncr.com
------------------------------
Date: Mon, 19 Jan 98 09:03:09 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Puzzling behavior of c.l.p.* readers
Message-Id: <34c35db9$1$ofn$mr2ice@speaker>
In <69udhp$d8g$1@comdyn.comdyn.com.au>, on 01/19/98 at 02:24 AM,
mgjv@comdyn.com.au (Martien Verbruggen) said:
+-----
| >: > if ( $firstchar == "Y" ) || ( $firstchar == "y" ) { ...
| >: Just because someone doesn't use a feature of Perl doesn't mean that
| >: they're doing it wrong.
| > Except that the code Andy cited almost certainly *doesn't* do what it's
| > supposed to. It tests if the *second* character in the string is an
| Actually, not even that :) It compares the numeric value of $firstchar to
| the numeric value of "Y", which is not exactly what was intended either.
+--->8
...and nobody's yet mentioned the missing pair of parens that will prevent it
from compiling in the first place....
--
use 5.004;sub AUTOLOAD{print$_{$_.++$x{$_}}}sub new{my%x;%_=map{++$a%2?$_.++$x{
$_}:$_}split(//,pack('N*',unpack('w*',unpack('u*','M@H*HP\'2"@\C`88+SE/!EA(F!'.
"A'6\$LZV0+(3;C9QRA9NAPG2&D\\G(88:KL=A0\n4AN.5W\"\"&\\[W>;H>3S>0\@A\\N\@PB\$`")
)));bless{}}$b=(new main);map{$b->_}split(//,' Brandon S. Allbery KF8NH') # :-)
------------------------------
Date: Mon, 19 Jan 1998 09:23:29 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
To: Gary Nielson <gnielson@charlotte.infi.net>
Subject: Re: Question about @INC and require
Message-Id: <34C36FF1.C9C95C5A@houston.Geco-Prakla.slb.com>
Gary Nielson wrote:
>
> I am a rank amateur when it comes to perl and am trying to understand a
> couple of things about @INC and require.
No harm in that. :-)
>
> Is it a true statement that the @INC path is compiled into perl when
> you build it?
Yes.
> If so,
> how can I find out what that @INC path is on a remote virtual host?
#!/usr/local/bin/perl -w
for (@INC) {
print "$_\n";
}
__END__
Prints out the @INC array, one entry per line.
> Does
> this mean
> that when you write a require in a script, say:
>
> require 'cgi-lib.pl';
You might also want to investigate CGI.pm.... Useful module. Find it
on a CPAN site near you. Start at: http://www.perl.com
>
> that it will look for that *.pl in the @INC path?
Yes.
> What if you just want
> to include your
> cgi-lib.pl or whatever in the very same path as the script you are
> running?
use lib '/path/to/your/libraries'
File is in /path/to/your/libraries/cgi-lib.pl
> How can
> you add or modify an already coded-up @INC path in your script to
> accommodate
> a file that may be outside that path?
See above.
>
> Any help much appreciated. Please email me as well if possible.
>
HTH.
> Gary
> Charlotte, NC
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: Mon, 19 Jan 1998 08:47:55 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Random Access File Methods?
Message-Id: <r2pv96.s8k.ln@localhost>
Don (dgoyette@NoMoreSPAMpcisys.net) wrote:
: Thank you for your reply. Please excuse my PREL ignorance, but could you
: explain to me what a SMOP is? I would assume, having never seen this
: before, that it would be SMall OPeration? But I'd rather know what it's
: SUPPOSED to mean. Thanks.
Simple Matter Of Programming.
in other words: it is straightforward to just write the code for it,
nothing particularly tricky...
It is Computer Science jargon, not Perl specific.
... so, now what does 'PREL' mean?
Maybe you meant 'Perl' or 'perl' there?
(not 'PERL', I hope)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 19 Jan 1998 11:39:25 -0500
From: Douglas McNaught <doug@tc.net>
Subject: Re: Random Access File Methods?
Message-Id: <m2vhvgpgea.fsf@ono.tc.net>
"Don" <dgoyette@NoMoreSPAMpcisys.net> writes:
> Thank you for your reply. Please excuse my PREL ignorance, but could you
> explain to me what a SMOP is? I would assume, having never seen this
> before, that it would be SMall OPeration? But I'd rather know what it's
> SUPPOSED to mean. Thanks.
Sorry--"Simple Matter Of Programming". Sometimes turns out not to be
so simple ;)
Check out
http://www.klammeraffe.org/jargon/SMOP.html
-Doug
--
sub g{my$i=index$t,$_[0];($i%5,int$i/5)}sub h{substr$t,5*$_[1]+$_[0],1}sub n{(
$_[0]+4)%5}$t='encryptabdfghjklmoqsuvwxz';$c='fxmdwbcmagnyubnyquohyhny';while(
$c=~s/(.)(.)//){($w,$x)=g$1;($y,$z)=g$2;$w==$y&&($p.=h($w,n$x).h($y,n$z))or$x==
$z&&($p.=h(n$w,$x).h(n$y,$z))or($p.=h($y,$x).h($w,$z))}$p=~y/x/ /;print$p,"\n";
------------------------------
Date: 19 Jan 1998 09:58:13 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Reading a .dat filefor a password
Message-Id: <69vpm5$9og@panix.com>
In <69uin9$ppd@camel15.mindspring.com> "Eric Phillips" <e.phillips@mindspring.com> writes:
>I have had some problems in the past reading a file called "users.dat" file
>for a login and a password. Here's the syntax of the users.dat file:
>login|password
>Could someone tell me how to read (with Perl) that users.dat file line by
>line to confirm if the user is registered (login and password are correct)?
>My problem in the past was that it would only read the bottom line, thus
>only the user on the bottom could login.
open USERS, "users.dat" or die "Can't open users.dat: $!\n";
while (<USERS>) {
chomp;
($login,$password) = split /\|/;
# do whatever you want to each line...
}
close USERS;
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Mon, 19 Jan 1998 15:10:33 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Reading a .dat filefor a password
Message-Id: <En1E5L.B2y@world.std.com>
"Eric Phillips" <e.phillips@mindspring.com> writes:
>Could someone tell me how to read (with Perl) that users.dat file line by
>line to confirm if the user is registered (login and password are correct)?
>My problem in the past was that it would only read the bottom line, thus
>only the user on the bottom could login.
My guess is that you were iterating over the lines and did something
to flag when the current line had the correct username password
combination, but then overwrote the results in later lines.
You probably want something like this:
#!/usr/bin/perl -w
# lines deledted that sets $user and $passwd
$login_ok = 0; # start by assuming login is invalid
open PW, 'users.dat' or die "Can't open users.dat: $!\n";
while(<PW>) {
chomp;
($registered_user,$registered_passwd) = split /\|/; #sep user from pw on line
if($user eq $registered_user and $passwd eq $registered_passwd) { # if match
$login_ok = 1; # this line validates the login.
last; # don't read any more lines, exit out of the loop
}
}
die "Invalid user: $user\n" unless $login_ok;
--
Andrew Langmead
------------------------------
Date: Mon, 19 Jan 1998 03:52:46 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: returning values out of a recursed sub
Message-Id: <34C33023.A8F364C@5sigma.com>
Let's keep it simple.
$line =~ tr/\t / /s;
-joseph
http://www.effectiveperl.com
Rhodri James wrote:
> $line ~= s/\t/ /g; # Replace tabs with spaces, as you do currently.
> $line ~= tr/ //s; # Squash multiple spaces down to a single space.
------------------------------
Date: Mon, 19 Jan 1998 03:45:30 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: The SITE commands, will it ever be implemented in Win32
Message-Id: <34C32E6E.6EDC7504@5sigma.com>
Maybe read the docs a little closer?
quot (CMD [,ARGS])
Send a command, that Net::FTP does not directly support,
to the remote server and wait for a response.
Returns most significant digit of the response code.
WARNING This call should only be used on commands that
do not require data connections. Misuse of this method
can hang the connection.
-joseph
http://www.effectiveperl.com
Torfinn Keringen wrote:
>
> Hi
> I very much enjoy using the Net::FTP module, but I often need the SITE
> command like "site filetype=jes".
> Is there an other way of doing this from Win32 than using the Net::FTP, or
> will it be implemented in near future.
------------------------------
Date: Mon, 19 Jan 1998 11:08:32 -0500
From: "David Mohorn" <david.mohorn@sourcebbs.com>
Subject: Using Menus in Perl-5
Message-Id: <01bd22be$40309be0$315c5499@user.ncr.com>
I in the processing of reading Teach Yourself Perl-5 for Windows NT in 21
Days. I'm over half way done reading the book. Perl seems to be very
similar in syntax to C (which I'm already familiar with.) The only thing I
find lacking in Perl is a switch/case statement.
I want to have a menu with options 1, 2, 3, 4, 5, A, B, C, and have the
program execute a particular subroutine based on the input. What is the
best way of doing this without having 15 or more if statements?
...david
PS - please respond here or via email to david.mohorn@norfolkva.ncr.com
------------------------------
Date: Mon, 19 Jan 1998 16:31:31 +0100
From: Christian Mallwitz <mallwitz@intershop.de>
Subject: XS and array creation problem
Message-Id: <34C371D3.AAC1C6FB@intershop.de>
Hi folks,
I want to write a C/XS function which returns a array.
Here is what I try:
--------------------------------------------------------------
AV *
BuildArray()
CODE:
{
STRLEN len;
RETVAL = newAV();
av_push(RETVAL, newSVpv("hello", 0));
av_push(RETVAL, newSVpv("world", 0));
printf( "\n--------------------------------\n", av_len(RETVAL) + 1);
printf( "length @code %d\n", av_len(RETVAL));
{
int i;
for (i = 0; i <= av_len(RETVAL); i++)
{
SV **r = av_fetch(RETVAL, i, NULL);
printf( "%2d '%s'\n", i, SvPV(*r, len));
}
}
}
OUTPUT:
RETVAL
--------------------------------------------------------------
My test scripts is:
use InterShop::Tools;
@code = BuildArray();
print "\$\#code $#code\n";
print "[@code]\n";
--------------------------------------------------------------
The output is
--------------------------------
length @code 1
0 'hello'
1 'world'
$#code 0
[ARRAY(0x7c18d0)]
Which is not quite what I expected. I thought my XS code is ok as
all debugging information on the C level seem to be fine.
System: NT 4.0 Perl 5.004_2 Visual C++ 5.0
Any help is greatly appriciated
Christian
--
Christian Mallwitz INTERSHOP Communications GmbH
pgp: 02 30 7E 1A 7A C1 5C 16 2B 4D 53 A9 1B 05 F7 DD
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1672
**************************************