[19653] in Perl-Users-Digest
Perl-Users Digest, Issue: 1848 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 1 06:05:31 2001
Date: Mon, 1 Oct 2001 03:05:07 -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: <1001930707-v10-i1848@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 1 Oct 2001 Volume: 10 Number: 1848
Today's topics:
ANNOUNCE: Hook::LexWrap 0.20 (Damian Conway)
Can't find unicode character <irpag@gmx.net>
Re: cgi-llib.pl and 'use strict' <Dave.Stafford@globis.net>
Re: current dir. <pne-news-20011001@newton.digitalspace.net>
Re: Forcing reevaluation of code in mod_perl scripts? <nospaming@gmx.net>
Re: Getting a perl CGI script to write to a file on ano <tintin@snowy.calculus>
Re: GIF encoding <nobody@nowhere.com>
Re: GIF encoding <pne-news-20011001@newton.digitalspace.net>
Re: HELP: /stuff(\d+)|oth(\d+)/;$num=$1 doesn't work? (Bruno Boettcher)
Re: Help: mail script (WIN) <tintin@snowy.calculus>
Re: Help: mail script (WIN) <goldbb2@earthlink.net>
Re: Help: mail script (WIN) <tintin@snowy.calculus>
Re: Help: mail script (WIN) <wyzelli@yahoo.com>
Re: HTML substitution <gte574u@prism.gatech.edu>
Re: Installing a Module in my own directory?? <simon.oliver@umist.ac.uk>
Re: Is it possible to roll a Perl program into a Win32 <Thomas@Baetzler.de>
Re: Mail parser: Can it be faster? <newspost@coppit.org>
Re: Making A Windows Program from Perl <whataman@home.com>
Re: MIMI:Lite <tintin@snowy.calculus>
Re: Parsing problem <goldbb2@earthlink.net>
Re: Pattern Matching <goldbb2@earthlink.net>
Re: Perl semaphore IPC package real world stability <krahnj@acm.org>
Re: Problem executing pgp.exe with systemfunction <alastairm_news@cogapp.com>
Re: unmatched expression <krahnj@acm.org>
Re: warnings with cgi will crash Win32 perl core <goldbb2@earthlink.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 1 Oct 2001 06:56:52 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Hook::LexWrap 0.20
Message-Id: <9p943k$mhp$1@towncrier.cc.monash.edu.au>
Keywords: perl, module, release
==============================================================================
Release of version 0.20 of Hook::LexWrap
==============================================================================
NAME
Hook::LexWrap - Lexically scoped subroutine wrappers
VERSION
This document describes version 0.01 of Hook::LexWrap, released
September 17, 2001.
DESCRIPTION
Hook::LexWrap allows you to install a pre- or post-wrapper (or both)
around an existing subroutine. Unlike other modules that provide this
capacity (e.g. Hook::PreAndPost and Hook::WrapSub), Hook::LexWrap
implements wrappers in such a way that the standard `caller' function
works correctly within the wrapped subroutine.
AUTHOR
Damian Conway (damian@conway.org)
COPYRIGHT
Copyright (c) 2001, Damian Conway. All Rights Reserved.
This module is free software. It may be used, redistributed
and/or modified under the same terms as Perl itself.
==============================================================================
CHANGES IN VERSION 0.20
- Fixed various problems in handling C<wantarray> (thanks Marcel)
- Fixed C<caller> (thanks everyone)
==============================================================================
AVAILABILITY
Hook::LexWrap has been uploaded to the CPAN
and is also available from:
http://www.csse.monash.edu.au/~damian/CPAN/Hook-LexWrap.tar.gz
==============================================================================
------------------------------
Date: Mon, 1 Oct 2001 11:41:08 +0200
From: "Reinhard Pagitsch" <irpag@gmx.net>
Subject: Can't find unicode character
Message-Id: <9p9dn6$h194n$1@ID-86832.news.dfncis.de>
Hello,
I have a problem with the s///.
my $unixpath = "/mnt/detest/PWATEST/TEST";
my $ntpath = "q:\\PWATEST\\TEST";
open(INFILE, $infile) or die "cant open infile: $infile $!\n";
my @lines = <INFILE>;
close(INFILE);
open(OUTFILE, ">$outfile") or die "cant open outfile $!\n";
foreach $line (@lines)
my $xx = "\\";
chomp $line;
$line =~ s/$ntpath/$unixpath/g;
$line =~ s/$xx/\//g if($line =~ /\\/);
print OUTFILE $line;
}
close(OUTFILE);
And if I run the script I get the message
Can't find unicode character property definition via main->W or W.pl at
unicode/
Is/W.pl line 0
If I remove the line $line =~ s/$ntpath/$unixpath/g;
I get the message
Trailing \ in regex m/\/ at Q:\PWATEST\TEST\tools\createux.pl line 94.
Does anyone know what I am doing wrong?
Thank you,
Reinhard
The text file I read in looks as follow:
PPMFInputName="Q:\PWATEST\TEST\afpds\resdat2.afp"
PPMFLib="Q:\PWATEST\TEST\T1000\default.lbp"
DefaultFontLib="Q:\PWATEST\TEST\T1000\default.lbp"
PPMFPPI="300"
InputMode="AFP_AFP"
TargetMode="afptlect"
AddTimeStamp="No"
AddFileName="Yes"
Archive="FileArchive"
Automatic="2"
XMLFile="Q:\PWATEST\TEST\T1000\results\resdat.xml"
TempDir="R:\temp"
ResourceManagement="AppendResources"
TargetType="AFP_GIF"
GroupRelatedDirectory="Q:\PWATEST\TEST\T1000\results\resdat2.GIF"
AFPCodepage="500"
CodepagePath="Q:\TEST\RESOURCE\CPTS"
MinFreeDiskSpace = "0"
JournalPath="Q:\PWATEST\TEST\T1000\results"
DocFrom="1"
DocTo="20"
* GIF parameters
GifNoShade="0"
GifResolution="300"
GifFnetmode="0"
GifRotation="0"
GifUseLongFilenames="1"
GifBuildHTML="No"
GifHTMLOutput="Q:\temp\O1demo.html"
GifHTMLHeader="Q:\temp\HEADER.TPL"
GifHTMLBody="Q:\temp\BODY.TPL"
GifHTMLFooter="Q:\temp\FOOTER.TPL"
GifAddTimeStamp="Yes"
------------------------------
Date: Mon, 01 Oct 2001 09:52:33 GMT
From: "Dave Stafford" <Dave.Stafford@globis.net>
Subject: Re: cgi-llib.pl and 'use strict'
Message-Id: <B1Xt7.19610$DJ3.1493326@nlnews00.chello.com>
"Thomas Bätzler" <Thomas@Baetzler.de> wrote in message
news:sel8rtoda7fp5teup9c40icicep2odrgvp@4ax.com...
>
> If you can't use CGI.pm for performance reasons, it would probably be
> better to switch to mod_perl (or CGI::Fast, although I haven't tried
> that personally) altogether.
>
> BTW, has anyone actually benchmarked CGI.pm vs. cgi-lib.pl?
Yes. It is very slow. Using Apache and the same hardware I ran a script
using LWP in a loop to call a trivial cgi program (below) which simply
loaded the libraries, and returned a single (unrelated value), i.e.
With no libraries: 16 executions/sec
With cgi-lib.pl: 15 executions/sec
With CGI.pm 4 executions/sec
With mod_perl 64 executions/sec
So use mod_perl if possible. Use cgi-lib.pl if you only want to parse cgi
variables, use cgi.pm only if you want the additional features (or
complexity depending on your viewpoint:-)
#!perl
#use CGI;
#require 'cgi-lib.pl';
print "Content-type text/html\n\n";
print 1;
------------------------------
Date: Mon, 01 Oct 2001 07:55:04 +0200
From: Philip Newton <pne-news-20011001@newton.digitalspace.net>
Subject: Re: current dir.
Message-Id: <i61grtgrvi8t5dl0hn32atv819ol5j864k@4ax.com>
On Sun, 30 Sep 2001 18:44:56 -0700, "Jürgen Exner"
<jurgenex@hotmail.com> wrote:
> I hope you meant
> Cwd::cwd
> which would be portable and the perlish way to do it.
Not Cwd::getcwd? That's what I generally use.
Partly because the docs imply that cwd runs pwd(1) and captures the
output, while getcwd uses a system call rather than spawning an external
process.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Mon, 01 Oct 2001 11:07:16 +0200
From: EXP <nospaming@gmx.net>
Subject: Re: Forcing reevaluation of code in mod_perl scripts?
Message-Id: <3BB83244.9B0417D1@gmx.net>
nobull@mail.com wrote:
>
> EXP <nospaming@gmx.net> writes:
>
> > I want to execute an external perl file
>
> perldoc -f do
thanks for the hint, but mod_perl never the less caches it's
memory area. That is to say, all variables are kept and that 'was'
exactly my problem. However, this weekend I took the time to modifiy my
message board to run under mod_perl, not really efficent, that would
require a
rewrite from scratch as the script is one big mess of global variables,
but at least it works now.
BYe!
EXP
------------------------------
Date: Mon, 1 Oct 2001 14:48:32 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Getting a perl CGI script to write to a file on another server
Message-Id: <EBSt7.7$Zk1.352296@news.interact.net.au>
"Simon Pearce" <simonp@NOSPAM.dircon.co.uk> wrote in message
news:9p75q3$rmf$1@news7.svr.pol.co.uk...
> Humm - this should be good
>
> I have an online booking system that takes details, sends confirmation by
> e-mail then write stuff to a file.
>
> Now, this all happens on a secure server that i rent space from but I need
> the script to write the stuff to a file that exists on a different
server -
> how can I do this?? I'm using:
>
> $basedir = "/home/x/p/xperience/public_html/cgi-bin/booking";
> open(NEWFILE,">$basedir/$orderdir/$num\.txt") || die $!;
> etc etc
>
> which works great on the main server - but when I run it from the secure
> server - zip.
>
> I've tried chaning $basedir to all sorts but no luck! Help!!
I'm interpretting your question differently to Bart and Jürgen. I read it
as you have a CGI script working on your main server, but when you run it on
the secure server, you don't know what the full directory path to the script
is.
If that is a case, that either get the web server admin to tell you the
path, or use a simple script to tell you, ie:
#!/usr/bin/perl
use Cwd;
print "Content-type: text/plain\n\n";
print cwd();
------------------------------
Date: Mon, 1 Oct 2001 14:10:08 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Re: GIF encoding
Message-Id: <p_Rt7.14775$812.28643@newsfeeds.bigpond.com>
"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3BB66677.AD36BB3E@earthlink.net...
> Martien Verbruggen wrote:
> >
> > On Thu, 27 Sep 2001 05:35:18 GMT,
> > Steve Spivey <sspivey3@tampabay.rr.com> wrote:
> > > Does anyone know o a good GIF encoding script? I need to create a
> > > pic on the fly, but I don't know anything about how to encode the
> > > pixels.
Why not use the GD module and treat a pixel as a 1x1 rectangle. It will
write in gif format
gtoomey
------------------------------
Date: Mon, 01 Oct 2001 07:56:32 +0200
From: Philip Newton <pne-news-20011001@newton.digitalspace.net>
Subject: Re: GIF encoding
Message-Id: <q91grtsbub7d33nqti1npqjftku6pbkkt5@4ax.com>
On Mon, 1 Oct 2001 14:10:08 +1000, "Gregory Toomey" <nobody@nowhere.com>
wrote:
> the GD module [...] will write in gif format
Then you have an old version of the module. Newer versions of the module
will not write GIF but, instead, PNG (and also JPEG), since that's what
newer versions of libgd (on which the module is based) write.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Mon, 1 Oct 2001 07:46:08 +0000 (UTC)
From: bboett@bboett.dyndns.org (Bruno Boettcher)
Subject: Re: HELP: /stuff(\d+)|oth(\d+)/;$num=$1 doesn't work?
Message-Id: <9p9700$cnm$1@neon.noos.net>
In article <3bb7eb44.1542$1@news.op.net>,
Mark Jason Dominus <mjd@plover.com> wrote:
>Because $1 is what is in the first pair of parentheses, and $2 what is in
>the second pair of parentheses. If the $line looks like 'oth42', then
>there was nothing in the first pair of parentheses.
hmmm indeed there's some sort of logic, even if not that one expected by me :D
> @matches = ($line =~ /$pattern/);
heh great! thanks a lot, that does it indeed!
--
ciao bboett
==============================================================
bboett@earthling.net
http://inforezo.u-strasbg.fr/~bboett http://erm1.u-strasbg.fr/~bboett
------------------------------
Date: Mon, 1 Oct 2001 14:53:32 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Help: mail script (WIN)
Message-Id: <kGSt7.9$ok1.324703@news.interact.net.au>
"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3BB55C07.E410544E@earthlink.net...
> Actually, the thing to do if you have a program which relys on unix
> sendmail, is to install the Windoze clone, "blat.exe", and adjust those
> things which would point to "sendmail" to point to "blat" instead.
Blat is only a MUA not a MTA, so you can't say it is a clone of sendmail.
------------------------------
Date: Mon, 01 Oct 2001 01:38:21 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Help: mail script (WIN)
Message-Id: <3BB8014D.5D8626EF@earthlink.net>
Tintin wrote:
>
> "Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
> news:3BB55C07.E410544E@earthlink.net...
> > Actually, the thing to do if you have a program which relys on unix
> > sendmail, is to install the Windoze clone, "blat.exe", and adjust
> > those things which would point to "sendmail" to point to "blat"
> > instead.
>
> Blat is only a MUA not a MTA, so you can't say it is a clone of
> sendmail.
Ok, but how many programs care about that distinction?
I'm sure that 80% of *nix perl programs which execute the "sendmail"
program can be ported to win* simply by substituting in "blat"
--
"I think not," said Descartes, and promptly disappeared.
------------------------------
Date: Mon, 1 Oct 2001 17:13:06 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Help: mail script (WIN)
Message-Id: <aJUt7.12$_r1.430175@news.interact.net.au>
"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3BB8014D.5D8626EF@earthlink.net...
> Tintin wrote:
> >
> > "Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
> > news:3BB55C07.E410544E@earthlink.net...
> > > Actually, the thing to do if you have a program which relys on unix
> > > sendmail, is to install the Windoze clone, "blat.exe", and adjust
> > > those things which would point to "sendmail" to point to "blat"
> > > instead.
> >
> > Blat is only a MUA not a MTA, so you can't say it is a clone of
> > sendmail.
>
> Ok, but how many programs care about that distinction?
True. I was just being pedantic.
>
> I'm sure that 80% of *nix perl programs which execute the "sendmail"
> program can be ported to win* simply by substituting in "blat"
But, not without changing the way it is called.
------------------------------
Date: Mon, 1 Oct 2001 17:26:14 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Help: mail script (WIN)
Message-Id: <IcVt7.50$Ih5.1182@wa.nnrp.telstra.net>
"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3BB8014D.5D8626EF@earthlink.net...
> Tintin wrote:
> >
> > "Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
> > news:3BB55C07.E410544E@earthlink.net...
> > > Actually, the thing to do if you have a program which relys on unix
> > > sendmail, is to install the Windoze clone, "blat.exe", and adjust
> > > those things which would point to "sendmail" to point to "blat"
> > > instead.
> >
> > Blat is only a MUA not a MTA, so you can't say it is a clone of
> > sendmail.
>
> Ok, but how many programs care about that distinction?
>
> I'm sure that 80% of *nix perl programs which execute the "sendmail"
> program can be ported to win* simply by substituting in "blat"
No, the syntax is entirely different. Sendmail for windows on the other
hand....
Wyzelli (who paid the $50 to switch because it is really a lot easier)
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;
------------------------------
Date: Mon, 1 Oct 2001 00:41:40 -0400
From: "Brady Doll" <gte574u@prism.gatech.edu>
Subject: Re: HTML substitution
Message-Id: <9p8s5g$8v2$1@news-int.gatech.edu>
Try it out with this...my problem is that it isn't going through the whole
line with the input of:
"<TITLE>News Update</TITLE>"
but it does with the input of:
"<IMG SRC="image.jpg"><IMG SRC="image2.jpg">",
sub replace
{
($line) = @_; # line from HTML file
local($temp, $replace);
$_ = $line;
while (/([^<]*)^<([^>]*)>/)
{
$replace = "";
if ($replace ne "")
{
$temp = "$temp$1$2$replace";
}
else
{
$temp = "$temp$1<$2>";
}
$_ =~ s/(?:[^<]*)^<(?:[^>]*)>//;
}
return $temp;
}
"Bob Walton" <bwalton@rochester.rr.com> wrote in message
news:3BB68F67.8AF9A308@rochester.rr.com...
> Brady Doll wrote:
> >
> > I am attempting to replace a tag in an HTML file.
> > I wrote a method to seperate the HTML tags and
> > search for the tag. For some reason, though, it isn't
> > searching all of the file.
> >
> > I open the file and recurse through the lines and pass
> > whole lines from the file into my replace method.
> >
> > sub replace
> > {
> > ($line) = @_; # line from HTML file
> > local($temp, $replace);
> >
> > $_ = $line;
> >
> > while (/([^<]*)^<([^>]*)>/)
> > {
> > $replace = &parse_tag($2, $line);
> >
> > if ($replace ne "")
> > {
> > $temp = "$temp$1$2$replace";
> > }
> > else
> > {
> > $temp = "$temp$1<$2>";
> > }
> >
> > $_ =~ s/(?:[^<]*)^<(?:[^>]*)>//;
> > }
> >
> > return $temp;
> > }
> >
> > When passed the line:
> > "<TITLE>News Update</TITLE>"
> > it only looks at the <TITLE> tag and ignores the rest
> > of the line. I can't figure out why this happens.
> >
> > when it gets into the while
> > the first time through
> >
> > $2 = "TITLE"
> >
> > and when
> > $_ =~ s/(?:[^<]*)^<(?:[^>]*)>//;
> > is run
> >
> > $_ = "News Update</TITLE>"
> >
> > but instead of going back through the loop it ends the
> > method.
> >
> > This method does work with "<IMG SRC="image.jpg"><IMG
SRC="image2.jpg">",
> > though.
> >
> > Can someone help me figure out what is wrong with this so I can get it
to
> > work
> > correctly.
>
> When I try to run your code (with the addition of a line to call your
> "sub replace" with the input line you suggest), I get:
>
> Undefined subroutine &main::parse_tag called at junk91.pl line 11,
> <DATA> line 1.
>
> Please provide a complete example we can copy/paste/execute that
> exhibits the problem you are having. Thanks.
> --
> Bob Walton
------------------------------
Date: Mon, 1 Oct 2001 10:48:16 +0100
From: "Simon Oliver" <simon.oliver@umist.ac.uk>
Subject: Re: Installing a Module in my own directory??
Message-Id: <3bb83f65@news.umist.ac.uk>
Usual proceedure is:
perl Makefile.PL
make
make test
make install
This will install in the default location for perl modules on your system.
If you have a standalone pm you can use it by adding the current directory
to @INC - most common way is via the use lib pragma, so for example you
might:
use lib ('.');
use SimpleLinkChecker;
A simple way to test if a module is installed (or made available as above)
is to try and 'use' it. If the module is not available you will get an
error:
Can't locate SimpleLinkChecker.pm in @INC (@INC contains:
/usr/lib/perl5/5.6.1/i686-linux /usr/lib/perl5/5.6.1
/usr/lib/perl5/site_perl/5.6.1/i686-linux /usr/lib/perl5/site_perl/5.6.1
/usr/lib/perl5/site_perl .) at - line 1.
BEGIN failed--compilation aborted at - line 1.
--
Simon Oliver
------------------------------
Date: Mon, 01 Oct 2001 10:44:06 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: Is it possible to roll a Perl program into a Win32 dll?
Message-Id: <0kagrto2ur575aumk2bs5glt6tm5r1nkcq@4ax.com>
On Sun, 30 Sep 2001, Peter Eichman <peichman@wam.umd.edu> wrote:
>I was wondering if/how it would be possible to roll a Perl program up
>into a Win32 dll. In other words, what I would like to do is write a
>portion of a program in Perl, and then make it into a dll to export
>functions I could call from a program another language (Visual Basic,
>most likely).
>
>I searched for "Perl dll" and found a reference to the ActiveState Perl
>Development Kit; would this include the functionality I'm looking for?
>(i.e., creating either plain or ActiveX dlls)
From the PerlCOM documentation:
: PerlCOM executes Perl code from within any language or application
: that supports ActiveX components. PerlCOM exposes a Perl interpreter
: as an ActiveX component; PerlCOM can execute bits of Perl code,
: create instances of Perl classes, or import functions and properties of
: a Perl module.
So yes, you can call Perl code from a VB app. However:
>(In case this info matters, I'm working on a Win32 box(Win98 SE to be
>specific) with ActiveState Perl build 626)
: PerlCOM can not be used to build COM objects on Windows 98/85.
So, it looks like you're out of luck here.
HTH,
--
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl
------------------------------
Date: Mon, 1 Oct 2001 02:53:34 -0400
From: David Coppit <newspost@coppit.org>
Subject: Re: Mail parser: Can it be faster?
Message-Id: <Pine.SUN.4.33.0110010157350.25834-100000@cobra.cs.Virginia.EDU>
On Sun, 16 Sep 2001, David Coppit wrote:
> > Have you experimented with the "Content-length: "-field? It is not a
> > mandatory header-field but most emails have it. I thought of a mixture
> > between line- and character-wise reading:
> > (this is pseudo-code and not going to work)
>
> Hm... Actually, this suggestion has several good sub-suggestions:
> - Use the Content-length header to determine how much to read.
> - Use the Content-length header to skip to the next email if
> I know I don't match.
> - Use the Lines header to increment the line count when skipping
I've thought about this some more, and I'm pretty sure that I can't
exploit this info very well. The problem is that "simple is faster".
In order to use the Content-Length header, I'd have to read the email
a paragraph at a time, then switch to reading a big chunk when I know
the content length. Similarly, if there is a Lines header, then I'll
have to read line-by-line, counting as I go.
Instead, it's much faster to set $/ = "\nFrom", and let Perl's
internal <FILEHANDLE> implementation read the email. Now, I *could*
use the lines to determine if the \nFrom is part of an unescaped From
line. Similarly, I could use the content length to quickly determine
the end of an attachment without having to search for the attachment
boundary. (Although the latter doesn't matter given how much I/O
dominates my execution time.)
> Thinking along those lines... I wonder how much time I waste copying a
> big email to a scalar, then printing it. In other words, I wonder if I
> should change $/ back to "\n" when printing the body of an email so that
> only a small amount of memory would be used. Ug. but this probably blows
> away large buffer reads.
In my original implementation, I read the entire next email in case
the parser accidentally stopped on an unescaped "From". I realized
that I only really need to buffer the header of the next email. This
helps reduce memory, but didn't make any real-world difference in
speed.
Oh well... I guess it's about as fast as it can get.
David
------------------------------
Date: Mon, 01 Oct 2001 04:35:37 GMT
From: "What A Man !" <whataman@home.com>
Subject: Re: Making A Windows Program from Perl
Message-Id: <3BB7F2AB.14BA2E48@home.com>
novastar wrote:
>
> Sorry Larry but perl is very weak at gui interfaces and very poor on 2d
> graphics. Better not talk about 3d graphics !
>
So, what are you saying? That it's better to write those type of
applications in C/C++ or some other compiled language? As an example,
please tell me how much slower would a perl converted Win32 .exe file be
compared to the same application written in C or C++?
ALSO... Perl has several graphics modules. Are they really that slow?
Regards,
--Dennis
------------------------------
Date: Mon, 1 Oct 2001 15:04:06 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: MIMI:Lite
Message-Id: <eQSt7.11$Bg1.232554@news.interact.net.au>
"Michael" <min_c_lee@yahoo.com> wrote in message
news:hy3t7.563$Le.21520@sea-read.news.verio.net...
> Can I send out an email attachment without using MIME:Lite?
Sure you can. Just read the relevant RFC's. Why do you want to do it
without MIME::Lite? Just doing it for the learning/fun aspect?
------------------------------
Date: Mon, 01 Oct 2001 00:52:55 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Parsing problem
Message-Id: <3BB7F6A7.9533242E@earthlink.net>
Andrew Paul Gorton wrote:
>
> Hi everyone,
>
> quick question
>
> I need to parse the output of the top command, which is stored in a
> file. How do I get the %CPU and %MEM values. I can get the line
> starting 11869, but not parse it for the values.
>
> PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND
> 11869 gortona 13 0 968 968 740 R 0 5.6 1.4 0:00 top
open( TOP, "<topoutput.txt" )
or die "Couldn't open topoutput.txt: $!";
my @fields = do { $_ = <TOP>; chomp; split };
my %pids;
while( <TOP> ) {
chomp;
my %pidinfo;
@pidinfo{@fields} = split ' ', $_, scalar @fields;
$pids{$pidinfo{PID}} = \%pidinfo;
}
my $iwant = "11869";
print "%CPU = $pids{$iwant}{'%CPU'}\n";
print "%MEM = $pids{$iwant}{'%MEM'}\n";
NB: this code is untested. Also, you might want to replace the line
open( TOP, "<topoutput.txt" )
with:
open( TOP, "top -u|" )
If you do this, then should add:
close( TOP ) or die "top failed: $! $?";
Right after the while loop.
--
"I think not," said Descartes, and promptly disappeared.
------------------------------
Date: Mon, 01 Oct 2001 00:27:22 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Pattern Matching
Message-Id: <3BB7F0AA.A8362B4B@earthlink.net>
shaz wrote:
>
> The basic problem i am having is looking for strings withing longer
> strings.
>
> %strings has a number of strings stored as keys (i know it is not how
> it should be done).
>
> what i want to do is to see if certain smaller strings ($small) are
> present in %strings.
>
> $look = /[$small]/;
>
> if (exists $strings{$look})
> {...}
>
> but I keep getting "uninitialised value in pattern match".
>
> Any ideas where i am going wrong????
First, tie %strings to Tie::Hash::Regex.
Then, use qr/\Q$small/ instead of /[$small]/.
This should solve your problem.
--
"I think not," said Descartes, and promptly disappeared.
------------------------------
Date: Mon, 01 Oct 2001 05:23:33 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Perl semaphore IPC package real world stability
Message-Id: <3BB7FE58.D5CCC983@acm.org>
"Dr. Laurence Leff" wrote:
>
> Now, our department teaches UNIX including such features as semaphores,
> sockets, and shared memory using the C language.
>
> There is a suggestion to teach semaphores, sockets, binary file manipulation,
> etc. using the Perl packages. We already teach Perl in our Unix class.
> This would allow us to make the UNIX programming material accessible to
> those who have not taken our courses on C programming.
>
> My question for this group is whether this Perl functionality is real-world
> stable. Is anyone using Perl instead of C programming in the "real world"
> that involves these kinds of tasks.
I have done binary file manipulation in the real world on DG/UX and it
worked very well.
HTH
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 1 Oct 2001 10:54:05 +0100
From: "Alastair Martindale" <alastairm_news@cogapp.com>
Subject: Re: Problem executing pgp.exe with systemfunction
Message-Id: <k_Wt7.29339$uM2.4282506@monolith.news.easynet.net>
> > I think result=5376 means that pgp.exe has executed but returned an
error of
> > 21. When I run the same command in the DOS prompt the program executes
> > without problem.
> Does 'without problem' == 'without returning an error level of 21'.
Without problem means that the program executed correctly without throwing
any errors.
> > Is there something obvious I have overlooked?
> Dunno - what error code did it return in DOS.
The error code returned in DOS was 0.
------------------------------
Date: Mon, 01 Oct 2001 04:59:14 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: unmatched expression
Message-Id: <3BB7F8A5.AA0F43E8@acm.org>
S Warhurst wrote:
>
> I'm no Perl expert and there's many things I don't quite understand about
> regexps, but in this case, if you escape the parenthesis in your hash, ie:
>
> $hash{'AGENT'} = 'Mozilla/4.0 \(compatible; MSIE 4.01; Windows 98\)';
>
> you'll find it works.
>
> Generally, and any more knowledgable person correct me if I'm wrong, when
> using regexp the string you are searching for should always have all regexp
> metacharacters escaped.
Or let perl do it for you and escape all the meta-characters.
$hash{'AGENT'} = quotemeta 'Mozilla/4.0 (compatible; MSIE 4.01; Windows
98)';
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 01 Oct 2001 00:31:38 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: warnings with cgi will crash Win32 perl core
Message-Id: <3BB7F1AA.11F60189@earthlink.net>
Joe Smith wrote:
>
> In article <3B89DDB5.88B342C6@stomp.stomp.tokyo>,
> Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
It seems that Kira has stopped posting lately. Maybe she was at WTC?
Either that or she's at school, and doesn't have time for clp.misc
--
"I think not," said Descartes, and promptly disappeared.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1848
***************************************