[11191] in Perl-Users-Digest
Perl-Users Digest, Issue: 4791 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 31 15:07:20 1999
Date: Sun, 31 Jan 99 12:00:27 -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 Sun, 31 Jan 1999 Volume: 8 Number: 4791
Today's topics:
Re: ActivePerl on Win95 <mikeblock@home.com>
Re: Bytecode sharing between interpreters <jdf@pobox.com>
Re: CGI form processing (Bill Moseley)
Re: CGI form processing (Tad McClellan)
Re: code to recurse directories <jdf@pobox.com>
Re: code to recurse directories (John Klassa)
Email script ..seems to be working.. anything overlooke <bcompson@yahoo.com>
Re: How does 'mail' program works <jdf@pobox.com>
Re: How to do query in a list? (Bill Moseley)
Re: how to pass scalars AND variables to a sub? <ruedas@geophysik.uni-frankfurt.de>
Re: how to pass scalars AND variables to a sub? <ruedas@geophysik.uni-frankfurt.de>
Re: Is there a way to check if a called subroutine actu <jdf@pobox.com>
Re: localtime() (Larry Rosler)
Newbie question on regular expressions <UloPe@hotmail.com>
Re: Newbie question on regular expressions <STEVENHENDERSON@prodigy.net>
Re: Newbie question on regular expressions <staffan@ngb.se>
Re: Perl Crashes IIS4! <Richard.Walker@west-server.com>
Re: Perl Crashes IIS4! (I R A Aggie)
Private Mailbox script rbellega@worldnet.att.net
Re: Private Mailbox script <staffan@ngb.se>
Re: Request for negative value list indexes (Bart Lateur)
Re: simple database <jjarrett@ecpi.com>
use strict sure isn't very strict <webqueen@bol.net>
Re: use strict sure isn't very strict (Jack Applin)
Re: use strict sure isn't very strict <jdf@pobox.com>
Re: use strict sure isn't very strict (Tramm Hudson)
Re: Using a variable as a variable name <bruceh@interaccess.com>
Re: Using use base... <jdf@pobox.com>
Re: Visual Perl? (Bart Lateur)
What text editors are you using for Perl? <info@purco.qc.ca>
Re: What text editors are you using for Perl? ()
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 31 Jan 1999 19:04:57 GMT
From: "mikey" <mikeblock@home.com>
Subject: Re: ActivePerl on Win95
Message-Id: <tP1t2.6111$kA1.29475@news.rdc1.on.wave.home.com>
Something I usually do is to write a line like this before exiting the
script:
$dummy = <STDIN>;
Then you just have to hit enter when you want the DOS box to disappear.
Cheers!
Andrew Fry wrote in message ...
>In article <78kvgc$no$1@newnews.global.net.uk>, Wallace
><niall_wallace@yahoo.com> writes
>>Try opening a DOS Box and then running using perl file
>>
>>Wallace
>
>Yep. That's how I do it. I think it mentions it somewhere in the
>ActivePerl documentation.
>
>>
>>Jason Boyd wrote in message <3697BAC3.7DA17D9F@hotmail.com>...
>>>If anyone knows how I can get ActivePerl (509) to fuction properly on my
>>>Win95 system, could you please help me?
>>>
>>>I can open the perl.exe in Windows, but any scripts I run shut down as
>>>soon as they have displayed, meaning I can't see the results. When I try
>>>to open perl from DOS, it tells me "this program doesn't run in DOS
>>>mode." Yet the docs that come with the build claim it is for Win NT, 95
>>>and 98 systems.
>>>
>>>Any help is appreciated (even the name of another version of perl that
>>>IS built for Win95).
>>>
>>>Jason Boyd
>>
>>
>
>---
>Andrew Fry
>"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).
------------------------------
Date: 31 Jan 1999 19:42:50 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: "Geoff Mottram" <minaret@sprynet.com>
Subject: Re: Bytecode sharing between interpreters
Message-Id: <m3n22zz3kl.fsf@joshua.panix.com>
"Geoff Mottram" <minaret@sprynet.com> writes:
> One solution that seems promising is the idea of a shared memory segment
> where all Perl compiled byte code on a machine would be stored.
[snip]
In the Un*x world, there's "mod_perl", an Apache module that makes a
Perl interpreter part of the web server itself. It's a thing of
beauty and speed.
It's my understanding that Apache/mod_perl is not quite ready for
prime time in the Win32 world. Corrections cheerfully accepted.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Sun, 31 Jan 1999 09:04:26 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: CGI form processing
Message-Id: <MPG.111e2cf81c18675c989691@nntp1.ba.best.com>
In article <36b3ec40.0@news.one.net>, olivierf@worldnet.att.net says...
> I am new to PERL. I am lookng to process a form.
No problem in perl.
perldoc CGI
> I found a lot of
> freeware but nothing that does what I want.
I can't find a script that will do my laundry.
> Usually when there is some
> error checking done on the form input, the error message appears on a
> separate HTML page which end by " please go back, etc...".
I don't do that, usually, or otherwise.
Eh, just have the same script generate and process the form.
--
Bill Moseley mailto:moseley@best.com
------------------------------
Date: Sun, 31 Jan 1999 12:14:14 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: CGI form processing
Message-Id: <mh6297.rj6.ln@magna.metronet.com>
Olivier (olivierf@worldnet.att.net) wrote:
: I am new to PERL. I am lookng to process a form . I found a lot of
: freeware but nothing that does what I want. Usually when there is some
: error checking done on the form input, the error message appears on a
: separate HTML page which end by " please go back, etc...". I'd like to
: generate my error message at the top of the actual form which would still
: contain the answers previously given by the user. Is this doable in PERL ?
This is doable in any programming language.
: If so is there any code out there I could start from ?
Probably, but I'm sure I don't know where. Sorry.
All you need to know in order to write it yourself is how
to provide default values (set them to be whatever the user
entered the first time) to input widgets.
Find an HTML spec to learn how to do that.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 31 Jan 1999 20:06:25 +0100
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: code to recurse directories
Message-Id: <m3emobz2ha.fsf@joshua.panix.com>
grynberg@hotmail.com (sysop) writes:
> Hi. I am trying to write a program to print all the files on my hard
> drive, with their complete paths. I was wondering if anyone has
> anything like this.
Sure, File::Find makes this a snap.
> I do not want to use modules
Why? I'm not asking for rhetorical effect, I really wonder why.
> I would like to see the perl code itself.
What's to stop you from reading File/Find.pm? (Um, that one *is* for
rhetorical effect.)
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 31 Jan 1999 19:09:21 GMT
From: klassa@aur.alcatel.com (John Klassa)
Subject: Re: code to recurse directories
Message-Id: <7929p1$jpg$1@aurwww.aur.alcatel.com>
On Sun, 31 Jan 1999 15:18:34 GMT, sysop <grynberg@hotmail.com> wrote:
> Hi. I am trying to write a program to print all the files on my hard
> drive, with their complete paths. I was wondering if anyone has
> anything like this.
>
> I do not want to use modules, I would like to see the perl code
> itself. It does not seem difficult, and indeed I have no trouble going
> into directories, but it does not come back up.
Okay, since you don't want to *use* modules, yet you do want to see perl
code, how about you just *look at* File::Find. :-)
--
John Klassa / Alcatel / Raleigh, NC, USA / $pm{Raleigh}[0] / \/\/&/\/\ / <><
------------------------------
Date: 31 Jan 1999 18:28:32 GMT
From: "Quentin Compson" <bcompson@yahoo.com>
Subject: Email script ..seems to be working.. anything overlooked
Message-Id: <01be4d47$24cd3e80$880b440c@brmptrue>
Hello
I wrote a Perl email script which seems to be working just fine. : )
I am very new to perl so for all I know I may have over looked something.
I was wondering if anyone who knows perl better than I do would see
anything
to burst my bubble with : ( or if this code is fine as is. : )
http://revdwj.virtualave.net/suggest.html
The images and links are not in place.
I just have it up to test the script since virtualave gives free CGI access
if you
put up banners.
----------------------------------------------------------------------------
----------------------------------------------------------------------------
------------------
#!/usr/bin/perl
#Email Perl script - 1/31/1999 - Quentin Compson
# location of mail program on server
$mailprog= "/usr/sbin/sendmail" ;
# flag for legal characters and security stuff
$legal = 1;
# flag to see if all fields have data.
$allfields = 1;
# place names of missing fields in a string
$missingfields = "Please enter data for the following fields:<br>";
#get data to parse
read(STDIN, $in, $ENV{'CONTENT_LENGTH'}) ;
# Set up string to hold the body of the letter.
$letbody = "The following data was entered at $ENV{'HTTP_REFERER'}:\n\n";
$letbody .= "------------------------------------------------\n\n";
#parse the data
@elements = split(/&/, $in);
foreach $element (@elements) {
$element =~ tr/+/ /;
($name, $value)= split("=", $element) ;
$name =~ s/%([\dA-Fa-f][\dA-Fa-f])/ pack ("C", hex($1))/eg;
$value =~ s/%([\dA-Fa-f][\dA-Fa-f])/ pack ("C", hex($1))/eg;
# check for code in the fields
if ($value =~ /[><&|\/]/ ) {
$legal = 0;
break;
}
# Make sure no more than 500 characters have been entered in the textarea
if (length($value) > 500){
$legal = 0;
break;
}
# Check to see if data has been entered.
if (length($value) == 0){
$missingfields .= "$name <br>";
$allfields = 0;
}
# ignore the submit button and write all other fields to body string
if ($value ne "Submit") {
$letbody .= "$name : $value \n\n";
}
}
# if all fields have been entered and all characters are legal send mail
if (($legal) & ($allfields)) {
open(MAIL, "|$mailprog -t")
|| &HTMLdie("Couldn't send the mail (couldn't run $mailprog).") ;
$ENV{'HTTP_REFERER'} || ($ENV{'HTTP_REFERER'}= "SLC") ;
print MAIL "To:bcompson\@yahoo.com\n",
"From:bcompson\@yahoo.com\n",
"Subject: Form data from the Web\n",
"$letbody";
close(MAIL) ;
print <<EOF ; # Write HTML for a successful entry
Content-type: text/html
<html>
<BODY bgcolor="#FFFF88">
<h3>Thank you for your suggestion.<br>
If I think it is amusing I'll include it.<br>
<A HREF="slc4.html"><IMG SRC="slchome.gif"></A>
</body>
</html>
EOF
}
elsif ($allfields) { # if invalid characters have been entered
print <<EOF ;
Content-type: text/html
<html>
<BODY bgcolor="#FFFF88">
Thank you for entering your suggestion but I'm afraid I'll have to ask you
to reenter it.<br>
Please don't enter HTML code in the fields and limit your
description to 700 words.</h3><br>
For security reasons please don't use the following characters :<br>
< <br>
> <br>
\ <br>
& <br>
| <br>
<A HREF="http://revdwj.virtualave.net/suggest.html">back</A>
</body>
</html>
EOF
}
else { # if fields are missing
print <<EOF ;
Content-type: text/html
<html>
<BODY bgcolor="#FFFF88">
$missingfields
<A HREF="http://revdwj.virtualave.net/suggest.html">back</A>
</body>
</html>
EOF
}
------------------------------
Date: 31 Jan 1999 19:54:01 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: logan_shaw@yahoo.com
Subject: Re: How does 'mail' program works
Message-Id: <m3k8y3z31y.fsf@joshua.panix.com>
logan_shaw@yahoo.com writes:
> local ($from, $to, $subject, $body) = @_;
Why use global variables? Use my(), not local(). See a recent Tom
Christiansen post for justification of this advice.
> warn "Can't open pipe to sendmail because $!\n";
> return 1;
It's common practice to return a false value when something fails.
> print SENDMAIL "From: ", $from, "\n";
If you're using double-quotes, you might as well really use them:
print SENDMAIL "From: $from\n";
Furthermore, since you're not doing any processing between calls to
print(), you might as well use a here doc, which makes the code
clearer IMO (and certainly more efficient).
print SENDMAIL <<"LAFFA_WHILE_YOU_CAN_MONKEY_BOY";
From: $from
To: $to
Subject $subject
$body
.
LAFFA_WHILE_YOU_CAN_MONKEY_BOY
Yours in unsolicited advice,
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Sun, 31 Jan 1999 09:01:24 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: How to do query in a list?
Message-Id: <MPG.111e2c4093591519989690@nntp1.ba.best.com>
In article <36B4170B.11567309@hp.com>, pep_mico@hp.com says...
> I'd like to know what is the best way to ask if some string is included
> in a list. This is the case.
>
> I have a list of 100 computers in a text file, and I want to check if
> the existence of a computer name on this list.
Are these two different questions?
> Actually I've loaded this list into an "array" and I'm looking each
Use a hash to do lookups.
--
Bill Moseley mailto:moseley@best.com
------------------------------
Date: Sun, 31 Jan 1999 19:50:45 +0100
From: Thomas Ruedas <ruedas@geophysik.uni-frankfurt.de>
To: scraig@my-dejanews.com
Subject: Re: how to pass scalars AND variables to a sub?
Message-Id: <36B4A605.31D2@geophysik.uni-frankfurt.de>
Hello,
thanks for your answer. I already got a detailed advice pointing in a
similar direction by two other readers, which made it possible to fix
the problem.
Regards,
--
--------------------------------------------
Thomas Ruedas
Institute of Meteorology and Geophysics,
J.W. Goethe University Frankfurt/Main
Feldbergstrasse 47 D-60323 Frankfurt/Main, Germany
Phone:+49-(0)69-798-24949 Fax:+49-(0)69-798-23280
e-mail: ruedas@geophysik.uni-frankfurt.de
http://www.geophysik.uni-frankfurt.de/~ruedas/
--------------------------------------------
------------------------------
Date: Sun, 31 Jan 1999 19:47:08 +0100
From: Thomas Ruedas <ruedas@geophysik.uni-frankfurt.de>
Subject: Re: how to pass scalars AND variables to a sub?
Message-Id: <36B4A52C.4A7B@geophysik.uni-frankfurt.de>
>Certainly you read the description of a function before you
>use the function.
>From perlfunc.pod description of split():
That's exactly what I read, but I was rather confused, and besides, I
don't know "awk's default behavior", which is mentioned in
ftp://ftp.uni-hamburg.de/pub/soft/lang/perl/CPAN/doc/manual/html/pod/perlfunc/split.html
in the next sentence, because I never learnt awk.
--
--------------------------------------------
Thomas Ruedas
Institute of Meteorology and Geophysics,
J.W. Goethe University Frankfurt/Main
Feldbergstrasse 47 D-60323 Frankfurt/Main, Germany
Phone:+49-(0)69-798-24949 Fax:+49-(0)69-798-23280
e-mail: ruedas@geophysik.uni-frankfurt.de
http://www.geophysik.uni-frankfurt.de/~ruedas/
--------------------------------------------
------------------------------
Date: 31 Jan 1999 19:39:27 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: klj@jump.net
Subject: Re: Is there a way to check if a called subroutine actually exists?
Message-Id: <m3pv7vz3q8.fsf@joshua.panix.com>
Patrick Svatek <ra1593@email.sps.mot.com> writes:
> $var_name = $Form{'user_requested_name'};
>
> and then calling the sub like:
>
> print &$var_name;
Yerk! Instead of "symbolic sub references", why not a
self-documenting, easier-to-debug, friendly neighborhood hash of sub
refs?
my %dispatch_table = (
one_request => \&one_sub,
another_request => \&another_sub,
);
$name = $Form{'user_requested_name'};
if (exists $dispatch_table{$name}) {
$dispatch_table{name}->();
}
else {
explode();
}
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Sun, 31 Jan 1999 09:55:20 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: localtime()
Message-Id: <MPG.111e38d9361a69f49899ea@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <U7%s2.31$bL5.280@news3.ispnews.com> on Sun, 31 Jan 1999
11:04:21 -0500, Matthew Foley <mfoley@richmond.net> says...
> Im not sure that my last string in :
> ($sec, $min, $hour, $mday, $mon, $year, $wday, $ydat, $isdst) =localtime();
>
> is operating correctly. As I understand it $isdst should be eq 0 for
> disabled and 1 for enabled. However I have ran a script with locatime() and
> done a print $isdst and is always prints to 0. I have switched the day
> light saving time box on my nt workstation on and off, and I i still recieve
> a 0. Any clues??
$isdst indicates whether summer time is in effect, which it is not at
the moment in the Northern Hemisphere. Try setting the system date
after 0200 on April 4, 1999, and test $isdst again.
There are actually three values for $isdst: 1 for 'in effect'; 0 for
'not in effect'; -1 for 'can't determine'. These are adapted by Perl
from the ANSI/ISO C Standard.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 31 Jan 1999 18:49:52 +0100
From: "Ulrich Petri" <UloPe@hotmail.com>
Subject: Newbie question on regular expressions
Message-Id: <79254h$boi$1@news.ipf.de>
Hi everyone,
here is my problem:
i tried to negate a regular expression. but...
my code looks like:
if ("hTtP://www.blah.com" =~ /http:/i)
{
<do something>
}
that works quite nice
but actual i want to do the exact opposite
like:
if ("www.blah.com " !=~ /http:/i)
and now this doesn'T work
if anyone have any answers i would be very glad
Cu Ulrich
------------------------------
Date: Sun, 31 Jan 1999 11:06:16 -0600
From: "STEVEN T HENDERSON" <STEVENHENDERSON@prodigy.net>
Subject: Re: Newbie question on regular expressions
Message-Id: <7929j0$26fs$1@newssvr03-int.news.prodigy.com>
parens.
if(! ("hTtP://www.blah.com" =~ /http:/i))
{
print "do something\n";
}
else
{
print "do nothing\n";
}
>my code looks like:
>
>if ("hTtP://www.blah.com" =~ /http:/i)
> {
> <do something>
> }
>
------------------------------
Date: Sun, 31 Jan 1999 20:38:00 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: Newbie question on regular expressions
Message-Id: <36B4B118.1729E1F5@ngb.se>
STEVEN T HENDERSON wrote:
> parens.
> if(! ("hTtP://www.blah.com" =~ /http:/i))
or you could use
if("hTtP://www.blah.com" !~ /http:/i)
Staffan
------------------------------
Date: Sun, 31 Jan 1999 12:35:34 -0500
From: Richard Walker <Richard.Walker@west-server.com>
Subject: Re: Perl Crashes IIS4!
Message-Id: <36B49466.3C824F0@west-server.com>
Arved Sandstrom wrote:
>
> On Sun, 31 Jan 1999, Richard Walker wrote:
>
> > Abigail wrote:
> > >
> > > Richard Walker (Richard.Walker@west-server.com) wrote on MCMLXXVIII
> > > September MCMXCIII in <URL:news:36B39BAF.60761156@west-server.com>:
> > > **
> > > ** Every time I run a PerlScript in ASP that uses IO::Sockets, it executes,
> > > ** then promptly shuts my IIS4 server down.
> > >
> > > Sounds like a bug in IIS to me.
> >
> > Well, I seriously doubt that it is a _bug_, since IIS4 predates build
> > 509 of ActivePerl. At the same time I doubt that my build of perl has a
> > bug.
> >
> > What I think is that there is a simple configuration issue which is
> > undocumented. This is usually the case with third party elements and
> > IIS. That is why I sent the information in the event log -- I was
> > hoping that someone had seen this before and figured out the
> > configuration that makes it go away.
>
> And I think you're right, although it's hardly fair to say that
> ActiveState Perl made your IIS break.
It is actually the #$$ Microsoft Transaction Server that shut things
down -- strange, MTS seems to have its dirty hands in my IIS config even
though I don't use it. Could that be more off topic for this ng if I
tried? <g>
> ActiveState (I'm not a Windows fan,
> but I can give credit where credit is due) have a pretty solid product
> based on my own use of it.
I LOVE IT! The thought of doing TCP/IP programming without the need for
bloated COM components is wonderful (coming from an Apache background,
it hurt when I hit the brick wall that ASP imposes)! I am writing a
series of articles on integrating Perl with ASP, and this problem is
preventing me from publishing the same. Being an "ASP insider", I
thought it would be so nice to enlighten my peers to the power of Perl
opposed to components that are locked up in black boxes.
>
> Don't know about the "predating" part of your argument.
Correct me if I'm wrong but 509 just came out, right?
> Win95 predated
> Win98 by 3 or 4 years, and Win98 fixed 3000+ bugs in Win95. So I wouldn't
> go around touting the buglessness of IIS, particularly not when
> practically every other server I've ever used on multiple platforms
> handles Perl CGI nicely, thank you very much. :-)
Now, I know IIS is buggy -- I've hit several other unexplained phenomena
that M$ is only now acknowledging.
>
> ActiveState maintains a bunch of mailing lists, one or more of which
> tackle problems like this one. I suggest you ask your question there, and
> see what comes up. This is not a perl issue.
Yes, they have about a dozen mailing lists. Any suggestions on which
would be most appropriate for this issue?
>
> Arved
>
> PS I just spent over a month with someone via email who was trying to get
> IIS on NT to run Perl CGI.
It took me about 10 minutes with the 509 installation on IIS 4.
> It's still not resolved (try diagnosing stuff
> via email) but it's clearly not a Perl issue, as CGI's that ru on other
> setips simply didn't on IIS. And I agree, I think it's all configuration.
Only problem I've seen other than the IO::Socket problem is remembering
to escape backslashes in file paths. ;-) Other than that, Perl is a
hacker's delight on IIS4/NT.
--
What is time? If no one asks me, I know; if I wish
to explain to one who asks, I do not know.
-- St. Augustine
------------------------------
Date: Sun, 31 Jan 1999 13:33:00 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl Crashes IIS4!
Message-Id: <fl_aggie-3101991333000001@aggie.coaps.fsu.edu>
In article <790p07$92m$4@client2.news.psi.net>, abigail@fnx.com wrote:
+ Richard Walker (Richard.Walker@west-server.com) wrote on MCMLXXVIII
+ September MCMXCIII in <URL:news:36B39BAF.60761156@west-server.com>:
+ **
+ ** Every time I run a PerlScript in ASP that uses IO::Sockets, it executes,
+ ** then promptly shuts my IIS4 server down.
+
+ Sounds like a bug in IIS to me.
Sounds like a feature, actually.
James
------------------------------
Date: Sun, 31 Jan 1999 18:16:13 GMT
From: rbellega@worldnet.att.net
Subject: Private Mailbox script
Message-Id: <7926l6$62s$1@nnrp1.dejanews.com>
Hello all,
Does anyone know of an existing Perl script that allow me to do
the following on a website:
Setup private mailbox accounts for group of users.
Allow those users to mail each other based on the mailbox ID
and not actual e-mail addresses.
The end result would be a messaging system that would allow these guys to
communicate internally and not use "internet e-mail". I've looked at various
CGI archives and came up blank.
Thanks in advance for any tips or advice
Roger Bellegarde (rbellega@worldnet.att.net)
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sun, 31 Jan 1999 20:44:28 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: Private Mailbox script
Message-Id: <36B4B29C.EDF8378A@ngb.se>
rbellega@worldnet.att.net wrote:
>
> Hello all,
>
> Does anyone know of an existing Perl script that allow me to do
> the following on a website:
>
> Setup private mailbox accounts for group of users.
>
> Allow those users to mail each other based on the mailbox ID
> and not actual e-mail addresses.
This shouldn't be to hard to implement -- but do you want to find a free
solution, get tips on how to do it, or pay for someone to implement it
for you?
If you want a free solution: Keep looking. If it's out there, you should
be able to find it using for instance altavista.
If you want tips: look at CPAN, there are a lot of modules that can get
you halfways.
If you want to pay: Say how much. Besides, this isn't really the forum
for jobsearch.
What is it exactly that you want?
Staffan
------------------------------
Date: Sun, 31 Jan 1999 19:05:33 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Request for negative value list indexes
Message-Id: <36b6a652.2837480@news.skynet.be>
Uri Guttman wrote:
>so in perl you do:
>
> @ary[2 .. $#ary]
> @ary[2 .. $#ary - 1]
That's indeed the behaviour I would want. To bad it needs an explicit
array. Or are you going to say you don't like the possibility that Perl
allows:
$third = (split /\t/)[2];
Well I do. I can see two possible solutions:
A) add an extra special variable, that acts as $#ary, but for the list
you're trying to take a slice off; for exampl $#. ; $#_ is already in
use for the array @_ .
B) Make .. do "what I mean", and make it aware of the fact that it's
used to create an indices list for a slice, and let negative indices
automatically be subtracted (actually they're being added, but you
probably know what I mean) from the number of items in the list
currently being used for the slice.
Am I making sense?
Bart.
------------------------------
Date: Sun, 31 Jan 1999 13:27:56 -0500
From: "John T. Jarrett" <jjarrett@ecpi.com>
To: Cim <cim@online.ee>
Subject: Re: simple database
Message-Id: <36B4A0AC.98ECA9F@ecpi.com>
There is a really good five or six part tutorial on writing text-based
Perl databases that helped me walk through sorting and deleting...
http://www.webreview.com
hth,
John
Cim wrote:
> So,
> I have a simple database:
> item1: $type|$description|$name|$email
> item2: $type|$description|$name|$email
> etc.
> this is all in a file.
>
> I need to manipulate this database. Would hashes be the best in this
> case. If yes, then how would i use them.
>
> problem1:
> i need to sort items by $type and then $description. (there are only a
> few types at $type ).
>
> problem2:
> need to search the database and then print an item if $name eq
> $namegiven & $email eq $emailgiven, and if nothing is found print
> "Sorry" or something like that.
------------------------------
Date: Sun, 31 Jan 1999 12:04:50 -0500
From: sara starre <webqueen@bol.net>
Subject: use strict sure isn't very strict
Message-Id: <36B48D32.A2D778C8@bol.net>
After staring at & debugging my perl cgi for about 4 hours, I Finally
noticed a like that had
package:mysub()
insead of
package::mysub();
Is there any context in which package:mysub() would be valid perl, aside
from inside of quotes or something?
Why would "use strict;" not catch this for me? I'm pretty used to my
compiler finding dumb typos like this, so I guess I'm not too adept at
locating them for myself. Maybe strict should be stricter?
Cheers,
S
--
"I'll quit using PERL when they pry my cold, dead fingers off the
mouse.."
-Sara Starre 1998
------------------------------
Date: 31 Jan 1999 18:07:47 GMT
From: neutron@fc.hp.com (Jack Applin)
Subject: Re: use strict sure isn't very strict
Message-Id: <79265j$6f4$1@fcnews.fc.hp.com>
sara starre (webqueen@bol.net) wrote:
> After staring at & debugging my perl cgi for about 4 hours, I Finally
> noticed a like that had
>
> package:mysub()
>
> insead of
>
> package::mysub();
>
> Is there any context in which package:mysub() would be valid perl, aside
> from inside of quotes or something?
It's a label, as in next LABEL or goto LABEL. For example:
foo: print "hi\n";
goto foo;
Perhaps the -w flag should warn about an unused label--it didn't for me
running 5.004.
-Jack Applin
neutron@fc.hp.com
http://www.geocities.com/HotSprings/6789/
------------------------------
Date: 31 Jan 1999 20:13:28 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: sara starre <webqueen@bol.net>
Subject: Re: use strict sure isn't very strict
Message-Id: <m3d83vz25j.fsf@joshua.panix.com>
sara starre <webqueen@bol.net> writes:
> Is there any context in which package:mysub() would be valid perl,
> aside from inside of quotes or something?
Yes indeed. Perl thinks you've specified a LABEL. See perlsyn for
some discussion of labels.
So that line looks like you're trying to call a sub called mysub in
the current package.
> Why would "use strict;" not catch this for me?
Because you were unlucky enough to stumble upon a typo that happens to
make sense under use strict. Ouch.
> I'm pretty used to my compiler finding dumb typos like this, so I
> guess I'm not too adept at locating them for myself.
If you had used the -w switch, that line would have been flagged for
you (unless you actually *have* a sub in the current package with that
name!).
> Maybe strict should be stricter?
If mind-reading is a measure of strictness, then, by all means yes!
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 31 Jan 1999 12:07:56 -0700
From: hudson@swcp.com (Tramm Hudson)
Subject: Re: use strict sure isn't very strict
Message-Id: <7929mc$9s5@boofura.swcp.com>
In article <36B48D32.A2D778C8@bol.net>, sara starre <webqueen@bol.net> wrote:
>Why would "use strict;" not catch this for me? I'm pretty used to my
>compiler finding dumb typos like this, so I guess I'm not too adept at
>locating them for myself. Maybe strict should be stricter?
While your problem arose from an unused label, I have a similar complaint
about use strict -- symbolic references to variables are not allowed, but
symbolic references to functions are sometimes allowed:
#!/usr/bin/perl -w
use strict;
use vars qw($var);
sub foo { print "foo is called: var=$var\n" }
$var = "Good package var"; # Non-symbolic, ok
${var} = "foo"; # Special case -- bareword, ok
${"var"} = "ERRROR!"; # Symbolic ref, not allowed
$var = "foo"; # Restore the value
&{$var}; # Error: Can't use string as a subroutine ref
&{"foo"}; # Error: Can't use string as a subroutine ref
$var = \&{$var}; # What? That is ok?
print "var=$var\n"; # A CODE reference? Ok, I guesss
&$var; # Calls the function foo
$var->(); # Calls the function again
&{\&{$var="foo"}}; # Calls the function again
&{\&{"foo"}}; # Calls the function again
$var = "no_func"; # No such function
$var = \&{$var}; # Still ok -- why?
print "var=$var\n"; # It is a CODE reference? But there is no
# function associated with it.
&$var; # Undefined subroutine &main::no_func called
__END__
So is it acceptable to create a symbolic references to functions while
use strict is turned on? perlref tells us that the construct:
$var = "foo";
&$var;
will call the function foo as in perl 4 and that this uses symbolic
references. In the next paragraph we are told that by enabling use strict
we can avoid this behavoir. perldoc strict tells us that it outlaws
any symbolic references as defined in perlref and that many of
the constructs are run time errors, since we can't detect them
at compile time.
If it is not acceptable to say &{"foo"}, it should not be acceptable
to say &{\&{"foo"}} either. Why does the second work?
I posted to c.l.p.mod with this question on 13 Jan '99 and didn't see
any responses. DejaNews doesn't have any on file, either. So I posted
the entire question again, slightly cleaned up, in this thread on strict
oddities.
(As before This is perl, version 5.004_01 built for i386-linux
and 5.004_04 built for sun4-sunos)
Tramm
--
o hudson@cs.tulane.edu tbhudso@cs.sandia.gov O___|
/|\ http://www.cs.tulane.edu/~hudson/ H 505.266.59.96 /\ \_
<< KC5RNF @ N5YYF.NM.AMPR.ORG W 505.284.24.32 \ \/\_\
0 U \_ |
------------------------------
Date: Sun, 31 Jan 1999 12:24:18 -0500
From: Bruce Hodo <bruceh@interaccess.com>
Subject: Re: Using a variable as a variable name
Message-Id: <36B491C2.BFADD0DC@interaccess.com>
Here's another example of what I'm trying to do:
-Here I have about 70 variables that I get from an SQL DB. Because I use
these names a lot, I want to have an array with the variable names in
it(@javadbfieldnames), and then index the array to "piece together" the
name of the variable I want to set. @fields contains the results of a
SELECT in my sql db.
Here is a snippet:
#Load up variables with current values
foreach (@javadbfieldnames) {
no strict 'refs';
$varname= '$'.$_;
$$varname = $fields[$fieldno];
$fieldno++;
}
What's happening is that I'm not getting the proper value in the
$$varname, so the variables are not getting set. When I try to use them
later, I get uninitialized variable errors. I guess I'm getting confused
in the reference/dereference area.
--
Bruce Hodo - Webmaster, GetAwayNetwork, Inc.
==Providing unique vacation information on the World Wide Web==
For Villas, Resorts, Hotels, Air/Hotel Packages, Charter Airfares
And Now Offering Travel Auctions!
=============== Visit us at http://getawaynet.com ===============
------------------------------
Date: 31 Jan 1999 19:56:28 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: Phraktyl <phraktyl@home.com>
Subject: Re: Using use base...
Message-Id: <m3hft7z2xv.fsf@joshua.panix.com>
Phraktyl <phraktyl@home.com> writes:
> use base Employee;
MORE CLEAR!!!
LESS TYPING!!!
MORE CLEAR!!!
LESS TYPING!!!
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Sun, 31 Jan 1999 19:06:21 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Visual Perl?
Message-Id: <36b7a975.3640813@news.skynet.be>
"D.Taylor" wrote:
> Does anybody out there kow if there is a visual perl for the mac?
I don't know what you expect of a "Visual Perl", but MacPerl has long
been the most "visual" Perl around. It may still be.
Bart.
------------------------------
Date: Sun, 31 Jan 1999 12:04:05 -0500
From: Leon Stepanian <info@purco.qc.ca>
Subject: What text editors are you using for Perl?
Message-Id: <36B48D05.78290335@purco.qc.ca>
Hi;
OK. This may be a dumb question but it is really getting on my nerves.
I have written Perl programs wth various editors such as ED and Wordpad
(in text mode).
But now, when I retrieve an old Perl script and simply do a save without
doing any editing, the file size has grown considerably.
When I view the file with Ztree in DUMP mode, I have noticed that before
each carriage return character (which is symbolized by a shadded square
with a letter "o" inside, there is a "musical note" (can't find this
character) . Especially after the first all important line
"#!/usr/bin/perl". When I send this script back to my ISP and activate
the script from my HTML, I'm getting a Server error. When I send the
original script, it works fine.
So, what is happening is the editor is adding this musical note
character before my end of line character and perl is seeing this as an
illegal character. I simply can't understand why this is happenning.
Is there an editor that is 100% simple character based which does not
add such things to the file, or does anyone have an explanation. I'm
going crazy because I can't edit my older Perl files to update the code.
------------------------------
Date: 31 Jan 1999 19:29:01 GMT
From: hdiwan@diwanh.stu.rpi.edu ()
Subject: Re: What text editors are you using for Perl?
Message-Id: <slrn7b9blb.4c2.hdiwan@diwanh.stu.rpi.edu>
In article <36B48D05.78290335@purco.qc.ca>, Leon Stepanian wrote:
>Is there an editor that is 100% simple character based which does not
>add such things to the file, or does anyone have an explanation. I'm
>going crazy because I can't edit my older Perl files to update the code.
I'm assuming you are under win32. If this is the case, UltraEdit does what you
want, or there are ports of vim and xemacs to the windows platform.
--
Hasan Diwan
------------------------------
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 4791
**************************************