[11222] in Perl-Users-Digest
Perl-Users Digest, Issue: 4822 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 4 05:07:18 1999
Date: Thu, 4 Feb 99 02:00:18 -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, 4 Feb 1999 Volume: 8 Number: 4822
Today's topics:
Re: [Perl] How to find the Perl FAQ nam@hotpop.com
Re: alternative perl NG for newbies? <dgris@moiraine.dimensional.com>
Re: Are sub-second timers possible in Perl? <jdf@pobox.com>
Re: Array of Dates Prior to Today johnsteele@my-dejanews.com
get login/password pair from PAP/CHAP <dda@ic.ru>
Help : Relative URL to cgi-local clrweav@netcom.ca
Re: How create cookies for referral tracking? (Martien Verbruggen)
Looking for subparseform.lib <kf4dmb@camcomp.com>
Re: Pattern Matching Question <ebohlman@netcom.com>
Perl / DBI / HTML <law-kr@ee.uwa.edu.au>
Perl / DBI / HTML <law-kr@ee.uwa.edu.au>
Re: Perl / DBI / HTML (Martien Verbruggen)
Re: Perl / DBI / HTML (Sam Holden)
Re: Perl in ASP code (Sean McKenna)
Re: Perl NT login scripts help... <metcher@spider.herston.uq.edu.au>
Re: perlscript with ASP <matthew.sergeant@eml.ericsson.se>
PerlShop Script <mwillett@ptw.com>
Seek to the end of file with Fcntl? mkshanx@ust.hk
testing for scalar/list/array <xah@best.com>
Re: testing for scalar/list/array (Sam Holden)
Re: testing for scalar/list/array (brian d foy)
Re: Unlink Symlink (Tad McClellan)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 04 Feb 1999 08:02:54 GMT
From: nam@hotpop.com
Subject: Re: [Perl] How to find the Perl FAQ
Message-Id: <79bk7b$vt1$1@nnrp1.dejanews.com>
Thanks a lot for your post, Tom.
Nam
In article <pfaqmessage918041041.17673@news.teleport.com>,
Tom Phoenix <rootbeer&pfaq*finding*@redcat.com> wrote:
> Archive-name: perl-faq/finding-perl-faq
> Posting-Frequency: weekly
> Last-modified: 10 Sep 1998
>
> [ That "Last-modified:" date above refers to this document, not to the
> Perl FAQ itself! The last major update of the Perl FAQ was in Summer of
> 1998; of course, ongoing updates are made as needed. ]
>
> For most people, this URL should be all you need in order to find Perl's
> Frequently Asked Questions (and answers).
>
> http://cpan.perl.org/doc/FAQs/
>
> Please look over (but never overlook!) the FAQ and related docs before
> posting anything to the comp.lang.perl.* family of newsgroups.
>
> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
>
> Beginning with Perl version 5.004, the Perl distribution itself includes
> the Perl FAQ. If everything is pro-Perl-y installed on your system, the
> FAQ will be stored alongside the rest of Perl's documentation, and one
> of these commands (or your local equivalents) should let you read the FAQ.
>
> perldoc perlfaq
> man perlfaq
>
> If a recent version of Perl is not properly installed on your system,
> you should ask your system administrator or local expert to help. If you
> find that a recent Perl distribution is lacking the FAQ or other important
> documentation, be sure to complain to that distribution's author.
>
> If you have a web connection, the first and foremost source for all things
> Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
> CPAN also includes the Perl source code, pre-compiled binaries for many
> platforms, and a large collection of freely usable modules, among its
> 560_986_526 bytes (give or take a little) of super-cool (give or take
> a little) Perl resources.
>
> http://cpan.perl.org/
> http://www.perl.com/CPAN/
> http://cpan.perl.org/doc/FAQs/FAQ/html/
> http://www.perl.com/CPAN/doc/FAQs/FAQ/html/
>
> You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
> you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
> selected FTP sites is especially good for you, a full list of CPAN sites
> is in the SITES file within CPAN.)
>
> California ftp://ftp.cdrom.com/pub/perl/CPAN/
> Texas ftp://ftp.metronet.com/pub/perl/
> South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
> Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
> Australia ftp://cpan.topend.com.au/pub/CPAN/
> Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
> Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
> Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
>
> If you have no connection to the Internet at all (so sad!) you may wish
> to purchase one of the commercial Perl distributions on CD-Rom or other
> media. Your local bookstore should be able to help you to find one.
> Another possibility is to use one of the FTP-via-email services; for
> more information on doing that, send mail to <mail-server@rtfm.mit.edu>
> (not to me!) with these lines in the body of the message, flush left:
>
> setdir usenet-by-group/news.announce.newusers
> send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List
>
> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
>
> Comments and suggestions on the contents of this document
> are always welcome. Please send them to the author at
> <pfaq&finding*comments*@redcat.com>. Of course, comments on
> the docs and FAQs mentioned here should go to their respective
> maintainers.
>
> Have fun with Perl!
>
> --
> Tom Phoenix Perl Training and Hacking Esperanto
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
nam@hotpop.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 04 Feb 1999 00:15:36 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: alternative perl NG for newbies?
Message-Id: <m3vhhi1vxj.fsf@moiraine.dimensional.com>
tadmc@metronet.com (Tad McClellan) writes:
> Andrew Fry (andrewf@beausys.demon.co.uk) wrote:
> : c) be aware of, and read, the code inside Perl modules
> You are being absurd yet again.
He's being absurd, but not in the way that you suggest.
> Provide a cite that will allow us to find any example of a
> posting that you are basing this claim on.
This will probably count. :-)
*Every* perl programmer should spend as much time with the code
in perl's standard library as they do with perldoc. Not doing
so is a mistake of amazing proportions.
The source code is an _absolutely essential_ reference to the workings
of perl. The documentation may become out of date, and you may get
wrong answers from the newsgroup, but you always know that the source
code will reflect the actual behavior of perl.
You don't even have to be a C programmer to become familiar with
most of perl. Most non-trivial programs require the use of several
modules that are written in perl. These modules are a great source
of information on how to do something in a production environment.
Beyond that, think about the code that is there, sitting on your hard
drive. This code has been reviewed by thousands of people, has driven
mission critical applications at huge financial and military
institutions, and has stood up to the challenge of having to run
_right_, all the time. It never ceases to amaze me that most
programmers think they can do a better job, on their own, than that
represented by the code sitting in @INC.
Perl is open source. That means that all of that tested, reviewed
code is yours for the taking, so long as you abide by the terms of
perl's license. It's all just sitting there, a cut, a paste, and a
variable renaming away, ready to become useful in _your_ code.
Perhaps there isn't much emphasis made here on checking the
source when looking for solutions, but there should be.
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: 04 Feb 1999 06:51:52 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: Eric The Read <emschwar@mail.uccs.edu>
Subject: Re: Are sub-second timers possible in Perl?
Message-Id: <m3u2x2g1hj.fsf@joshua.panix.com>
Eric The Read <emschwar@mail.uccs.edu> writes:
> I could put out my own dictionaryfof potato-peeling terms and call
> it "Webster's Unabridged"; all perfectly legal.
I wonder how it would define "free". :)
> I'm curious to know what "Webster's" would omit:
>
> 2 : b : to glance from point to point of often hastily, casually, or in
> search of a particular item <scan the want ads looking for a job>
Touche, game, set, match.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Thu, 04 Feb 1999 03:46:54 GMT
From: johnsteele@my-dejanews.com
Subject: Re: Array of Dates Prior to Today
Message-Id: <79b57b$kb1$1@nnrp1.dejanews.com>
Larry:
Thanks for the reply. One of the pitfalls of using some powerfull module like
Date:Manip is that you sometimes get so wound up in them you forget the easy
solutions. After sending the post I realized that there was an easy way to
solve it and ended up with (this is part of a web output pulldown list of the
past 35 dates beginning with today);
print "<select name=postingdate>";
print "<option checked>$date_string"; # the default is today
$count= 35;
for ($j = 1; $j < $count; $j++)
{
$priortime = time-($j*86400); # cycle through "j" days back
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime
($priortime);
$year += 1900;
$display = sprintf '%4d%02d%02d',$year,$mon+1,$mday;
print "<option>$display";
}
print "</select></td>";
Not as concise as yours but works fine.
My apologies for distrubing the group
John
In article <MPG.1122836d469002369899ff@nntp.hpl.hp.com>,
lr@hpl.hp.com (Larry Rosler) wrote:
> In article <79afvv$8p8$1@info.uah.edu> on 3 Feb 1999 21:44:31 GMT, Greg
> Bacon <gbacon@itsc.uah.edu> says...
> > In article <79aaom$u41$1@nnrp1.dejanews.com>,
> > johnsteele@my-dejanews.com writes:
> > : Can anyone suggest a reasonably fast way to generate a list of N dates
> > : prior to today?
> ...
> > ($d,$m,$y) = ( localtime($now - $i * 60 * 60 * 24) )[3,4,5];
> > $y += 1900;
> > $m++;
> >
> > push @times, sprintf "%d/%02d/%02d", $y, $m, $d;
> ...
>
> Look, Ma, no modules!!!
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Company
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 04 Feb 1999 08:08:45 +0300
From: Dmitry Diskin <dda@ic.ru>
Subject: get login/password pair from PAP/CHAP
Message-Id: <36B92B5D.F8105E23@ic.ru>
Hello,
I'm writing some kind of dialin server for ISP, based on FreeBSD. Does
anyone have a perl script (or an idea how to write one) for parsing user
login and password from PAP or CHAP streams? I'd like to make it
possible for users to log in from Windows environment without
registering them in /etc/passwd. I have my own users database and I like
to perform authentication myself, and the problem is how to get login
and password from PPP stream.
Any help is greatly appreciated.
Dmitry.
------------------------------
Date: Thu, 04 Feb 1999 05:45:58 GMT
From: clrweav@netcom.ca
Subject: Help : Relative URL to cgi-local
Message-Id: <79bc6k$pvk$1@nnrp1.dejanews.com>
**Please don't tell me this is off topic. I am at my wits end. Just if someone
can help me, I would very much appreciate it.**
The following is my question to my Host Administrator:
>> Can you tell me the 'relative' URL for my cgi-local directory? I believe I
>> am signed on to the Advanced Account. Thanks for your time. :)
>Well, it doesn't exist by default -- you have to create it. After that, it
>should be accessible relatively (as a URL) via: /cgi-local
I have put a question back on "HOW" to create this "alias" or shortcut to my
cgi-local directory, and to this 3rd day, waiting patiently for a response, I
still am at a standstill.
Is there anybody who have resolved such a problem please tell me on how to go
about to "create" this alias to my cgi-local directory? Thanks very much in
advance to anyone who took the time to help me.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 04 Feb 1999 04:52:50 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How create cookies for referral tracking?
Message-Id: <CI9u2.169$_E3.9156@nsw.nnrp.telstra.net>
In article <79b5l1$6dj@sjx-ixn10.ix.netcom.com>,
cookies@ONE-CLICK.COM (Andri Bell [aka Andre Bell]) writes:
[Exactly the same as he wrote in a post to clp.modules]
Please, if you must post offtopic questions to two newsgroups, at
least crosspost so that I don't have to see it twice.
Martien
--
Martien Verbruggen |
Interactive Media Division | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: Wed, 3 Feb 1999 20:21:17 -0500
From: "Jim and Lois" <kf4dmb@camcomp.com>
Subject: Looking for subparseform.lib
Message-Id: <36b8f943@camcomp2.camcomp.com>
Hello , I am new to perl. I am following a book and trying to write a
script.
But it requires subparseform.lib . Where is it ? I am using Linux redhat 5.1
and apachee server
thanks in advance
------------------------------
Date: Thu, 4 Feb 1999 04:47:12 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Pattern Matching Question
Message-Id: <ebohlmanF6M5Ao.KLM@netcom.com>
Mark Simonetti <marks@webleicester.co.uk> wrote:
: I want to change it to AND, but why can i do this
: =~ /firstword|secondword|thirdword/
: but not this ?
: =~ /firstword&secondword&thirdword/
[snip]
: Using .* isnt satisfactory, because then surely the words have to be in
: the same order...
: =~ /firstword.*secondword.*thirdword/ <=== this may be incorrect of my
: meaning, but .. u know what I mean ;)
Zero-width lookaheads to the rescue:
/
^ # anchor to start of string
(?= # start lookahead
.* # longest sequence of characters up to
firstword # the first word
) # end of lookahead; if we didn't match firstword,
# the expression fails.
# if we did match it, we're still at the start of the string
# because a lookahead has zero width.
(?= # start another lookahead
.*
secondword
)
# as many of them as you need
/x
This is explained in recipe 6.17 in the _Perl Cookbook_, which discusses
some related issues (for example, this construct allows matches to
overlap; a different one is needed if they have to be distinct, but its
length and matching speed are exponential in the number of terms to be
ANDed).
You may want to take a look at my Text::Query::Advanced module on CPAN,
which uses all the techniques from recipe 6.17, as well as some not
there, to turn a query involving AND, OR, NOT, and NEAR into a regexp.
Anyone who has suggestions on how to improve the regexp code generated
for NEAR queries is invited to post them, as the performance of the code
I currently generate is rather pessimal due to the use of nested
*-modified sub-expressions (redefining NEAR in terms of characters rather
than words is not considered an improvement).
------------------------------
Date: 4 Feb 1999 04:10:24 GMT
From: Richard Law <law-kr@ee.uwa.edu.au>
Subject: Perl / DBI / HTML
Message-Id: <79b6jg$92k$2@enyo.uwa.edu.au>
Hi. I am having problems with my cgi script that queries my Postgres
database. there isn't any problem with the database queries, and the
script runs when compiled under linux prompt. but when i executed it through
cgi under linux/netscape, i can only see the letters "sada"
(a deliberate print statement i put in to see where it crashes) come out on
the webpage, and not anything else that is supposed to follow after that.
the compilation under linux prompt does give me the FULL output though.
i suspect it stalls after i executed the line "$result = $conn->prepare($cmd)"
when executing it using lynx/netscape.
here's the codes. any help appreciated. please reply back to the newsgroup,
not at my email address. thanks
--------------
#!/usr/bin/perl -w
use CGI;
use DBI;
$dbase = "contacts"; #name of database
$conn = DBI->connect("dbi:Pg:dbname=$dbase");
select(STDOUT);
print "Content-type:text/html\n\n";
print <<HEADER;
<HTML>
<HEAD>
<TITLE>A Test Page</TITLE>
</HEAD>
<BODY BGCOLOR ="#FFFFFF" TEXT="#000000">
<P>
HEADER
$cmd = "SELECT * FROM phonebook";
print "sada";
$result = $conn->prepare($cmd);
$result->execute;
while(@tables = $result->fetchrow()) {
$i ="0";
foreach(@tables) {
print $result->{NAME}->[$i];
print " ", $_, "\n";
$i = $i + 1;
}
}
$result->finish;
print <<FOOTER;
</BODY>
</HTML>
FOOTER
------------------------------
Date: 4 Feb 1999 06:51:49 GMT
From: Richard Kok Fhung Law <law-kr@ee.uwa.edu.au>
Subject: Perl / DBI / HTML
Message-Id: <79bg25$i7m$1@enyo.uwa.edu.au>
I have added the check connection code in, but still get the same error.
The output only comes out on linux, but on the webpage, it complained
the user authen. failed. see below. any help appreciated. thanks again.
----------------------------
TEST.CGI
=========
#!/usr/bin/perl -w
use CGI;
use DBI;
$dbase = "contacts"; #name of database
select(STDOUT);
print "Content-type:text/html\n\n";
print <<HEADER;
<HTML>
<HEAD>
<TITLE>A Test Page</TITLE>
</HEAD>
<BODY BGCOLOR ="#FFFFFF" TEXT="#000000">
<P>
HEADER
$conn = DBI->connect("dbi:Pg:dbname=$dbase", "rich", "rich");
if ($conn) {
print "succeeds";
}
else {
print $DBI::errstr;
}
$cmd = "SELECT * FROM phonebook";
print "sada";
$result = $conn->prepare($cmd);
$result->execute;
while(@tables = $result->fetchrow()) {
$i ="0";
foreach(@tables) {
print $result->{NAME}->[$i];
print " ", $_, "\n";
$i = $i + 1;
}
}
$result->finish;
print <<FOOTER;
</BODY>
</HTML>
FOOTER
exit(0);
----------------------------------
Linux output of: perl test.cgi
==============================
Content-type:text/html
<HTML>
<HEAD>
<TITLE>A Test Page</TITLE>
</HEAD>
<BODY BGCOLOR ="#FFFFFF" TEXT="#000000">
<P>
succeedssadaname Asterix
address 1 Asterix Street
suburb Xiretsa
postcode 1234
homephone 1234567
workphone 2345654
mobilephone 43533242
name Getafix
address 3 Getafix Street
suburb Xifateg
postcode 3462
homephone 465376367
workphone 436378876
mobilephone 765784363
name obelix
address 2 Obelix Road
suburb disneyland
postcode 4355
homephone 4367834
workphone 76863463
mobilephone 4353457
name Coconfix The Bard
address 6 Coconfix Road
suburb disneypark
postcode 8437
homephone 4289-music-3
workphone 2349282
mobilephone 324234242
name clark kent
address krypton
suburb none
postcode none
homephone 123-help-me
workphone none
mobilephone none
</BODY>
</HTML>
------------------------------------------
Netscape output:
===================
<HTML>
<HEAD>
<TITLE>A Test Page</TITLE>
</HEAD>
<BODY BGCOLOR ="#FFFFFF" TEXT="#000000">
<P>
User authentication failedsada
----------------------------------------------
as u can see, the output comes out under compilation
on linux, but breaksdown when i execute the same
cgi script with netscape. if i'm not supplying
the right password and username, shouldn't it
have crashed when i run it with the linux prompt perl
in the first place?
rich
a
------------------------------
Date: Thu, 04 Feb 1999 04:28:19 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl / DBI / HTML
Message-Id: <Dl9u2.165$_E3.8786@nsw.nnrp.telstra.net>
In article <79b6jg$92k$2@enyo.uwa.edu.au>,
Richard Law <law-kr@ee.uwa.edu.au> writes:
> $conn = DBI->connect("dbi:Pg:dbname=$dbase");
You should check whether this succeeds.
> select(STDOUT);
not necessary
> $cmd = "SELECT * FROM phonebook";
> print "sada";
>
> $result = $conn->prepare($cmd);
>
> $result->execute;
You should check whether any of tha bove calls to the dbi object succeed.
Your web server is probably not running with the same user code as
you. Probably just a permissions problem, or an identification
problem. Possibly you'll be able to find out by checking everything.
Martien
--
Martien Verbruggen |
Interactive Media Division | We are born naked, wet and hungry. Then
Commercial Dynamics Pty. Ltd. | things get worse.
NSW, Australia |
------------------------------
Date: 4 Feb 1999 07:56:48 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl / DBI / HTML
Message-Id: <slrn7bikm0.pa7.sholden@pgrad.cs.usyd.edu.au>
On 4 Feb 1999 06:51:49 GMT, Richard Kok Fhung Law <law-kr@ee.uwa.edu.au> wrote:
>
<snip code and output>
>
>as u can see, the output comes out under compilation
>on linux, but breaksdown when i execute the same
>cgi script with netscape. if i'm not supplying
>the right password and username, shouldn't it
>have crashed when i run it with the linux prompt perl
>in the first place?
>
>rich
>a
Is it possible that the database allows access based on the userid of the
process requesting access? Just a guess and probably wrong. You could test
by running the script from a shell while logged in as the user the webserver
runs at.
--
Sam
There's no such thing as a simple cache bug.
--Rob Pike
------------------------------
Date: Wed, 03 Feb 1999 21:06:42 -0800
From: seanmck@mckennaprod.com (Sean McKenna)
Subject: Re: Perl in ASP code
Message-Id: <36b92a9a.11070026@nntp1.ba.best.com>
On Wed, 03 Feb 1999 11:35:55 +0000, Matt Sergeant
<matthew.sergeant@eml.ericsson.se> wrote:
>It doesn't specifically, but it does detail exactly what collections
>are, and how to use them. A more direct (and more volatile) URL is:
>
>http://www.fastnetltd.ndirect.co.uk/Perl/PSIntro.html
Matt, shouldn't that be
http://www.fastnetltd.ndirect.co.uk/Perl/Articles/PSIntro.html
?
And thanks much for a very useful site.
Sean McKenna "All the world's a stage..."
------------------------------
Date: Thu, 04 Feb 1999 14:32:36 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Perl NT login scripts help...
Message-Id: <36B922E4.16A6ED0A@spider.herston.uq.edu.au>
Put:
BEGIN {
push @INC, 'p:/bin', 'p:/lib';
}
at the start of your script.
--
Jaime Metcher
Mjd440 wrote:
>
> Hi Folks,
>
> I have a Perl NT login script that runs fine on a few machines (Perl
> installed), but I can't get the script to run if the client doesn't have Perl
> installed locally. I'm attempting to have the client machines attach to the
> Perl share on the server and run the script, but it seems to have a problem
> trying sorting out the "Use Win32;" line in the script. I've mapped the Perl
> share to drive letter, P:, then modified the path statement for the client
> machines to include P:\bin, P:\lib and it still can't locate Win32.pm. Any
> idea what gives? Thanks in advance.
>
> -- Mark
------------------------------
Date: Thu, 04 Feb 1999 09:39:51 +0000
From: Matt Sergeant <matthew.sergeant@eml.ericsson.se>
Subject: Re: perlscript with ASP
Message-Id: <36B96AE6.4BF353F@eml.ericsson.se>
"news.dnet.net.id" wrote:
>
> Does anyone know how to read and write using ASP in perlscript language..?
See my web site.
--
<Matt email="msergeant@ndirect.co.uk" />
| Fastnet Software Ltd | Perl in Active Server Pages |
| Perl Consultancy, Web Development | Database Design | XML |
| http://come.to/fastnet | Information Consolidation |
------------------------------
Date: Wed, 3 Feb 1999 22:40:49 -0800
From: "Michael A. Willett" <mwillett@ptw.com>
Subject: PerlShop Script
Message-Id: <36b9417a.0@news.ptw.com>
I am looking for anyone who has an account with <9netave.com> and is doing
cgi scripting with PERL. I have successfully implemented several cgi scripts
but perlshop.cgi has eluded me. I believe my problem for the most part is
the server path and the URL. Try as I might, I just can't seem to get the
right combination. If there is anyone out there that can lend some
assistance, I would be grateful. Please contact me at: < mwillett@ptw.com >
Thanks
------------------------------
Date: Thu, 04 Feb 1999 08:16:53 GMT
From: mkshanx@ust.hk
Subject: Seek to the end of file with Fcntl?
Message-Id: <79bl1h$g9$1@nnrp1.dejanews.com>
Hi,
I am using Fcntl (file control) function (since I am running Solaris 2.4 which
does not seem to support the flock()), and I need some help with "seek"ing to
the EOF with Fcntl. The man pages do not help me much in figuring that out.
Would be grateful if anyone can help me with it. Please send me a CC at my
email too.
Thanks,
Shanx
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 03 Feb 1999 22:27:28 -0800
From: "Xah" <xah@best.com>
Subject: testing for scalar/list/array
Message-Id: <36b93dd1$0$16690@nntp1.ba.best.com>
Perl quiz:
suppose f is a function, and it returns one of the following:
* scalar. e.g. sub f() {return 3;};
* a list. e.g. sub f() {return (99,28,57);};
* an array. e.g. sub f() {my @a = (99,28,57); return @a;};
but you don't know which of these it returns.
What can I do to find out?
If this cannot be done, then what is the best way to find out whether it's a
scalar? Here's my solution:
#!/usr/local/bin/perl5 -w
use strict;
# f() returns either 'str' or an array of numbers. The choice is
random.
sub f() {
my $num=rand();
if ($num< 0.3333) {return 'str';}
elsif ($num<0.6666) {return (3,4,29,50)}
else { return @{[3,4,29,50]};};
};
# this construct determines whether f() returned an array/list or scalar.
if ( ($#{@{[f()]}} - $[ ) > 0) {print q(it's array/list.);} else {print
q(it's scalar);};
__END__
Thanks.
Xah
xah@best.com
http://www.best.com/~xah/PageTwo_dir/more.html
"I design, I program, and I have fun. I'd rather die than hack."
------------------------------
Date: 4 Feb 1999 07:53:26 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: testing for scalar/list/array
Message-Id: <slrn7bikfm.pa7.sholden@pgrad.cs.usyd.edu.au>
On Wed, 03 Feb 1999 22:27:28 -0800, Xah <xah@best.com> wrote:
>Perl quiz:
>
>suppose f is a function, and it returns one of the following:
>* scalar. e.g. sub f() {return 3;};
>* a list. e.g. sub f() {return (99,28,57);};
>* an array. e.g. sub f() {my @a = (99,28,57); return @a;};
>
>but you don't know which of these it returns.
>
>What can I do to find out?
>
>If this cannot be done, then what is the best way to find out whether it's a
>scalar? Here's my solution:
>
># this construct determines whether f() returned an array/list or scalar.
>if ( ($#{@{[f()]}} - $[ ) > 0) {print q(it's array/list.);} else {print
>q(it's scalar);};
What about :
sub f
{
if (wantarray) {
return (1,2,3,4);
} else {
return "foo";
}
}
What if a sub returns an array that only contains one element? An array
containing zero elements?
I think the best answer is to look at the code for the sub.
--
Sam
Just don't create a file called -rf. :-)
--Larry Wall
------------------------------
Date: Thu, 04 Feb 1999 03:46:48 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: testing for scalar/list/array
Message-Id: <comdog-ya02408000R0402990346480001@news.panix.com>
In article <36b93dd1$0$16690@nntp1.ba.best.com>, "Xah" <xah@best.com> posted:
> Perl quiz:
>
> suppose f is a function, and it returns one of the following:
> * scalar. e.g. sub f() {return 3;};
> * a list. e.g. sub f() {return (99,28,57);};
> * an array. e.g. sub f() {my @a = (99,28,57); return @a;};
> if ( ($#{@{[f()]}} - $[ ) > 0)
in this case you are evaluating f() in a list context, which sort of
taints your results. and isn't all of that line noise really
scalar @{[f()]} > 1
? :)
a way to do this is to return an array reference when you want to
return many elements. you then check to see if the return value
is a reference. otherwise, you're going to have to go a long way
to tell the difference between
return 3;
and
return (3);
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 3 Feb 1999 22:18:46 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Unlink Symlink
Message-Id: <637b97.qk3.ln@magna.metronet.com>
Artoo (r2-d2@REMOVEbigfoot.com) wrote:
: How can you delete (unlink) a symlink?
Yes.
: I've tryied using unlink ($symlink_path) and it does nothing,
Did you try having perl ask you OS what the problem is?
unlink 'somesymlink' or die "could not remove symlink $!";
^^
^^
: what function
: to I need to use?
unlink()
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4822
**************************************