[12754] in Perl-Users-Digest
Perl-Users Digest, Issue: 164 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 16 09:07:26 1999
Date: Fri, 16 Jul 1999 06:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 16 Jul 1999 Volume: 9 Number: 164
Today's topics:
Re: $50 for solution to this perl/mail problem mark@bstar.net
Re: $ENV{} Variable List <sstarre@my-deja.com>
Re: [Q] Can sendmail be used for attachments? <nick.condon@tamesis.com>
Re: Accessing DBM file (Sitaram Chamarty)
Re: C-like #define macros in Perl (Sitaram Chamarty)
Re: DBI - alternate row colors <matt@sergeant.org>
die ? <ianmorty@nortelnetworks.com>
Re: die ? (Michel Dalle)
Re: die ? <c4jgurney@my-deja.com>
Re: die ? <ianmorty@nortelnetworks.com>
Re: die ? <ianmorty@nortelnetworks.com>
Re: die ? <ianmorty@nortelnetworks.com>
Re: die ? (Andreas Fehr)
Re: Garbage Collection Performance <jerbyr@my-deja.com>
Re: How do I find the current line-number while the scr <mike@crusaders.no>
Re: How to disable auto-loading? (Benjamin Franz)
Re: Linux - Apache - Perl (JT)
Re: long explanations wearying (was Re: Top 10 response <mats.pettersson@falukuriren.se>
Re: My Foot Hurts (Michel Dalle)
Re: MYSQL - Help (Jay Flaherty)
Re: Newbie requires help in Perl please <hove@ido.phys.ntnu.no>
Re: Newbie requires help in Perl please arpith@hotmail.com
Re: Old database is erased when I add new information <martin@adoma.se>
Passing data to browser from html <eoan.kerr@gssec.bt.co.uk>
Re: Perl and MS Access DBs <rhrh@hotmail.com>
Re: Perl and MS Access DBs (Michel Dalle)
Printing to array <eoan.kerr@gssec.bt.co.uk>
Re: Printing to array <mike@crusaders.no>
Re: Printing to array <eoan.kerr@gssec.bt.co.uk>
Remove leading zeros from a string <skerr@ryder.co.uk>
Resolution <scott@salmon.ltd.uk>
Re: set up hash using variables not yet defined (Michel Dalle)
Re: Simple Question: How do I call a subroutine in a di <tchrist@mox.perl.com>
Re: TIe::IxHash <Joe.Rocklin@sdrc.com>
Re: Tiny error in perlfaq5 (John Borwick)
Translation problem (Jorg Schumacher)
Re: using slices in a hash of a hash <sstarre@my-deja.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 16 Jul 1999 12:01:37 GMT
From: mark@bstar.net
Subject: Re: $50 for solution to this perl/mail problem
Message-Id: <7mn6us$da0$1@nnrp1.deja.com>
Try this:
### START
$mymessage = "Hi! How are you?";
use MIME::Lite;
$msg = new MIME::Lite
From =>'me@myhost.com',
To =>'your@name.com',
Cc =>'some@other.com, some@more.com',
Subject =>'Attachment Message',
Type =>'text/plain';
attach $msg
Type =>'TEXT',
Data =>"$mymessage";
attach $msg
Type =>'plain/text',
Data =>"$mymessage";
$msg->send;
###END
In article <7mma76$43a$1@nnrp1.deja.com>,
newsmf@bigfoot.com wrote:
> Hi -
> whoever sends me a solution to this first, gets a $50 Citibank check
in
> the mail. Thanks a lot for your help.
>
> $text contains the html of a web page.
>
> I need a perl rountine that sends $text
>
> a) viewable within an email or
> b) as an attachment to an email.
>
> both options should be available.
>
> I've already written a routine myself (see below), but the main
problem
> seems to be that Sendmail truncates lines that are two long. Where
those
> breaks fall into Javascript, pages causes display errors for the
people
> who receive them as email.
>
> In case you want to refer me to MIME:LITE, please write out the whole
> routine using MIME:LITE. Knowing this lead already, I've been too
clumsy
> getting this to work.
>
> As always, I'll post the winner's name to this group.
>
> Please send your solutions to newsmf@bigfootNOSPAM.com beside posting
> them here.
>
> Cheers,
>
> Marc.
>
> my routine:
>
> $text = $_[0];
> #@file = split (/\n/,$text);
>
> @file = unpack "a25 a25" x int(length($text)/25), $text;
>
> #$SENDMAIL='/bin/sendmail'; # This is the location of the
> $SENDMAIL='/usr/sbin/sendmail'; # This is the location of the
>
> # sendmail program on your system
>
> if ($htmldelivery ne "ON") {
>
> open (MAIL, "| $SENDMAIL $email");
>
> print MAIL "Reply-to: emailservice\@blabla.com\n";
> print MAIL "From: emailservice\@blabla.com\n";
> print MAIL "To: $email\n";
> print MAIL "Content-Type: text/html\n";
> print MAIL "Subject: qb: $title\n\n";
> print MAIL "<html><head><title>$title</title></head>";
> print MAIL "$text";
> print MAIL "</html>";
> close MAIL;
>
> } else
>
> {
>
> $attachmentname = "qb".$timestamp.".html";
> $content_type = "text/plain; charset=\"us-ascii\"";
>
> # open (MAIL, "| $SENDMAIL $email");
>
> open (MAIL, "| $SENDMAIL $email") || die ("$0: Fatal Error! Cannot
> open sendmail:: $!\n");
>
> print MAIL "Reply-to : emailservice\@blabla.com\n" ;
> print MAIL "From: emailservice\@blabla.com\n";
> print MAIL "To: $email\n";
> print MAIL "Subject : qb: $title\n" ;
> print MAIL "MIME-Version : 1.0\n" ;
> print MAIL
> "Content-Type : multipart/mixed; "
> ."boundary=\"======================_888227034==_\"\n\n" ;
> print MAIL "This is a multi-part message in MIME format.\n" ;
> print MAIL "--======================_888227034==_\n" ;
> print MAIL "Content-Type : text/plain; charset=us-ascii" ;
> print MAIL "\n\n" ;
> print MAIL "Your requested Page \"$title\"\n\n\n\n" ;
> print MAIL "--======================_888227034==_\n" ;
> print MAIL "Content-Type : $content_type\n" ;
> print MAIL "Content-Disposition: attachment;".
> "filename=\"$attachmentname\"\n\n" ;
>
> print MAIL "<html><head><title>$title</title></head>" ;
> print MAIL "$text" ;
> print MAIL "</html>" ;
> print MAIL "\n\n\n\n" ;
> print MAIL "--======================_888227034==_--\n\n" ;
>
> close MAIL;
>
> } # end else
>
> }
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 16 Jul 1999 11:14:34 GMT
From: S Starre <sstarre@my-deja.com>
Subject: Re: $ENV{} Variable List
Message-Id: <7mn46l$cdc$1@nnrp1.deja.com>
This is really not a Perl question but a CGI question instead. Any
number of sites and books will iterate the ENV values, or better yet,
something like:
print #content line
print "<HTML><BODY\n";
foreach (keys %ENV)
{print "$_ => $ENV($_}<br>\n"}
print "<?BODY></HTML>";
will show you your particular keys & values.
Happy Perling.
-S
In article <MPG.11f99db669e7d3c49896c7@loomi.telstra.net>,
bshort@n0spam.shortboy.dhs.org (Ben Short) wrote:
> Hi,
> I'm looking for the list of expessions of $ENV{} that can be used for
> gaining data about remote hosts.
>
> I I realise there is the %ENV hash, which contains local info, but I
need
> remote information like $ENV{'REMOTE_ADDR'}. I intend to make a
> statistical sort of CGI script to gain some demographics of the people
> acessing my site.
>
> Is there a list of what expressions can be used with the $ENV{}
floating
> around somewhere. If so, can someone drop me an email (remove the
n0spam)
> a list, or URL?
>
> Thanks
> Ben
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Ben Short http://www.shortboy.dhs.org
> Shortboy Productions mailto:bshort@n0spam.shortboy.dhs.org
>
> *Remove n0spam to email me*
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
--
Proud Member of the Working Minority in the USA
-S Starre 1999
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 16 Jul 1999 12:59:33 +0100
From: Nick Condon <nick.condon@tamesis.com>
Subject: Re: [Q] Can sendmail be used for attachments?
Message-Id: <378F1EA4.7E659AEE@tamesis.com>
Jessie Hernandez wrote:
> I know how to send an e-mail without an attachment with sendmail(easy!),
> but how can I send an attachment? Specifically, a page of mine has an input
> of type "file". So I'm actually going to ask two questions:
>
> How can i get the file handle of the file that the user entered in an HTML
> form?
>
> How can I send an e-mail with this file attachment?
>
> Any help will be greatly appreciated!
Sendmail doesn't understand attachments.
You need to uuencode (or MIME encode) your file, that will convert it ot a
stream of 'safe' characters, (i.e. no special characters, just the
alphanumerics). You then feed this character stream into Sendmail as though it
were text.
You need to do some mucking about with headers, so that your recipient's email
client recognizes the attachment.
--
Nick Condon
------------------------------
Date: Fri, 16 Jul 1999 10:40:04 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Accessing DBM file
Message-Id: <slrn7osctq.s4b.sitaram@diac.com>
On Thu, 15 Jul 1999 07:09:14 +0000, Paul Lim <pylim@ecr.mu.oz.au>
wrote:
> use DB_File;
[and]
>The passwd DB is an NDBM (i assume) database created using the
NDBM_File != DB_File
"perldoc AnyDBM_File" and use that instead.
>"user_manage.cgi" script, and is contained in the usual two files:
Or look inside that script and see what it "use"s. (Assuming it's
Perl).
------------------------------
Date: Fri, 16 Jul 1999 10:40:02 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: C-like #define macros in Perl
Message-Id: <slrn7os7i0.s43.sitaram@diac.com>
On 15 Jul 1999 05:12:43 -0500, Abigail <abigail@delanet.com> wrote:
>The system admin of my machine has declared that access to clp.mod is
>forbidden.
You mean there are people who actually have some power over you,
too? :-)
Just kidding! Jokes aside, why? This makes me immensely curious.
I mean, it's not like banning some of the more salacious groups in
the alt.* hierarchy!
Sitaram
...half suspects he may be playing "straight man" in some bigger
joke he didn't get!
------------------------------
Date: Fri, 16 Jul 1999 13:53:40 +0100
From: Matt Sergeant <matt@sergeant.org>
Subject: Re: DBI - alternate row colors
Message-Id: <378F2B53.D000DC91@sergeant.org>
brian d foy wrote:
>
> $index++;
> $index = $index % $#colors;
> }
<pedantic>
Why have separate lines?
$index = ++$index % $#colors;
</pedantic>
BTW: Anyone know why you can't do:
++$index %= $#colors;
???
It tells me I can't modify preincrement in modulus. Even scoping it with
brackets doesn't work. Seems to me that it should do the same as the
code above it.
Matt.
------------------------------
Date: Fri, 16 Jul 1999 11:41:15 +0100
From: Ian Mortimer <ianmorty@nortelnetworks.com>
Subject: die ?
Message-Id: <378F0C4A.F96BDF92@nortelnetworks.com>
Hi all,
Bit of a problem with die -
I am running a script that reads in data from a file and spits out the
selected data to the browser.
I open the file using -
open (CHANGED ,">$copy_file") || die "Couldn't open $copy_file \n";
What happens when there is a problem with that file ? - all I get is the
html stopping at the point of the open() line. Does the die() command
only output the error message when perl is executed from the command
line ?
TIA,
Ian
PS: Yes Abigail, I *have* read the FAQ !
------------------------------
Date: Fri, 16 Jul 1999 12:03:22 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: die ?
Message-Id: <7mn75t$idn$1@news.mch.sbs.de>
In article <378F0C4A.F96BDF92@nortelnetworks.com>, Ian Mortimer <ianmorty@nortelnetworks.com> wrote:
[snip]
>What happens when there is a problem with that file ? - all I get is the
>html stopping at the point of the open() line. Does the die() command
>only output the error message when perl is executed from the command
>line ?
[snip]
>PS: Yes Abigail, I *have* read the FAQ !
Hm, excuse me, but did you get to Perl FAQ 9 ?
Try 'perldoc -q CGI' for instance.
Just checking :-)
Michel.
--
aWebVisit - extracts visitor information from WWW logfiles and shows
the top entry, transit, exit and 'hit&run' pages, the links followed
inside your website, the time spent per page, the visit duration etc.
For more details, see http://gallery.uunet.be/Michel.Dalle/awv.html
------------------------------
Date: Fri, 16 Jul 1999 12:01:57 GMT
From: Jeremy Gurney <c4jgurney@my-deja.com>
Subject: Re: die ?
Message-Id: <7mn6vg$da4$1@nnrp1.deja.com>
In article <378F0C4A.F96BDF92@nortelnetworks.com>,
Ian Mortimer <ianmorty@nortelnetworks.com> wrote:
> Hi all,
>
> Bit of a problem with die -
>
<SNIP>
> What happens when there is a problem with that file ? - all I get is
the
> html stopping at the point of the open() line. Does the die() command
> only output the error message when perl is executed from the command
> line ?
>
> TIA,
>
> Ian
Check out CGI::Carp for nice cgi friendly warnings.
I usually have the line
use CGI::Carp qw(fatalsToBrowser);
in al my cgi progrsms.
HTH,
Jeremy Gurney
SAS Programmer | Proteus Molecular Design Ltd.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 16 Jul 1999 13:31:17 +0100
From: Ian Mortimer <ianmorty@nortelnetworks.com>
Subject: Re: die ?
Message-Id: <378F2615.51FA16E9@nortelnetworks.com>
Michel Dalle wrote:
>
> In article <378F0C4A.F96BDF92@nortelnetworks.com>, Ian Mortimer <ianmorty@nortelnetworks.com> wrote:
> [snip]
> >What happens when there is a problem with that file ? - all I get is the
> >html stopping at the point of the open() line. Does the die() command
> >only output the error message when perl is executed from the command
> >line ?
> [snip]
> >PS: Yes Abigail, I *have* read the FAQ !
>
> Hm, excuse me, but did you get to Perl FAQ 9 ?
Another quick browse through section 9 (perlfaq9 - Networking
($Revision: 1.13 $) and I still can't see a mention of die(). Am I
looking at the right FAQ ?
> Try 'perldoc -q CGI' for instance.
What does the -q switch do ? I can't seem to get it to work (HP unix
with perl 5.004)
> Just checking :-)
>
> Michel.
>
> --
> aWebVisit - extracts visitor information from WWW logfiles and shows
> the top entry, transit, exit and 'hit&run' pages, the links followed
> inside your website, the time spent per page, the visit duration etc.
> For more details, see http://gallery.uunet.be/Michel.Dalle/awv.html
------------------------------
Date: Fri, 16 Jul 1999 13:35:26 +0100
From: Ian Mortimer <ianmorty@nortelnetworks.com>
Subject: Re: die ?
Message-Id: <378F270E.6625F450@nortelnetworks.com>
Ian Mortimer wrote:
>
> Michel Dalle wrote:
> >
> > In article <378F0C4A.F96BDF92@nortelnetworks.com>, Ian Mortimer <ianmorty@nortelnetworks.com> wrote:
> > [snip]
> > >What happens when there is a problem with that file ? - all I get is the
> > >html stopping at the point of the open() line. Does the die() command
> > >only output the error message when perl is executed from the command
> > >line ?
> > [snip]
> > >PS: Yes Abigail, I *have* read the FAQ !
> >
> > Hm, excuse me, but did you get to Perl FAQ 9 ?
>
> Another quick browse through section 9 (perlfaq9 - Networking
> ($Revision: 1.13 $) and I still can't see a mention of die(). Am I
> looking at the right FAQ ?
Ooooh ! - I am reading the wrong FAQ (well not a complete FAQ anyway)
>
> > Try 'perldoc -q CGI' for instance.
>
> What does the -q switch do ? I can't seem to get it to work (HP unix
> with perl 5.004)
>
>
> > Just checking :-)
> >
> > Michel.
> >
> > --
> > aWebVisit - extracts visitor information from WWW logfiles and shows
> > the top entry, transit, exit and 'hit&run' pages, the links followed
> > inside your website, the time spent per page, the visit duration etc.
> > For more details, see http://gallery.uunet.be/Michel.Dalle/awv.html
------------------------------
Date: Fri, 16 Jul 1999 13:40:13 +0100
From: Ian Mortimer <ianmorty@nortelnetworks.com>
Subject: Re: die ?
Message-Id: <378F282D.BF5717B2@nortelnetworks.com>
Thats fantastic - tells me the line number and everything !
Cheers,
Ian.
(It would have helped if I was reading an up-to-date FAQ !)
Jeremy Gurney wrote:
>
> In article <378F0C4A.F96BDF92@nortelnetworks.com>,
> Ian Mortimer <ianmorty@nortelnetworks.com> wrote:
> > Hi all,
> >
> > Bit of a problem with die -
> >
> <SNIP>
> > What happens when there is a problem with that file ? - all I get is
> the
> > html stopping at the point of the open() line. Does the die() command
> > only output the error message when perl is executed from the command
> > line ?
> >
> > TIA,
> >
> > Ian
>
> Check out CGI::Carp for nice cgi friendly warnings.
>
> I usually have the line
> use CGI::Carp qw(fatalsToBrowser);
> in al my cgi progrsms.
>
> HTH,
>
> Jeremy Gurney
> SAS Programmer | Proteus Molecular Design Ltd.
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
------------------------------
Date: Fri, 16 Jul 1999 12:54:35 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: die ?
Message-Id: <378f2ae1.27172471@news.uniplus.ch>
On Fri, 16 Jul 1999 11:41:15 +0100, Ian Mortimer
<ianmorty@nortelnetworks.com> wrote:
>
>Bit of a problem with die -
So do I. No success yet :)
>
>PS: Yes Abigail, I *have* read the FAQ !
Did you read the 2nd line of the documentation?
Andreas
------------------------------
Date: Fri, 16 Jul 1999 12:41:00 GMT
From: Jeremy Purdy <jerbyr@my-deja.com>
Subject: Re: Garbage Collection Performance
Message-Id: <7mn98q$e3v$1@nnrp1.deja.com>
In article <19990715214442.B2302@lion.plab.ku.dk>,
Anton Berezin <tobez@plab.ku.dk> wrote:
> On Thu, Jul 15, 1999 at 02:45:07PM +0000, Jeremy Purdy wrote:
Sorry, typo. I meant to say 100+ M. I checked it out using the top
utility and the memory allocation maxed out at 146M.
I am trying to find a way to reduce the amount of memory that is used
without sacrificing performance, maybe that will help.
> You see, if you want some help with your problem in this newsgroup,
you
> should really tell us more. The current description is too vague.
> Probably the best thing you can do is to post here a distilled version
> of your script --- just a bare minimum that still has the problem you
> described. The details about your environment would be helpful, as
> well: an OS, its version, the version of Perl, does Perl use its own
> malloc, or it uses the system malloc and so on.
>
The application uses the latest version of PERL available from CPAN,
5.xxx with sybperl installed. It is running on a HP-UX system version
10.20, and I believe that PERL uses its own malloc. I cannot post any
of the code here for security reasons, so if no one has encountered a
similar problem I guess I will be on my own again.
> Do you have any END {} blocks in your app? Any DESTROY {} blocks?
Any
> heavy XS modules?
No, No, and No. The script reads a couple of files, sends the data
through bcp to a Sybase database. Performs many SQL commands to get
data from other tables and calculate new data, bringing the data back
into PERL when it is faster to do the data formatting that way and sends
it back to the database. Eventually (in this case after 14 min) the
data is completely brought back into PERL space and is output into seven
different files for further analysis by other applications. There is
nothing particularly fancy about this except that the program acts as a
specialized interpreter to make the SQL commands executed more easily
alterable, (i.e. they reside in a 'configuration' file).
I have never encountered anything like this either, which is why I
posted my question here, to see if anyone had. Obviously no one has, so
thank you for at least responding to my posting.
--
Jeremy Purdy
MRJ Technology Solutions
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 16 Jul 1999 11:37:33 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: How do I find the current line-number while the script is running?
Message-Id: <q3Dj3.101$nz6.349@news1.online.no>
Trond Michelsen <mike@crusaders.no> wrote in message
news:NdCj3.67$nz6.124@news1.online.no...
> I have a small problem. I have to make a small wrapper for the die()
> function, so that instead of just dying, the program closes a database,
> writes to a logfile, then removes a lockfile and finally just dies.
Just typical isn't it... I've obviously looked through all the wring parts
of the docs. Anyway - the first thing I read after posting my question is
chapter 10.4 of the Perl Cookbook.
Well, well - at least I know how to use the caller() function now :-)
--
Trond Michelsen
------------------------------
Date: Fri, 16 Jul 1999 11:01:03 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: How to disable auto-loading?
Message-Id: <PhEj3.1536$hm1.129831@typhoon-sf.snfc21.pbi.net>
In article <378EF02B.75167387@bivio.com>,
Martin Lichtin <lichtin@bivio.com> wrote:
>Hi,
>
>I'd like to avoid transient state in a Perl application and
>therefore disable the built-in auto-load feature.
>Is there any way to build Perl without that feature?
I'm failing to comprehend *why* you would want such a thing. Other
than wanting to provoke blowups in standard modules - a number of
which use AUTOLOAD to improve runtime performance. It is somewhat
akin to saying "I'd like to avoid inheritance. Is there anyway I
can build (name favorite OO language) without that feature?" It
tends to break things to chop core functionality out of a language
in general. And even if you *did* manage to turn off AUTOLOAD,
you would still have 'do', 'require' and 'eval' to deal with.
--
Benjamin Franz
------------------------------
Date: Fri, 16 Jul 1999 11:40:44 GMT
From: jett1not@homedot.com (JT)
Subject: Re: Linux - Apache - Perl
Message-Id: <37921821.72972188@24.2.0.71>
On Thu, 15 Jul 1999 13:11:43 -0400, tadmc@metronet.com (Tad McClellan)
wrote:
>JT (jett1not@homedot.com) wrote:
>
>: I realize it's off-topic, but it's a simple question -
>: what's the big deal?
>
>
> Well if we are not going to respect topics, lets have a
> single newsgroup with hundreds of thousands of articles
> each day.
>
> Then everybody would know where to go, but
> they couldn't find anything when they got there.
>
> You are not alone. There are thousands of people available for
> making off-topic postings. Let's not encourage them to jump in.
I agree with you, but if it's a question that can be easily answered
in a one-liner, what's the huge deal? The question was answered and
the guy apologied and let it die. It's the same amount of "wasted"
bandwidth as a "RTFM" reply takes anyhow. If anyone's gonna bother
replying, why not throw in the answer along with "Read the FAQ, or
RTFM". That way the poster would learn 2 things.
I hate "stupid" questions as much as everyone else... Until I have to
ask one ;)
-JT
Remove the "not" and delete the "dot" to reply
jett1not@homedot.com
------------------------------
Date: Fri, 16 Jul 1999 12:46:28 +0200
From: Mats Pettersson <mats.pettersson@falukuriren.se>
Subject: Re: long explanations wearying (was Re: Top 10 responses)
Message-Id: <378F0D84.8754CC6C@falukuriren.se>
Eric The Read wrote:
>
> Mats Pettersson <mats.pettersson@falukuriren.se> writes:
> > Why not split perl.misc to three groups like:
>
> Isn't this a FAQ? And if not, should we make it one, given that the
> people who ask it are generally the people who don't read the FAQs
> anyway?
It really didn't occur to me that this would be a FAQ.
> To answer your question Mats, it's because many newbies will never use
> .newbie, because they want the real answers from the folks in
> .professional.
Is this a proven fact?
I see a lot of subjectlines sayin "newbiee question" around here. They
seem to actually know where the question belongs.
> There's already a newsgroup for CGI programmers--
> comp.infosystems.www.authoring.cgi. If there's so much Perl traffic
> there that you think it deserves its own newgroup...
Not that much traffic at all right now, but i've seen questions asked
there get the answer "your should ask this in perl, this is not a cgi
question" and here it's the other way around. There obviously seems that
cgi and perl are close connected in peoples mind and many use perl to
write cgi apps.
>..., then feel free to take on its creation yourself.
I might would if i could.
> In any event, the issues relevant to CGI are
> relevant no matter what language you're writing your CGI programs in, and
> it doens't seem fair to me to restrict discussion only to those using
> Perl.
Technically you are right, but as i said many cgi scripts seems to be
written in perl and sometimes it is annoying asking questions in
two/three different newsgroups when the answers is used in the same app
(if you understand what i mean).
> What this leaves us with, then, is the same situation we're in now--
> clp.professional takes the place of .misc, .newbie is full of errors (if
> it's full of anything at all), and .cgi will be essentially redundant
> with ciwa.cgi. What good, exactly, do you see coming of this?
Well, if it's like you say in your last paragraph; nothing. Otherwise i
think it would help things out (get more organised), and lower the
bloodpressiure of some people. :)
It was just a suggestion, i wont say anything about it nomore. Promise!
Mats
------------------------------
Date: Fri, 16 Jul 1999 11:08:45 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: My Foot Hurts
Message-Id: <7mn3vg$fvg$1@news.mch.sbs.de>
In article <hUVx3CAFWdj3QwBO@shambolica.freeserve.co.uk>, Don Coyote <Coyote@shambolica.freeserve.co.uk> wrote:
>
>Hi,
>
>My left foot hurts, I've read the FAQ and tried switches -t & -w but
>nothing seems to work.
>
>BTW, I did buy a cheap pair of shoes a few days ago and have done a lot
>of walking in them but I can't see how that relates to Perl?
Have you tried riding on a Camel ? That might help alleviate (sp?) your foot
problem...
(BTW, Perl is also supposed to run on horses, but I haven't seen it yet.)
Happy running,
Michel.
------------------------------
Date: 16 Jul 1999 12:26:22 GMT
From: fty@hickory.engr.utk.edu (Jay Flaherty)
Subject: Re: MYSQL - Help
Message-Id: <7mn8de$k2u$1@gaia.ns.utk.edu>
Abigail (abigail@delanet.com) wrote:
:
: That's not very SQL like. You're stuck in limited sequencial world.
: The S in SQL stands for _Set_. Think setlike. SQL is a very powerful,
:
I thought the "S" in SQL stands for Structured?
--
**********************************************************************
Jay Flaherty fty@utk.edu
"Once in awhile you get shown the light, in the strangest of places if
you look at it right" - R. Hunter
**********************************************************************
------------------------------
Date: 16 Jul 1999 12:10:07 +0200
From: Joakim Hove <hove@ido.phys.ntnu.no>
Subject: Re: Newbie requires help in Perl please
Message-Id: <k0nvhbknbwg.fsf@ido.phys.ntnu.no>
arpith@hotmail.com writes:
> I would like to know if there is a way of calling the pl program from
> the browser.. So that I can pass values into the pl program through a
> form.
This can be accomplished by using CGI. (Common Gateway Interface - a
protocol for communicating between a browser and the server.) Perl is
much used for CGI purposes, try the module CGI.pm.
HTH - Joakim
--
=== Joakim Hove www.phys.ntnu.no/~hove/ ======================
# Institutt for fysikk (735) 93637 / 352 GF | Skøyensgate 10D #
# N - 7034 Trondheim hove@phys.ntnu.no | N - 7030 Trondheim #
=====================================================================
------------------------------
Date: Fri, 16 Jul 1999 12:51:04 GMT
From: arpith@hotmail.com
Subject: Re: Newbie requires help in Perl please
Message-Id: <7mn9rj$eaf$1@nnrp1.deja.com>
> This can be accomplished by using CGI. (Common Gateway Interface - a
> protocol for communicating between a browser and the server.) Perl is
> much used for CGI purposes, try the module CGI.pm.
>
Opps.. Sorry, I didnt explain myself clearly...
Okay, I want to run the Pl scripts through Dos/Windows, so I am using
Perl Win32. So is there anyway of passing command line paramaters ? Like
perl file.pl?title=asdasdsd&url=http:L///asd/etc
Also, what would be the best way to learn perl ? I don't have access to
unix or any custom cgi web hosting service. Should I install some free
Web server on my computer or install Unix ??
Correct me if I am talking nonsense, 'cause I'm really new to this.. :)
Arpith.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 16 Jul 1999 14:05:49 +0100
From: Martin Quensel <martin@adoma.se>
Subject: Re: Old database is erased when I add new information
Message-Id: <378F2E2D.513296E0@adoma.se>
Perulinks wrote:
[cut...]
> I would challenge you to tell that you your customers that you don't have an
> obligation to sell a code that doesn't work 100% well (that is, some functions
> work perfectly well and some don't). I would challenge you to call them
> "idiots" just because they can't program. I would like to see if they would
> ever buy from you. (why would they come to you in the first place if they know
> how to program?).
[cut...]
I can only say one thing here...Microsoft
Martin Quensel
------------------------------
Date: Fri, 16 Jul 1999 10:24:07 +0100
From: "Eoan Kerr" <eoan.kerr@gssec.bt.co.uk>
Subject: Passing data to browser from html
Message-Id: <7mmtn8$2im@cheetah.gssec.bt.co.uk>
Hello,
I've tried hosting this to the CGI board but to no avail.
I have a script which searches for contacts on a text file and stores the
results in arrays. I then take an html page which I use on my site.
It has lines <!-- Start of Page content and a line <!-- End of Page
content. These are used for additional html to be inserted between them.
I have used perl to send this page without additional html and it displays
perfectly. My problem is when I read the html file in one line at a time,
passing the code to the browser and stop when I get to the start of page
content line. I then pass the html to produce a table and start reading the
file again.
The problem is that the table code replaces the 2nd line of html
<!DOCTYPE etc..........
This means that the table is the first thing displayed on the page rather
than in between the stated lines <!-- Start of page content.
Any Ideas. If you require further info please ask.
Eoan.
------------------------------
Date: Fri, 16 Jul 1999 11:03:27 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: Perl and MS Access DBs
Message-Id: <378F036F.1342F5A4@hotmail.com>
Stephen Aze wrote:
>
> The message <7mlcg5$uu6$1@menelao.polito.it>
> from "Fredi Agolli" <f.agolli@studenti.to.it> contains these words:
>
> > I'm looking for Perl modules which manage MS Access Databases.
> > May you give me some information about this?
>
> If you're going to do it the Microsoft way, you may as well go all
> the way: Forget Perl and do it with Active Server Pages on an NT
> server - ASP's designed to work with Access databases.
Behave ! :-),
Look at Win32::ODBC
DBI and DBD::ODBC modules on CPAN
www.perl.org
Richard H
------------------------------
Date: Fri, 16 Jul 1999 11:41:18 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Perl and MS Access DBs
Message-Id: <7mn5sk$i0g$1@news.mch.sbs.de>
In article <7mlcg5$uu6$1@menelao.polito.it>, "Fredi Agolli" <f.agolli@studenti.to.it> wrote:
>Hi to everybody,
>I'm looking for Perl modules which manage MS Access Databases. May you give
>me some information about this?
As usual, there are many ways to do something in Perl. Here would be my
recommended "search order" :
If you know something about DBI in Perl, get the DBD::ODBC driver from CPAN.
If you know something about ODBC, use WIN32::ODBC.
If you know Access and macros, use WIN32::OLE and access the Microsoft Access
object.
If you know something about ADO, use WIN32::OLE and/or WIN32::ODBC and/or
WIN32::ADO (?).
If you know nothing about databases, learn something about them first :-)
Good luck,
Michel.
------------------------------
Date: Fri, 16 Jul 1999 10:40:01 +0100
From: "Eoan Kerr" <eoan.kerr@gssec.bt.co.uk>
Subject: Printing to array
Message-Id: <7mmul1$3ne@cheetah.gssec.bt.co.uk>
Hello,
Can anyone advise how to change this:
print table ({-border=>undef,-width=>'80%'},
caption(b('Search Results!')),
Tr(\@rows)
);
So that it prints to an array @html.
Thanks.
------------------------------
Date: Fri, 16 Jul 1999 12:09:15 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: Printing to array
Message-Id: <7xDj3.116$nz6.807@news1.online.no>
Eoan Kerr <eoan.kerr@gssec.bt.co.uk> wrote in message
news:7mmul1$3ne@cheetah.gssec.bt.co.uk...
> Hello,
>
> Can anyone advise how to change this:
>
> print table ({-border=>undef,-width=>'80%'},
> caption(b('Search Results!')),
> Tr(\@rows)
> );
>
> So that it prints to an array @html.
How about:
push (@html, table ({-border=>undef,-width=>'80%'},
caption(b('Search Results!')),
Tr(\@rows)));
print @html;
--
Trond Michelsen
------------------------------
Date: Fri, 16 Jul 1999 12:12:05 +0100
From: "Eoan Kerr" <eoan.kerr@gssec.bt.co.uk>
Subject: Re: Printing to array
Message-Id: <7mn41l$a7d@cheetah.gssec.bt.co.uk>
Thanks Trond,
This puts the table in the array but I still get the table printing at the
top of the page even though the array is printed in order. The view source
shows the Table HTML as being on line 3.
I need to know why the html is not being printed in the correct order.
Thanks mate.
------------------------------
Date: Fri, 16 Jul 1999 13:45:45 +0100
From: "Simon Kerr" <skerr@ryder.co.uk>
Subject: Remove leading zeros from a string
Message-Id: <378f29b3.0@nnrp1.news.uk.psi.net>
Hi,
I have a string, such as '00001234'. All I want to do is remove the leading
zeros. The length of the string can vary, so I can't just chop off the
first n characters.
Can anyone help, or point me in the right direction. If it's in perldoc,
then I can't find it!
Thanks in advance,
Simon
------------------------------
Date: Fri, 16 Jul 1999 12:35:22 +0100
From: "Scott Pritchett" <scott@salmon.ltd.uk>
Subject: Resolution
Message-Id: <7mn59s$ote$1@lure.pipex.net>
I have a file data.txt containing a record
$::sp is good
I need to get Perl to resolve this reference, my code which does not work is
:-
#!/usr/bin/perl -w
$::sp="Scott Pritchett";
open(IN,"< data.txt");
while(<IN>)
{
print $_; # prints '$::sp is good' not 'Scott Pritchett is
good'
}
close IN;
# --------------------------------------------------------------------
Any ideas? Apart from substituting each one!
Scott
------------------------------
Date: Fri, 16 Jul 1999 11:49:31 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: set up hash using variables not yet defined
Message-Id: <7mn6bt$i0g$2@news.mch.sbs.de>
In article <378eb4af.13948116@news.bmc.com>, christianarandaOUT@OUTyahoo.com (Christian M. Aranda) wrote:
>I have a hash of hashes which is set up as such:
>
> %reportSyntax = (
[snip]
>The only problem is, when this is set up the counter variables mean
>nothing. When I do the reporting later on, then they actually mean
>something.
>
>Is there a way to combat this problem? One idea I had was to eval
>%reportSyntax before I tried to print. This doesn't seem to work the
>way I expect it would.
Obvious suggestion, I know, but why don't you put this in a subroutine,
and call it whenever the variables DO mean something ?
I assume another part of your program does fetch the correct values
from the system and updates the sysData variables once in a while...
Have fun,
Michel.
------------------------------
Date: 16 Jul 1999 05:41:40 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Simple Question: How do I call a subroutine in a different file?
Message-Id: <378f1a74@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
bart.lateur@skynet.be (Bart Lateur) writes:
:and it is as if the subs are simply pasted into your script.
Well, modulo the unrelated lexical scope.
--tom
--
Imagination is more important than knowledge
--Albert Einstein
------------------------------
Date: Fri, 16 Jul 1999 07:46:48 -0400
From: Joe Rocklin <Joe.Rocklin@sdrc.com>
Subject: Re: TIe::IxHash
Message-Id: <378F1BA8.5245EC1D@sdrc.com>
This is a multi-part message in MIME format.
--------------E25E136414B6607E32250A28
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I think I found my problem. The module I want to use may not be
installed.
Thanks anyway.
--Joe
--------------E25E136414B6607E32250A28
Content-Type: text/x-vcard; charset=us-ascii;
name="Joe.Rocklin.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Joe Rocklin
Content-Disposition: attachment;
filename="Joe.Rocklin.vcf"
begin:vcard
n:Rocklin;Joe
x-mozilla-html:TRUE
org:SDRC
adr:;;;;;;
version:2.1
email;internet:Joe.Rocklin@sdrc.com
x-mozilla-cpt:;1344
fn:Joe Rocklin
end:vcard
--------------E25E136414B6607E32250A28--
------------------------------
Date: Fri, 16 Jul 1999 12:33:50 GMT
From: John.Borwick@sas.com (John Borwick)
Subject: Re: Tiny error in perlfaq5
Message-Id: <379a24d7.87456635@newshost.unx.sas.com>
On 15 Jul 1999 21:42:44 GMT, stanley@skyking.OCE.ORST.EDU (John
Stanley) wrote:
>> rand(1000)||1
>If the problem does not appear with a 48 bit "randbits", would you
>achieve the same thing without doubling the likelyhood of getting 1
>for the answer by doing:
>
> rand(1000) || rand(1000) || rand(1000);
So is there a 1 in 2**randbits chance of hitting zero?
Should rand(1000) || rand(1000) || rand(1000) then make it 1 in
( 2**randbits * 2**randbits * 2**randbits) -> ( 2**(3*randbits) ) ?
It would be nice to somehow iterate as needed until rand is not zero.
Or maybe, in the context of the FAQ where you're actually dividing by
rand, 1 should be added. The cases where you divide by a number less
than one (0.01% of the time) will produce wildly different data from
the other 99.9% of the time.
Or, the block could be eval'd and the user gets a prize if there's a
division by zero.
--
John Borwick
------------------------------
Date: Fri, 16 Jul 1999 12:40:01 +0200
From: Jorg.Schumacher@lettres.unige.ch (Jorg Schumacher)
Subject: Translation problem
Message-Id: <Jorg.Schumacher-1607991240020001@129.194.16.81>
My knowledge of Perl is only rudimenary. My problem is this:
An ordinary English text contains some technical vocabulary out of a
French dictionary FR. This vocabulary should be translated (within the
text) into the corresponding vocabulary out of an Italian dictionary IT.
The two dictionaries exist as a hash.
Thanks for any help
Jorg Schumacher
------------------------------
Date: Fri, 16 Jul 1999 11:48:31 GMT
From: S Starre <sstarre@my-deja.com>
Subject: Re: using slices in a hash of a hash
Message-Id: <7mn66c$d18$1@nnrp1.deja.com>
Hi Rick:
Thanks for the tips.
In article <378DDA43.9F9E5EFF@home.com>,
Rick Delaney <rick.delaney@home.com> wrote:
> [posted & mailed]
>
> S Starre wrote:
> >
> > I'm tyring to use something like:
> >
> > foreach (@main::names2)
> > {@h{$_}{@main::names} = @main::thelist;
>
> If you put
>
> use vars qw/@names @names2 @thelist/;
>
> at the top of your program then you won't have to use the ugly @main::
> syntax. Or you could have just declared them with C<my>.
>
Yes I'm very familiar with my and local. In this case I need a global
that I use across modules, but for this example I should have realized
it uglied it up! Sowwy..
> > and I get:
> >
> > Can't use subscript on hash slice at x.pl line 23, near
"@main::names}"
> >
> > why? @h{$_}{@main::names} is a slice isn't it?
>
> Not quite. You want to take a slice of the hash that $h{$_} is a
> reference to. So simply plug the reference into where the hash name
> would normally go:
>
> @{ $h{$_} }{ @names } = @thelist;
>
Wow I was so close! I'm not entirely sure of why @h{$_} has to be
coerced into being a list however, as it seems that it already is one.
As Larry says Per usually does just what we'd expect it to, but I didn't
expect this coersion was required.
I'm going to try @h{@{$_}} - now that oughtta work too? Fun stuff.
> > Also, can I use opendbm to store a hash of a hash?
>
> perldoc perlfaq4
Roger wilco dude.. Going there now.
Thanks again to Rick & the other replies.
Cheers,
S
>
> How can I store a multidimensional array in a DBM file?
>
> --
> Rick Delaney
> rick.delaney@home.com
>
--
Proud Member of the Working Minority in the USA
-S Starre 1999
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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 V9 Issue 164
*************************************