[16456] in Perl-Users-Digest
Perl-Users Digest, Issue: 3868 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 1 06:05:39 2000
Date: Tue, 1 Aug 2000 03:05:15 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <965124314-v9-i3868@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 1 Aug 2000 Volume: 9 Number: 3868
Today's topics:
APACHE Login name <glodalec@yahoo.com>
Re: Convert 1000000 --> 1.000.000 (Anno Siegel)
Re: DBI database access problem <gellyfish@gellyfish.com>
Re: Destination Frame from PERL (Joe Smith)
DOCUMENT_NAME variable -- incompatible on Linux OS? <danceradio@rocketmail.com>
make test hangs <jrl@ast.cam.ac.uk>
Re: Perl and MySQL <gellyfish@gellyfish.com>
Re: PERL SCRIPT <gellyfish@gellyfish.com>
Re: Please help in solving this mysterious prob <gellyfish@gellyfish.com>
Re: posting in newsgroup using perl script? <gellyfish@gellyfish.com>
Re: Read a file into a hash ? (Joe Smith)
Regular expression <isc80460NOisSPAM@nus.edu.sg.invalid>
Remove a blank line <rashid1218@hotmail.com>
Re: Removing newline chars <godzilla@stomp.stomp.tokyo>
Re: Rounding numbers in Perl <gellyfish@gellyfish.com>
Re: RSH to os/2 does not work with backticks (Ilya Zakharevich)
Re: simple perl script for Informix <jbroz@transarc.com>
SMTP servers <templar318@earthlink.net>
Re: SMTP servers (fvw)
spliting on caps (newbie) (Jason Goodrow)
Re: spliting on caps (newbie) (Bernard El-Hagin)
Re: system or backticks (Joe Smith)
Re: text file to HTML page <bart.lateur@skynet.be>
Re: Use MIME *and* specify the mail server <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 01 Aug 2000 11:36:59 +0200
From: Mouse <glodalec@yahoo.com>
Subject: APACHE Login name
Message-Id: <39869A3B.5BDB@yahoo.com>
Hi !
I am using CGI module on Unix/Apache server.
both of commands (remote_user(),user_name()) returns empty
string, even when I am logged thru apache authorization.
How can I get login name ?
Thanks
------------------------------
Date: 1 Aug 2000 08:56:18 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Convert 1000000 --> 1.000.000
Message-Id: <8m63bi$f77$1@lublin.zrz.tu-berlin.de>
Abigail <abigail@foad.org> wrote in comp.lang.perl.misc:
>Which tr/// expression is equivalent with s/\.$//g (which as a pointless /g)?
substr( $_, -1) =~ tr/.//d;
Anno
------------------------------
Date: 1 Aug 2000 09:25:18 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: DBI database access problem
Message-Id: <8m61he$4hl$1@orpheus.gellyfish.com>
On Mon, 31 Jul 2000 10:13:37 +0100 Joe_Broz@transarc.com wrote:
> Barry Kimelman wrote:
>>
>> I am having a problem accessing an Informix database table on my UNIX
>> system at the office while using the DBI interface.
>>
>> The connect succeeds, but the "prepare" statement fails with the
>> following error message :
>>
>> DBD::Informix::db prepare failed: SQL: -479: The number of DESCRIBED
>> columns is greater than the allocated space.
>>
>> According to the perl -v command we are running perl version 5.004_04
>> built for RM600-unix.
>
> What's RM600 unix? Removed comp.lang.perl (it hasn't existed for 5 years).
> Also removed alt.perl
>
>>
>> The table in question has 201 columns. Is there some built in limit with
>> respect to the number of columns ? Is there some parameter or
>
> Not in perl. perl and the DBI don't care how many columns your table has.
>
>> configuration option which can be used to solve this problem ?
>
> You can change something in the database I suspect (but I don't know
> Informix).
>
>> Please advise as to how to solve this problem.
>>
>
> This is an Informix problem. The Informix documentation should describe how
> to fix this if it can be fixed.
The error is indeed an Informix Error :
[gellyfish@orpheus clpmtest]$ finderr -479
-479 The number of DESCRIBED columns is greater than the
allocated space.
The number of columns in the table is larger than the allocated
descriptor. Use the ALLOCATE DESCRIPTOR statement to reallocate a
larger occurrence value, and try the DESCRIBE statement again.
However I have tried this with various tables of the width that the OP
describes and have not been able to recreate the problem. As the OP
doesnt say what version of DBD::Informix he is using I would suggest
that in the first instance he upgrade to the very latest version of it
as well as the required version of esql/c if necessary. The changelog
for the 1.00.PC1 release would indicate that code was added to dynamically
find the number of elements for ALLOCATE DESCRIPTOR.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 1 Aug 2000 09:49:46 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Destination Frame from PERL
Message-Id: <8m66fq$1nlk$1@nntp1.ba.best.com>
In article <sobdja6c9ft105@corp.supernews.com>,
Scott Snella <bg229@scn.org> wrote:
>having. I am wrting a PERL script that calls an HTML file that sets a left
>and right frame.
That is not a Perl problem; it is an HTML problem.
<FORM ACTION="foo.cgi" METHOD="post" TARGET="left-frame">
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Tue, 01 Aug 2000 07:56:56 GMT
From: danceradio95 <danceradio@rocketmail.com>
To: danceradio@rocketmail.com
Subject: DOCUMENT_NAME variable -- incompatible on Linux OS?
Message-Id: <8m5vs7$c1o$1@nnrp1.deja.com>
Disclaimer: I am a novice when it comes to understanding Perl and
Linux. I don't know if I'm asking this question in the right forum, or
even if this is a valid question to begin with. I apologize in advance
if reading this message was a waste of time for anybody...and if I
should be posting this message someplace else, please let me know.
My message:
I am currently trying to configure a CGI script to run on a server
which is running, I believe, the Linux 2.2 multitasking operating
system -- or at least that's what it says on:
http://www.dedicatedserver.com/servers/raq3_specs.html
This CGI script uses a variable called 'DOCUMENT_NAME'.
This script is part of a message board system -- to make a long story
short, the script is supposed to create a counter for the main message
board and individual counters for each of the messages. In other
words, any given message has its own counter which is separate from the
counters on other messages as well as the counter of the main message
board page.
However, on this server, all of the messages are sharing the exact same
counter as the main board -- the entire system is using one counter.
After some investigation, my friend -- who modified this script from
Matt Wright's Text Counter Program @
http://www.worldwidemart.com/scripts, but has no time to sit down and
help me out with the configuration other than offering advice over the
phone -- believes that the problem is rooted with one of the variables
used in our script. The variable is called 'DOCUMENT_NAME'.
He believes that the DOCUMENT_NAME variable is incompatible with the
Linux operating system that we have.
We have run this exact script without problems (i.e., the counters work
fine) on the FreeBSD operating system.
Our question: assuming that this is indeed a compatibility problem, is
there some sort of equivalent of 'DOCUMENT_NAME' that will work on
Linux?
Here is the code from the script, excluding the path statements
(i.e., "path to Perl", etc.) ... thanks in advance for any help anyone
can provide:
########################################################################
######
# Print Content Type Header For Browser
print "Content-type: text/html\n\n";
# Get the page location from the DOCUMENT_NAME environment variable.
$page_temp = "$ENV{'DOCUMENT_NAME'}";
# Chop off any trailing /'s
if ($page_temp =~ /\/$/) {
chop($page_temp);
}
# Chop off the file extension
$page_temp =~ s/.shtml//g;
# Give the Count Page the proper extension
$count_page = "$page_temp\.count";
# Give the lock file its proper extension
$lock_file = "$count_page\.lock";
# Check to see if file is locked by program already in use.
&check_lock($lock_sec);
# Remove Lock File for next time script is run on that HTML page.
&clean_up;
# $lock_file = "$log_page\.lock";
&check_lock($lock_sec);
# Remove Lock File for next time script is run on that HTML page.
&clean_up;
# Get the count out of the count file.
if (-e "$data_dir/$count_page") {
open(COUNT,"$data_dir/$count_page");
$line = <COUNT>;
chop($line) if $line =~ /\n$/;
close(COUNT);
$count = $line;
}
# Increment Count.
$count++;
# Print the Count.
if ($count == 1) {
print "This page has been accessed $count time.\n";
}
else {
print "This page has been accessed $count times.\n";
}
# Open the count file and write the new count that has been incremented.
open(COUNT,">$data_dir/$count_page");
print COUNT "$count";
close(COUNT);
# Remove Lock File for next time script is run on that HTML page.
&clean_up;
sub check_lock {
$time = $_[0];
for ($i = 1;$i <= $time; $i++) {
if (-e "$data_dir/$lock_file") {
sleep 1;
}
else {
open(LOCK,">$data_dir/$lock_file");
print LOCK "0";
close(LOCK);
last;
}
}
}
sub clean_up {
unlink("$data_dir/$lock_file");
}
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 01 Aug 2000 10:01:19 +0100
From: Jim Lewis <jrl@ast.cam.ac.uk>
Subject: make test hangs
Message-Id: <398691DF.D92FE74A@ast.cam.ac.uk>
I'm trying to build perl 5.6.0 on a redhat 6.1 system. Things seem to
go well until I do
% make test
whereupon it seems to hang at:
lib/findfile........
has anyone seen this before?
cheers, Jim
------------------------------
Date: 1 Aug 2000 08:59:17 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl and MySQL
Message-Id: <8m600l$v63$1@orpheus.gellyfish.com>
On Mon, 31 Jul 2000 13:00:36 -0400 Mike Styne wrote:
> Robert wrote:
>
>>
>> Also, can anyone recommend any good tutorial sites, or books,
>> that can help me learn this strange new language?
>
> I've been reading MySQL and mSQL by Yarger, Reese & King. I know
> nothing about MySQL, and so far it's been a pretty good tutorial.
>
It ought to borne in mind that one of the authors has a demonstrable
loathing and complete lack of understanding of Perl.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Tue, 01 Aug 2000 09:12:10 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: PERL SCRIPT
Message-Id: <Kvwh5.818$82.35627@news.dircon.co.uk>
On Mon, 31 Jul 2000 16:16:04 GMT, devo_x@my-deja.com Wrote:
> QUICK QUESTION --
> I'M WORKING IN A COLLEGE COMPUETER LAB WITH PERL SCRIPTS
YOU WONT BE ABLE TO DO PERL IF YOUR CAPS LOCK IS BROKEN ;-}
/J\
------------------------------
Date: 1 Aug 2000 09:34:39 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Please help in solving this mysterious prob
Message-Id: <8m622v$6b5$1@orpheus.gellyfish.com>
On Mon, 31 Jul 2000 11:51:50 GMT Colin Keith wrote:
>
> Why does everyone want to use | given the problems it has when split()'ing
> the record fields again?
Because it is very rarely found in data, because some databases use it as
the default delimiter for import and export files, because it is visually
distinctive, because it is in a handy place on the keyboard : I dunno
just some suggestions.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 31 Jul 2000 23:09:37 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: posting in newsgroup using perl script?
Message-Id: <8m4tf1$llh$1@orpheus.gellyfish.com>
[ de-jeopardised ]
On Mon, 31 Jul 2000 15:43:51 +0200 Ron wrote:
> Jonathan Stowe wrote:
>
>> On Mon, 31 Jul 2000 13:55:17 +0200, Ron Wrote:
>> > Hi all,
>> >
>> > I want to write a script that posts a message into a newsgroup (not this
>> > one ;-) )
>> > Anyone has an example how to do this? Is it more or less the same than
>> > sending an email from a script? (this, I managed)
>> >
>>
>> Net::NNTP
>
> Hi Jonathan,
>
> Thanks for your reply. I am not very deep into this matter; Could you
> be a bit more specific? Do you have an example PERL script, probably?
>
That's Perl BTW - please see perlfaq1 :
What's the difference between "perl" and "Perl"?
Anyhow a minimal example :
#!/usr/bin/perl -w
use strict;
use Net::NNTP;
my $news = Net::NNTP->new('my.news.host') || die "Can't connect - " ;
if ( $news->postok())
{
my @message = split /\n/,<<`EOMESS`;
From: Ron <r.roosjen@koersagent.nl>
Subject: Test
Newsgroups: misc.test
'What CAN you mean by talking in this way to ME!' thundered
Heathcliff with savage vehemence. 'How - how DARE you, under my
roof? - God! he's mad to speak so!' And he struck his forehead
with rage.
EOMESS
$news->post(@message) || die $news->message;
}
else
{
die "Cant post to this host\n";
}
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 1 Aug 2000 09:17:19 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Read a file into a hash ?
Message-Id: <8m64iv$1ld0$1@nntp1.ba.best.com>
In article <11We5.15$DT4.1330402@nnrp2.clara.net>,
Colin Keith <ckeith@clara.net> wrote:
>In article <slrn8nn3v0.vcg.abigail@alexandra.foad.org>, abigail@foad.org
>wrote:
>>What I/O error can occur when closing a file handle opened for reading?
>
>EBADF/EINTR. I assume the first is what throws the warning about closing a
>closed filehandle. The second ... I presume this means that the close
>failed which could be a problem if it happens often because you could run
>out of file descriptors. Though I would suggest it is easier to catch
>this when your open()'s fail.
I don't believe the perl script will ever see EBADF; that's something that
the close() function is supposed to deal with.
There's no way to get an EINTR when closing a file handle that was open
for reading. EINTR occurs during sysread(), not close().
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Tue, 01 Aug 2000 02:24:04 -0700
From: Chrys <isc80460NOisSPAM@nus.edu.sg.invalid>
Subject: Regular expression
Message-Id: <15f5621a.c9f340d9@usw-ex0108-061.remarq.com>
Hello,
I need help for extracting a regex from a line .
how to extract for instance:
the # 61242194 from the line:
/usr/data/testing/sid61242194/dt.out
the pattern of the line is always the same.so i've tried to
use boundary word but it doesnt work.
I'm new to Perl and I need some guidance.
Thanx!
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: Tue, 01 Aug 2000 09:32:07 GMT
From: Rashid Saharudin <rashid1218@hotmail.com>
Subject: Remove a blank line
Message-Id: <8m65en$fo8$1@nnrp1.deja.com>
Dear Sir/ Madam,
I would like to remove blank lines and command lines in my text file
and then would like to save
that file as a new file. I managed to remove the blank lines but I
could not delete/ remove a
sentence such as 'commands for ........
Also I don't know how to save a new file where the blank lines have
been stripped and the
command lines/ description lines been removed.
Could you help me, please. This is an example::
This is my first perl script. Just
testing. It does not work!! 'command lines
using visual basic. I would like to try again.
I want it to look like this:
This is my first perl script. Just
testing. It does not work!!
I would like to try again.
--
RASHID SAHARUDIN
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 01 Aug 2000 00:05:07 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Removing newline chars
Message-Id: <398676A3.62DCAF4F@stomp.stomp.tokyo>
Logan Shaw wrote:
> In article <3986709F.30D53FDE@stomp.stomp.tokyo>,
> Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> >Logan Shaw wrote:
> >(snipped)
> >> A textarea doesn't return \r\n if the user is using lynx.
> >> I just wrote a test script and found this out.
> >When a user hits Enter, what does an internet site form
> >action multi-line textbox return to a cgi script under
> >these circumstances?
> I entered this string in my multi-line textarea:
>
> lynx
> is
> such
> a
> great
> browser
> and running Data::Dumper on that field's value gave me this:
(snipped)
Fascinating. To which internet server did you upload
this script and what operating system is in use? Mind
posting a link to this script?
Godzilla!
--
print "http://mailto:%63%61ll%67i%72l@3483852801/%7e%63%61ll%67i%72l";
------------------------------
Date: 1 Aug 2000 09:28:45 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Rounding numbers in Perl
Message-Id: <8m61nt$571$1@orpheus.gellyfish.com>
On Mon, 31 Jul 2000 14:18:17 -0400 Alex T. wrote:
> Hi,
>
> I need to store the sizes of files in an array. The sizes should be
> shown in kilobytes. I get file size in kilobytes as shown below:
>
> $filesize = stat($file_name)[7] / 1024;
>
> I want to round filesize to one digit after the point and I am not sure
> how to do it. I know print command allows to format the output string,
> but I need to do assignment instead of printing a variable to the
> screen.
>
> Could anyone point me to where I can find out how to round numbers in
> Perl or give me a simple example?
>
This can be found in perlfaq4:
Does Perl have a round() function? What about ceil() and
floor()? Trig functions?
perldoc -q round
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 1 Aug 2000 08:44:24 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: RSH to os/2 does not work with backticks
Message-Id: <8m62l8$3l$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to
<thomas.emde.te@bayer-ag.de>],
who wrote in article <8lmp4m$hfr$1@nnrp1.deja.com>:
> something like this: "@list = `rsh <host> <cmd>`;" does not work from a
> linux system when the rshd runs under os/2. the rshd log says "remote
> requester has closed the socket connection". Any ideas?
I may ask a stupid question only: what does
rsh <host> <cmd> | cat
would do?
Ilya
------------------------------
Date: Tue, 01 Aug 2000 10:45:25 +0100
From: "Joe_Broz@transarc.com" <jbroz@transarc.com>
Subject: Re: simple perl script for Informix
Message-Id: <39869C35.62B64112@transarc.com>
jblatz2@my-deja.com wrote:
>
> I just installed DBD::Informix. I have absolutely no clue how to run a
> simple test that will give me some output.
>
Check the DBI homepage for example programs. Aren't any distributed with
the module? There muxt be dozens of examples on the web, have you looked?
You shouldn't have to know anything about Informix itself. It understands
SQL so just send it a few queries. select <x> from <y> where <z> might be a
good place to start.
------------------------------
Date: Tue, 01 Aug 2000 09:48:04 GMT
From: David Tsai <templar318@earthlink.net>
Subject: SMTP servers
Message-Id: <39869CAD.E24C89A0@earthlink.net>
This question is a little bit off topic...
What is the point of having an outgoing SMTP server? Why doesn't your
email client just act as a SMTP relay itself and directly send the mail
to where its suppose to go? Wouldn't it be the same thing? Just kinda
curious about this.. thanks...
--
Best Regards,
David Tsai
CGI Paradise
http://www.web-consult.com/scripts/
------------------------------
Date: Tue, 01 Aug 2000 09:52:09 GMT
From: fvw+usenet@var.cx (fvw)
Subject: Re: SMTP servers
Message-Id: <965123700EQS.fvw@var.cx>
<39869CAD.E24C89A0@earthlink.net> (templar318@earthlink.net):
>
>This question is a little bit off topic...
>
>What is the point of having an outgoing SMTP server? Why doesn't your
>email client just act as a SMTP relay itself and directly send the mail
>to where its suppose to go? Wouldn't it be the same thing? Just kinda
>curious about this.. thanks...
Very ot, try comp.mail or alt.comp.mail.misc next time. The reason
smtp servers are used is because sometimes a destination smtp server
will not be reachable. As long as this is for short periods of time
(maintenance etc), mail should still be delivered. Client machines
will go offline, or reboot, or whatever. So sending the mail to a local
server means that server can retry sending the mail regulary, without
it getting retried the next time you're online.
--
Frank v Waveren
fvw@var.cx
ICQ# 10074100
------------------------------
Date: 1 Aug 2000 05:12:32 -0400
From: goodrow@panix.com (Jason Goodrow)
Subject: spliting on caps (newbie)
Message-Id: <8m64a0$o60$1@panix2.panix.com>
Hey - I'm trying to split words on caps
@a = split '([A-Z])', $ARGV[0];
foreach $spl (@a) {
print "$spl\n";}
This returns
> ./w2 SplitAllTheseWords
S
plit
A
ll
T
hese
W
ords
Not what I want which (as you might suspect)
Split
All
These
Words
I can just join them but I'm wondering if there's a trick.
Any advice?
goodrow@panix.com
------------------------------
Date: Tue, 01 Aug 2000 09:55:14 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: spliting on caps (newbie)
Message-Id: <slrn8od7b3.61h.bernard.el-hagin@gdndev25.lido-tech>
On 1 Aug 2000 05:12:32 -0400, Jason Goodrow <goodrow@panix.com> wrote:
>Hey - I'm trying to split words on caps
>
>@a = split '([A-Z])', $ARGV[0];
>
>foreach $spl (@a) {
>print "$spl\n";}
>
>This returns
>
>> ./w2 SplitAllTheseWords
>
>S
>plit
>A
>ll
>T
>hese
>W
>ords
>
>Not what I want which (as you might suspect)
>
>Split
>All
>These
>Words
>
>I can just join them but I'm wondering if there's a trick.
>
>Any advice?
Here's one way of doing this:
__________________
$_ = "SplitThisMessUp";
s/([A-Z])/\n$1/g;
print;
__________________
Of course there are many others.
Bernard
--
perl -le 'open(JustAnotherPerlHacker,"")or$_="B$!e$!r$!n$!a$!r$!d$!";
print split/No such file or directory/;'
------------------------------
Date: 1 Aug 2000 09:44:28 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: system or backticks
Message-Id: <8m665s$1n6c$1@nntp1.ba.best.com>
In article <8m4pl0$ght$1@nnrp1.deja.com>, <mchampneys@my-deja.com> wrote:
>
>I am trying to execute a command line DOS program from a Perl script.
>(obviously, this is on a Windows machine) The DOS program executes fine
>from the command line and also from a batch file, but I can't seem get
>the Perl script to execute it.
>
>The DOS program has two arguments that need to passed to it.
>
>I have tried the following code:
>
>@args=("jpegsize.exe", "test.jpg", "$testt.jpg");
>$test=system "@args";
>
>I have also tried this:
>
>$test=`jpegsize.exe test.jpg testt.jpg`;
>
>Anybody have any ideas?
I believe it is fixed in newer versions of perl for Windows.
For a version prior to 5.6.0, I had to use this workaround:
...
$thumb_prog = "djpeg";
$thumb_args = "-scale 1/8 -gif"; # Args to create 1/8th size GIF
if ($^O =~ /win32/i) {
$win32 = 1; # Need to fake a system() call
} else {
$win32 = ""; # Unix shell does redirection properly
... more Unix specific stuff here
}
...
if ($win32) { # Need to simulate system("$thumb_prog $thumb_args $jpg >$gif")
$djpeg_exe = &find_executable($thumb_prog) unless $djpeg_exe;
open(PIPE,"$djpeg_exe $thumb_args $jpg |") || warn("Pipe failed: $!\n");
binmode(PIPE);
local($/) = undef; $_ = <PIPE>; # Read GIF data as one string
close(PIPE) || warn("Pipe close: !$\n");
if (length($_) > 8) {
open(OUT,">$gif") || warn("Error creating $gif: $!\n");
binmode(OUT); print OUT $_ || warn("Output on $gif: $!\n");
close(OUT) || warn("Close on $gif: $!\n");
} else {
warn("'djpeg' returned ",length($_)," bytes - aborting\n");
}
} else { # system() works on the other platforms
system("$thumb_prog $thumb_args $jpg >$gif") if not -s $gif;
}
...
sub find_executable { # Returns absolute path name of an MS-DOS program
my($prog) = shift;
my($dos,$unix);
$prog .= ".exe" unless $prog =~ /\./;
foreach $_ (split(/;/,$ENV{PATH})) {
$dos = "$_\\$prog";
($unix = $dos) =~ s%\\%/%g;
return($dos) if -f $unix; # There's probably an easier way
}
return($prog); # Not found in %PATH%
}
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Tue, 01 Aug 2000 09:14:48 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: text file to HTML page
Message-Id: <p45dos01ekdorjnuq9nrtbttimj5fd6fr5@4ax.com>
Tyler Larson wrote:
>There are specific characters that have special purposes in
>HTML that you can't just output as they are. The characters < and > are used to
>indicate HTML tags and won't be printed by the browser. Instead you'll have to
>substute them with < and > respectively. Also important (though not as
>serious), the ampersand (&) sould be translated to & and quote (") to "
Wrong grouping. "<" and "&" are important, ">" and '"' not really. ">"
is meaningless as a tag closing marker (">") if there isn't any tag
opening marker ("<"). Am I using the correct terminiology? I doubt it.
--
Bart.
------------------------------
Date: 31 Jul 2000 23:20:07 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Use MIME *and* specify the mail server
Message-Id: <8m4u2n$noa$1@orpheus.gellyfish.com>
On Mon, 31 Jul 2000 17:23:18 GMT mfreake@iii.co.uk wrote:
> I'm quite new to Unix mail systems which may be the cause of the
> problem.
>
> I want to attatch some files to an email *and* specify the mail server
> to be used (mail3.ourdomain.co.uk, for a made up example).
>
> My previous uses of MIME::Entity used ordinary sendmail which I cannot
> see how you specify the server with. Normally to specify the server I
> use Fido::Sendmail which seems either won't take the resulting
> MIME::Entity as body (not surprisingly, it's an object not plain text)
> or if I stringify the text it just sends the mail as ugy plain text
> (all that "This is a multi-part message in MIME format... stuff" and no
> attatched files)
>
MIME::Lite lets you specify SMTP as a delivery method *and* specify a
server.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 3868
**************************************