[10804] in Perl-Users-Digest
Perl-Users Digest, Issue: 4405 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 11 15:07:30 1998
Date: Fri, 11 Dec 98 12:00:22 -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 Fri, 11 Dec 1998 Volume: 8 Number: 4405
Today's topics:
Re: "printing" images to a web page (Sam Curren)
Re: "printing" images to a web page <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: 3 perl cgi questions... <marst96@pitt.edu>
Re: Accessing MS SQL db from unix dturley@pobox.com
Re: blank line <r28629@email.sps.mot.com>
Re: Decent Editor <Frank.Henry@compaq.com.nospam>
Detecting origin country <WeAreUs@Ibm.net>
Re: Detecting origin country (I R A Aggie)
Re: Detecting origin country (Larry Rosler)
Re: Help on s/// !!! <r28629@email.sps.mot.com>
how check string whether numeric value? (Helmut Richter)
Re: How to read a binary file in Perl? How to install m (Greg Ward)
Re: HTML Embedded in Perl (Clay Irving)
Re: HTML Embedded in Perl (I R A Aggie)
mail Attachments in Perl <mmbaddela@hotmail.com>
Re: mail Attachments in Perl (Sam Curren)
Re: MIME-tools-4.121: Makefile.PL = coredump (Greg Ward)
Re: Perl examples (Dr. Cyborn)
Re: Perl tip needed: High CPU Usage wyndo@cxo.com
Re: Perl tip needed: High CPU Usage wyndo@cxo.com
Re: Perl unexec on Solaris dgbialac@wwitch.unl.edu
Re: Sending file attachments in email (Sam Curren)
Re: Sending file attachments in email (David Hawkins)
Re: Strange Module missing problem <marst96@pitt.edu>
Re: Troublesome taint problem (Greg Ward)
Re: VRML Tools for Unix (in Perl?) <dwv@geology.ucsb.edu>
Re: Y2K potential problem in localtime() (Larry Rosler)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 11 Dec 1998 09:10:04 -0800
From: samc@empirewest.com (Sam Curren)
Subject: Re: "printing" images to a web page
Message-Id: <MPG.10daf1c5846100409896b5@news.sonic.net>
use a image/gif content type, then output the imagefile data from the
database directly to STDOUT.
HTH
-Sam
In article <3671480D.20426731@unlinfo.unl.edu>, qcoldiro@unlinfo.unl.edu
says...
> I'm using Perl (duh), Apache, MySQL on RedHat Linux 5.2
>
> I want to store images in my MySQL database "print" them to my web
> pages, but the only way I have figured out how to do this is to write
> the image to a temp file (temp.gif) and the viewing it with the standard
> <img src="temp.gif"> tag. this is not the solution I hoped for.
>
> Does anybody have an idea, or a URL for a FAQ?
>
> Quinn
>
>
>
>
------------------------------
Date: 11 Dec 1998 20:42:59 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: "printing" images to a web page
Message-Id: <834sr2qxbw.fsf@vcpc.univie.ac.at>
Re: "printing" images to a web page, quinn
<qcoldiro@unlinfo.unl.edu> said:
quinn> this is to write the image to a temp file
quinn> (temp.gif) and the viewing it with the
quinn> standard <img src="temp.gif"> tag. this is
quinn> not the solution I hoped for.
Note that the src attribute in the img tag specifies
a source which is expected to output some image-type
stream, usually image/gif or image/jpeg.
There's no reason why this source can't be a CGI
program that directly generates an image/* stream
rather than text/html. In fact, if you output a
multipart stream you can create an animation in an
image cell...
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Fri, 11 Dec 1998 14:43:55 -0500
From: "mark reed" <marst96@pitt.edu>
Subject: Re: 3 perl cgi questions...
Message-Id: <74rti9$94n$1@usenet01.srv.cis.pitt.edu>
>2) Is it possible to check the dimensions of an image
>file (width x height)?
depends on file type, you can search for documentation on gif and jpg files,
and it will tell you where in the
file the width and height are saved, and then you can load in the file, and
look at the width and height, (they will robably be near the beginning of
the file) But i have never loaded in binary files with perl, so cant tell ya
how to grab the correct bytes let alone put them together, as they are
probably stored as 16bits or 32. someone else might :)
Mark
------------------------------
Date: Fri, 11 Dec 1998 18:00:39 GMT
From: dturley@pobox.com
Subject: Re: Accessing MS SQL db from unix
Message-Id: <74rmk5$k3$1@nnrp1.dejanews.com>
In article <74r8kq$jlu$3@zware.space.ru>,
vitus@brass.fe.msk.ru (Victor B Wagner) wrote:
> Jonathan Nicholson (jjn@sanger.ac.uk) wrote:
>
> : Is there a perl module out there that will allow me to access a NT MS SQL
> : database from UNIX.
>
> DBD::Sybase?
DBD::ODBC
David Turley
dturley@pobox.com
http://www.binary.net/dturley/
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 11 Dec 1998 12:39:49 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: niral@corporate.planet.net
Subject: Re: blank line
Message-Id: <367166F5.E0B67703@email.sps.mot.com>
[posted to c.l.p.m and copy emailed]
Niral Trivedi wrote:
>
> do following:
>
> $_ =~ s/^\n$//;
What are you trying to say here? He is asking "how to match a blank
line?". Please make sure you understand the question.
-TK
------------------------------
Date: Fri, 11 Dec 1998 17:18:02 -0000
From: "Frank Henry" <Frank.Henry@compaq.com.nospam>
Subject: Re: Decent Editor
Message-Id: <74rk2v$94k$1@mrnews.mro.dec.com>
>I'd really like to have an editing program for my PERL
scripts that shows
>each subroutine as different pages, or something similar to
that.
>I'm not really sure if I'm explaing that well or not.
Personally, I use UltraEdit extensively and like it a lot,
but there is a shareware editor called ScopeEdit that does
folding. I tried it briefly and found that, although the
folding feature is really great, it did not compensate for
the poor quality of the user interface and help, and the
lack of a "compile" feature. It supports syntax highlighting
but the list of Perl keywords supplied with it could not be
described as comprehensive. I know that's an easy enough
problem to fix but for $79 I would have expected the
developer to have taken care of it. The web site for
ScopeEdit is at:
http://www.loginov.com/english/se/index.html
It hasn't been updated in nearly six months though.
-frank.
---------------------------------------------------
Frank Henry
Information Design group,
Compaq Computer Corporation, Galway, Ireland.
Tel: +353 (91) 75 47 51 / FAX: +353 (91) 75 47 84
E-mail: Frank.Henry@compaq.com.nospam
Disclaimer: whatever I said above is my opinion, not
Compaq's.
To send e-mail, delete "nospam" from address.
------------------------------
Date: Fri, 11 Dec 1998 18:12:02 GMT
From: "Warren Baker" <WeAreUs@Ibm.net>
Subject: Detecting origin country
Message-Id: <Sfdc2.6012$DO1.3195@news.rdc1.bc.wave.home.com>
Hi All!
Using Perl as a CGI scripting language, does anyone know how to detect what
country someone is from -- I don't think any of the environmental vars do
this ($ENV{' '};) do they?
If anyone has any ideas please let me know. . .
Thanks so much and have a great day (or night)!
--Warren
------------------------------
Date: Fri, 11 Dec 1998 14:26:13 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Detecting origin country
Message-Id: <fl_aggie-1112981426130001@aggie.coaps.fsu.edu>
In article <Sfdc2.6012$DO1.3195@news.rdc1.bc.wave.home.com>, "Warren
Baker" <WeAreUs@Ibm.net> wrote:
+ Hi All!
+
+ Using Perl as a CGI scripting language, does anyone know how to detect what
+ country someone is from -- I don't think any of the environmental vars do
+ this ($ENV{' '};) do they?
Short answer: you can't reliably do it.
Long answer: you can't reliably do it.
You may get some milage out of HTTP_ACCEPT_LANGUAGE...but that requires
the user to configure their browser correctly. And how do you determine
_which_ language when several are returned?
James
------------------------------
Date: Fri, 11 Dec 1998 11:46:40 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Detecting origin country
Message-Id: <MPG.10db168085f22a649898bf@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <Sfdc2.6012$DO1.3195@news.rdc1.bc.wave.home.com> on Fri, 11
Dec 1998 18:12:02 GMT, Warren Baker <WeAreUs@Ibm.net> says...
> Using Perl as a CGI scripting language, does anyone know how to detect what
> country someone is from -- I don't think any of the environmental vars do
> this ($ENV{' '};) do they?
No. But this would be the same whatever language is used to implement
the CGI program. Look at the HTTP protocols to see what the available
variables are.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 11 Dec 1998 12:59:40 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: lin@wdg.mot.com
Subject: Re: Help on s/// !!!
Message-Id: <36716B9C.79FFC6BB@email.sps.mot.com>
[posted to c.l.p.m and copy emailed]
Brandon Lin wrote:
>
> Hi all,
>
> This might sound stupid, but it really beats me.
>
> There's a line like the following.
>
> ......blablabla..........<TD><!--increment
> here-->1</TD>........blablabla......
>
> and it should be changed to
>
> ......blablabla..........<TD><!--increment
> here-->2</TD>........blablabla......
>
> I tried
>
> $line=~s/<!--increment here-->(\d+)/<!--increment here-->$1+1/e
> $line=~s/<!--increment here-->(\d+)/sprintf("<!--increment
everyone else seemed to be focusing on fixing you bugs, but here's one
more thing you can try, provided you have Perl 5.005:
$line=~s/(?<=<!--increment here-->)(\d+)/$1+1/e;
The (?<=...) is a zero-width lookbehind expression. I personally feel it
makes the rhs of s/// look cleaner.
-TK
------------------------------
Date: 11 Dec 1998 19:55:41 GMT
From: Helmut.Richter@lrz-muenchen.de (Helmut Richter)
Subject: how check string whether numeric value?
Message-Id: <74rtbt$os5$1@sparcserver.lrz-muenchen.de>
I can easily force a string, say $x, to be evaluated in numeric
context:
$y = $x + 0;
If then $y is nonzero, I can be sure that $x could be interpreted as a
numeric value. If, however, $y is zero, the reason could either be
that $x was a valid representation of the numeric value zero, or that
$x was not a valid representation of any numeric value. How can I
distinguish the two cases?
Helmut Richter
------------------------------
Date: 11 Dec 1998 18:20:35 GMT
From: gward@thrak.cnri.reston.va.us (Greg Ward)
Subject: Re: How to read a binary file in Perl? How to install mod_perl?
Message-Id: <74rnpj$4t7$1@news0-alterdial.uu.net>
William Tang <wtang@flash.net> wrote:
> 1. I have a binary data file needs to be read from Perl. In C I do like
> this:
> File *fp;
> float *stringptr;
> stringptr = (float*)malloc((numberofdata)*sizeof(float));
> fp = fopen("data.dat","rb);
> fread(stringptr,sizeof(float),numberofdata,fp);
> fclose(fp);
> and the data will be found in stringptr
>
> In perl I did not find any similar method to open this binary file. Can
> Perl open a binary file, which will store the float number one by one
> without '\n' ?
Open the file as usual, but be sure to use 'binmode' to turn off newline
translation. (A subtle mistake that Unix bigots like me make all the
time.) The Perl analogue to C's fread() is read; it lets you read in a
chunk of arbitrary data to a Perl string. Then use unpack to convert
that data (presumably binary representations of floating point numbers)
into Perl floating point numbers.
RTFM on read and unpack, and then it's a doddle.
BTW your question about configuring mod_perl belongs somewhere else.
This newsgroup is for Perl questions, not Apache or Apache module
questions.
Greg
--
Greg Ward - software developer gward@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990 x287
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
------------------------------
Date: 11 Dec 1998 13:58:57 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: HTML Embedded in Perl
Message-Id: <74rq1h$66@panix.com>
In <36721f3f.1965064@news.ot.centuryinter.net> nhoop@centuryinter.net (JuNat) writes:
>> I suggest checking the Perl FAQ before posting.
>That's a mean suggestion. Dang! How quickly these "Experts" forget what
>it's like to be a beginner. It's an unfortunate attitude that seem to be
>endemic in the Perl community. I made the mistake of asking for help in the
>wrong place and got roundly flamed for it.
Let's ask you the same damned question day after day after day after day
after day... "FAQ" is an acronym for *Frequently* Asked Question -- Why not
point some hapless newbie in the right direction instead of casting the
Perl newsgroup as a bunch of meanies?...
--
Clay Irving
clay@panix.com
------------------------------
Date: Fri, 11 Dec 1998 14:22:23 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: HTML Embedded in Perl
Message-Id: <fl_aggie-1112981422230001@aggie.coaps.fsu.edu>
In article <36721f3f.1965064@news.ot.centuryinter.net>,
nhoop@centuryinter.net (JuNat) wrote:
+ >Any suggestions?
+ > I suggest checking the Perl FAQ before posting.
+ That's a mean suggestion. Dang!
Its mean to send someone to a document that may contain an answer to their
question?
Not only an answer, but one that's been looked at by literally hundreds,
if not thousands of eyes. Its as close to bug-free as you're gonna get.
As opposed to something someone types in as a one-off, and doesn't even
do a 'perl -c' on...which may or may not be even remotely correct...
+ I made the mistake of asking for help in the wrong place and got
+ roundly flamed for it.
You get more, better answers if you ask in the right place. For instance,
you don't ask the FedEx dude about US Postal regulations...
James
------------------------------
Date: Fri, 11 Dec 1998 09:35:26 -0800
From: Murali <mmbaddela@hotmail.com>
Subject: mail Attachments in Perl
Message-Id: <367157DE.D55229A6@hotmail.com>
Hi,
Is there a way to send mail attachments in Perl...when sending mail..I
tried using Send.pm..it doesn't seem to supprt attachments...any ideas
...?????
Thanks in advance..
Murali
email: mmbaddela@hotmail.com
------------------------------
Date: Fri, 11 Dec 1998 11:35:05 -0800
From: samc@empirewest.com (Sam Curren)
Subject: Re: mail Attachments in Perl
Message-Id: <MPG.10db13bfc17fb1cd9896b8@news.sonic.net>
Use MIME::Lite or MIME::Base64 (for more features)
-Sam
In article <367157DE.D55229A6@hotmail.com>, mmbaddela@hotmail.com says...
> Hi,
> Is there a way to send mail attachments in Perl...when sending mail..I
> tried using Send.pm..it doesn't seem to supprt attachments...any ideas
> ...?????
>
> Thanks in advance..
> Murali
> email: mmbaddela@hotmail.com
>
>
------------------------------
Date: 11 Dec 1998 18:30:10 GMT
From: gward@thrak.cnri.reston.va.us (Greg Ward)
Subject: Re: MIME-tools-4.121: Makefile.PL = coredump (HPUX 10.10)
Message-Id: <74robi$4t7$2@news0-alterdial.uu.net>
Paul de Repentigny <pdr@humeur.com> wrote:
> When I try to compile MIME-tools-4.121, under HPUX 10.10, all I get is a
> 2373084 bytes coredump. I have perl version 5.004_04 built for PA-RISC1.1
> built with gcc 2.7.2.3.
>
> How can I fix this? Any idea anyone?
>
> # perl Makefile.PL
> Checking if your kit is complete...
> Looks good
> Bus error(coredump)
> #
If Perl is dumping core when no XS modules are loaded, that's almost
certainly a Perl bug. (Could be an OS bug or flaky hardware, if this
isn't your lucky day.)
First, you should try upgrading to 5.005 -- it might be a bug in 5.004
that has been fixed.
If the bug is still present in 5.005, you should report it using the
'perlbug' script. You'll make life easier for the people who have to
dissect the bug if you include a stack backtrace obtained by running a
debugger on your perl binary and the coredump. If you're a *really*
nice person, you'll try rebuilding Perl with debugging on and getting a
better stacktrace, and possibly running perl -dXXX (for appropriate
values of XXX).
Greg
--
Greg Ward - software developer gward@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990 x287
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
------------------------------
Date: Fri, 11 Dec 1998 18:03:23 GMT
From: ashton@netcom.com (Dr. Cyborn)
Subject: Re: Perl examples
Message-Id: <ashtonF3tBHn.82M@netcom.com>
>Where can I found Perl Examples?
ftp://ftp.ora.com/published/oreilly/perl/
Saves yer from having to type like a camel ...
------------------------------
Date: Fri, 11 Dec 1998 18:40:51 GMT
From: wyndo@cxo.com
Subject: Re: Perl tip needed: High CPU Usage
Message-Id: <74rovi$2q1$1@nnrp1.dejanews.com>
> It may seem like a Perl question, but here's a non-Perl answer: % of CPU
> used means nothing. The unix scheduler will deal small timeslices to
> each running process that is able to run. If it's taking a *really
> long* time to run, or eating up *lots* of memory, then you may
> want to change the code.
>
> Running close to 100% of the CPU time just means your program
> isn't IO-bound.
Ah, well it's not eating up much memory I think, and it's only happening
during the Perl compile time before the program actually begins to execute.
The reason we suspected the 99.9% CPU usage to be a problem is because when
this happens, the entire system becomes sluggishly slow, and when 2, 3, or 4
programs all pop up with 99.9% CPU usage, the system is pretty much frozen
for a few minutes. I've been able to glimpse the CPU usage during the life of
the "perl myprog.cgi" command. It's 99.9% for the first few brief moments as
it's "compiling", then the moment it actually begins to run, it appears to
drop way down to like 4% or so.
Could this indicate a server setup problem instead? Maybe it's *not* a Perl
issue at all. I'm sure I could optimize my code, but it's not he code per se
causing the problem, but the size of the code causing a longer compile time in
Perl...
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 11 Dec 1998 18:47:53 GMT
From: wyndo@cxo.com
Subject: Re: Perl tip needed: High CPU Usage
Message-Id: <74rpco$37f$1@nnrp1.dejanews.com>
> It may seem like a Perl question, but here's a non-Perl answer: % of CPU
> used means nothing. The unix scheduler will deal small timeslices to
> each running process that is able to run. If it's taking a *really
> long* time to run, or eating up *lots* of memory, then you may
> want to change the code.
>
> Running close to 100% of the CPU time just means your program
> isn't IO-bound.
One more question... my code isn't taking very long to run (it's pretty fast,
half a second or so in most cases), and it doesn't seem to be eating up
memory. The speed/CPU usage is all in the "before-it-runs" portion of things,
while Perl is "compiling" it I believe. This makes me think my code is ok,
it's just taking a long time to compile. I had tested this with a simple
program (1800 lines, but no FILE I/O, no system calls, nothing at all) and it
still had that big spike during compile time before the program actually
begins to run. This is sounding like a server setup problem instead.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 11 Dec 1998 16:56:51 GMT
From: dgbialac@wwitch.unl.edu
Subject: Re: Perl unexec on Solaris
Message-Id: <74rish$sut$1@nnrp1.dejanews.com>
In article <74pa21$ulp$1@nnrp1.dejanews.com>,
dgbialac@wwitch.unl.edu wrote:
> I got this to work for the most part, but I seem to be running into the
> following quirks (I'm using 5.003 due to the standards at our organization):
>
> First, I noticed that unexec is now void, and perl checks for a return value
> (this is the case with the elf version anyway, I haven't looked into the a.out
> verion). I patched perl to eliminate the meaningless warning message this
> creates (perl.c:1262):
> void
> my_unexec()
> {
> #ifdef UNEXEC
> int status = 0;
> extern int etext;
>
> sprintf (buf, "%s.perldump", origfilename);
> sprintf (tokenbuf, "%s/perl", BIN);
>
> /* Unexec no longer returns a value */ unexec(buf, tokenbuf, &etext,
> sbrk(0), 0); /* if (status) fprintf(stderr, "unexec of %s into %s failed!
> (%d)\n", tokenbuf, buf, st atus); */ exit(status); #else # ifdef VMS #
> include <lib$routines.h> lib$signal(SS$_DEBUG); /* ssdef.h #included from
> vmsish.h */ #else ABORT(); /* for use with undump */ #endif #endif }
>
> For a little more efficiency, status can be removed all together and
> exit(status) can be changed to exit(0), but the compiler should be smart
> enough to do that already ;).
>
> Next Quirk:
> It seems that certain compiled perl programs will core dump if some statement
> (any will do) is not executed prior to the first "use" statement. Anyone else
> encountered this?
>
Answering my own question, I solved this by doing two things: Using the
Solaris malloc rather than Perl's and using cc rather than gcc (dynodump was
the hint on this).
> And finally, is there any way to get the executables to resume where they were
> left off at when a "dump" is called? This could be useful for having a preset
> environment with standard code pre-run, variables pre-initialized, etc.
>
Again answering my own question, it's in the dump info in Camel.
Also, my appologies to the group for posting this twice: the news server that
I was using prior (inetnebr) went down while I was posting, and I didn't
think the article posted (especially with tin hanging).
David Bialac
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 11 Dec 1998 09:07:49 -0800
From: samc@empirewest.com (Sam Curren)
Subject: Re: Sending file attachments in email
Message-Id: <MPG.10daf13ff75cbdac9896b4@news.sonic.net>
Use MIME:Lite for simple file attachment operations.
Avoid re-inventing the wheel. Use Perl Modules.
(Sounds like a bumper sticker. : )
-Sam
In article <36713E02.FEA8552A@nabu.isg.mot.com>, ldc023@nabu.isg.mot.com
says...
> Hi
>
> I was just wondering if anyone knows how to send a word document
> attachment in an email. I can send text document. However, when I try
> to send a word document as an attachment, a zero size file is sent
> through the mail. Below is a sample code if anyone has anyidea on what
> I might be doing wrong.
>
> Thanks
>
>
>
> #!/usr/local/bin/perl
>
> $updaterid="user\@email.com";
> $boundary = "------------7B9B$$413F";
> $filename="test.doc";
>
> open(EMAIL,"|/usr/lib/sendmail -t") || die "unable to send mail: $!\n";
>
> print EMAIL "To: $updaterid\n";
> print EMAIL "cc: $updaterid\n";
> print EMAIL "Error-To: $updaterid\n";
> print EMAIL "Reply-To: $updaterid\n";
> print EMAIL "Return-Path: $updaterid\n";
> print EMAIL "From: Attachment mail\n";
> print EMAIL "Subject: Test to send word document as attachment email\n";
>
> print EMAIL "X-Mailer: " . $ENV{'SERVER_SOFTWARE'} . " via script '" .
> ${Prog} . "'\n";
> print EMAIL "MIME-Version: 1.0\n";
> print EMAIL "Content-Type: multipart/mixed; boundary=\"" . $boundary .
> "\"\n";
> print EMAIL "\n";
> print EMAIL "This is a multi-part message in MIME format.\n";
> print EMAIL "\n--$boundary\n";
> print EMAIL "Content-Type: text/plain; charset=us-ascii\n";
> print EMAIL "Content-Transfer-Encoding: 7bit\n";
> print EMAIL "Content-Disposition: inline\n\n";
> print EMAIL "Test to send word document as attachment email\n";
> print EMAIL "\n";
> print EMAIL "\n--$boundary\n";
> print EMAIL "Content-Type: application/msword; type=us-ascii;
> name=\"${filename}\"\n";
> print EMAIL "Content-Transfer-Encoding: base64\n";
> print EMAIL "Content-Disposition: attachment,
> filename=\"${filename}\"\n\n";
> while ($bytesread=read("/usr/tmp/ERN.doc", $buffer, 1024)) {
> print EMAIL "$buffer";
> }
------------------------------
Date: 11 Dec 1998 10:21:35 -0800
From: dhawk@best.com (David Hawkins)
Subject: Re: Sending file attachments in email
Message-Id: <74rnrf$kr3$1@shell3.ba.best.com>
In article <36713E02.FEA8552A@nabu.isg.mot.com>,
David Capredoni <ldc023@nabu.isg.mot.com> wrote:
>I was just wondering if anyone knows how to send a word document
>attachment in an email. I can send text document. However, when I try
>to send a word document as an attachment, a zero size file is sent
>through the mail. Below is a sample code if anyone has anyidea on what
>I might be doing wrong.
>$updaterid="user\@email.com";
>$boundary = "------------7B9B$$413F";
^^
If you are wanting that as a literal string then you might need to
escape those dollar signs.
That was the only thing I noticed, but you could use -w
and see what it complains about.
later, david
--
David Hawkins dhawk@best.com http://www.river.org/~dhawk
"Anxiety is love's greatest killer. It makes others feel as you might
when a drowning man holds on to you. You want to save him, but you know
he will strangle you with his panic." -- Anais Nin
------------------------------
Date: Fri, 11 Dec 1998 14:21:11 -0500
From: "mark reed" <marst96@pitt.edu>
Subject: Re: Strange Module missing problem
Message-Id: <74rs7m$90d$1@usenet01.srv.cis.pitt.edu>
Why cant you just install the module in with the exe? just be two files not
one. Just have it in same directory and include it, if dont works that
add -I/yourdir to include the dir your in. Other than that, I can tell ya
it probably has nothing to do with your code :)
Mark
------------------------------
Date: 11 Dec 1998 18:39:18 GMT
From: gward@thrak.cnri.reston.va.us (Greg Ward)
Subject: Re: Troublesome taint problem
Message-Id: <74rosm$4t7$3@news0-alterdial.uu.net>
Gerben_Wierda@RnA.nl <Gerben_Wierda@RnA.nl> wrote:
> I have a subroutine that complains about an insecure dependency when
> appending to a mailbox, but it looks like the variables are not tainted.
> Using perl 5.005_02. The routine doesn;t complain about tainted vars using
> the tainted routine but crashes anyway when opening the mboxfile
>
> requite 'tainted.pl';
>
> sub append_mbox {
> my $frommboxref = shift;
> my $tomboxref = shift;
>
> warn "Tainted $filenameref" if &tainted( $filenameref);
> warn "Tainted $tomboxref" if &tainted( $tomboxref);
> warn "Tainted $$filenameref" if &tainted( $$filenameref);
> warn "Tainted $$tomboxref" if &tainted( $$tomboxref);
> if (open TMPMSG, "<$$frommboxref") {
> my $old_umask = umask;
> umask 066;
> if (open( MBOX, ">>" . $$tomboxref)) {
> &lock_open_file( *MBOX{IO});
First of all, I'll just assume that this is only a fragment, and you're
running with -w and 'use strict'. If not, go make that change first.
Second of all, your series of 'warn "Tainted..."' does not check
$fromboxref or $$fromboxref! So if $$frommboxref is tainted, it
won't be caught until the open. Bet if you add
warn "Tainted $frommboxref" if &tainted( $frommboxref);
warn "Tainted $$frommboxref" if &tainted( $$frommboxref);
you'll get the warning before the taint crash.
Finally, it's not really possible to answer tainting questions without
seeing the whole program. But DON'T POST IT -- please! Just take a
good long look at the code that calls append_mbox; I'll bet you'll find
that the first argument to append_mbox is indeed tainted (eg. coming
from the environment, the command line, or a file). Read the perlsec
man page for details on tainting and when and how to untaint.
Greg
--
Greg Ward - software developer gward@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990 x287
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
------------------------------
Date: Fri, 11 Dec 1998 08:26:46 -0800
From: David Valentine <dwv@geology.ucsb.edu>
Subject: Re: VRML Tools for Unix (in Perl?)
Message-Id: <367147C6.1139A114@geology.ucsb.edu>
Also some modules in python, which, IMHO, because of it's object
orientation, is
better suited to building up a set of tools.
www.python.org
jon@amxstudios.com wrote:
> In article <366BB817.843E57FD@ncl.ac.uk>,
> Alun Moon <Alun.Moon@ncl.ac.uk> wrote:
> > I'm looking for some tools that I can run under Unix (possibly in Perl?) that
> > can manipulate VRML files.
> >
> > Specifically I'm looking for Vrml 1.0 --> Vrml 2.0 Translators
> >
------------------------------
Date: Fri, 11 Dec 1998 11:42:50 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Y2K potential problem in localtime()
Message-Id: <MPG.10db159874fd66699898be@nntp.hpl.hp.com>
In article <3671210A.2F4FDF79@home.com> on Fri, 11 Dec 1998 13:34:13
GMT, Rick Delaney <rick.delaney@home.com> says...
> Bart Lateur wrote:
> >
> > So why does int() still round up for negative numbers?
>
> int() doesn't round. It is only expected to truncate the decimal
> portion of a number, which is what it does.
>
> > Note that this is supposed to be equivalent:
> >
> > n = int( n / d ) + ( n % d )
>
> I think you're confusing int() with the greatest integer function. I
> think some languages call this floor().
No, he is not confused. This discussion reveals a gratuitous difference
in semantics between C and Perl. To quote from the ANSI/ISO C Sandard:
"When integers are divided, ... If either operand is negative, whether
the result of the / operator is the largest integer less than or equal
to the algebraic quotient or the smallest integer greater than or equal
to the algebraic quotient is implementation-defined, as is the sign of
the result of the % operator. If the quotient a/b is representable, the
expression (a/b)*b + a%b *shall* equal a." [Emphasis added.]
Comments:
In standards-speak, *shall* means that a conforming implementation must
behave as specified.
The language in the Standard is derived from the first edition of K&R,
Appendix A: The C Reference Manual, Section 7.3. The specified equation
has defined the behavior of the modulus operator from the beginnings of
C, and long before. [I have a manual for a specific implementation of
B, the grandparent of C, which says, in essence, that the sign of the
quotient of integer division is the algebraic sign, and the sign of the
remainder from modulus has the sign of the left operand, so the equation
is satisfied.]
In C, the semantics of the / operator when integers are divided (this is
known from the types of the operands) is identical to the Perl
expression int($a/$b).
In Perl (I have checked this in 5.002 and 5.005), the result of
int(-1/100) is 0, and the result of -1%100 is 99, so the equation is not
satisfied.
This anomaly is not documented in the "C Traps" section of perltrap. I
am filing a bug report.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4405
**************************************