[18933] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1128 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 13 14:10:36 2001

Date: Wed, 13 Jun 2001 11:10: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: <992455814-v10-i1128@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 13 Jun 2001     Volume: 10 Number: 1128

Today's topics:
    Re: Sending Attachments Via Sendmail <elijah@workspot.net>
    Re: sorting a list of files from a directory <krahnj@acm.org>
    Re: splitting a string into numerical format (Steven M. O'Neill)
        Spreadsheet::WriteExcel  and cgi output mbower@ibuk.bankgesellschaft.de
    Re: weighted average? <koen@wuchem.wustl.edu>
    Re: Which C compiler to use for modules? <bart.lateur@skynet.be>
    Re: Which C compiler to use for modules? <hillr@ugs.com>
    Re: Which C compiler to use for modules? <godzilla@stomp.stomp.tokyo>
    Re: Which C compiler to use for modules? <godzilla@stomp.stomp.tokyo>
    Re: Which C compiler to use for modules? (isterin)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 13 Jun 2001 17:03:27 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: Sending Attachments Via Sendmail
Message-Id: <eli$0106131303@qz.little-neck.ny.us>

In comp.lang.perl.misc, Antoine Hall <AHALL5@nc.rr.com> wrote:
> Is there a way to attach files to an email when using Sendmail?  I want to
> be able to send an email to someone and attach log files but have the
> process automatic using sendmail.  Can it be done?

It just so happens I wrote a trivial perl script to print MIME mail
templates today. Fill in the attachment in the appropriate section
and pipe to "sendmail -oi -t".

#!/usr/bin/perl -w
# Basic mime message
# Eli the Bearded	13 June 2001

my $to = 'foo@bar';
if (defined($ARGV[0]) and length($ARGV[0])) {
  if(substr($ARGV[0],0,1) ne '-') {
    $to = join(',',@ARGV);
  } else {
    print "$0: usage: bmime [address [address...]]\n";
    print "\nDumps a basic mime message to STDOUT.\n";
    exit(2);
  } 
} 

print <<"MIMEMESS";
To: $to
Subject: SUBJECT
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="--=bind$$=--"

----=bind$$=--
Content-Type: text/plain; charset=us-ascii

----=bind$$=--
Content-Type: application/octet-stream; name="FILENAME"
Content-Disposition: attachment; filename="FILENAME"
Content-Transfer-Encoding: base64
X-Encoder: "ay$@a :+1r! mmencode < FILENAME


----=bind$$=----
MIMEMESS

__END__

The X-Encoder line is there to store some vi commands for me.

Elijah
------
often embeds vi commands for cut and paste (or yank and @) in code


------------------------------

Date: Wed, 13 Jun 2001 17:09:21 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: sorting a list of files from a directory
Message-Id: <3B279E71.CF7F0DCE@acm.org>

Ren Maddox wrote:
> 
> On Tue, 12 Jun 2001, krahnj@acm.org wrote:
> 
> >
> > This sorts the oldest files first, change to
> 
> What makes you think that?  -M gives the age and the above sort (once
> fixed for the missing path problem) sorts smallest age first, which
> equates to most recent first as desired.

Yah sorry, writing code too late at night :)


John
-- 
use Perl;
program
fulfillment


------------------------------

Date: 13 Jun 2001 15:13:11 GMT
From: steveo@panix.com (Steven M. O'Neill)
Subject: Re: splitting a string into numerical format
Message-Id: <9g7vu7$qac$1@news.panix.com>

 <mbower@ibuk.bankgesellschaft.de> wrote:
>Can anyone help me with a regular expression to do the following ?
>
>$amount = "1234567";    # This can be variable length and can end with
>decimal places
>$amount = "12345.23";
>
>
>$outstring ="1,234,567"   or $outstring= "12,345.23"

perldoc -q commas
-- 
Steven O'Neill                                      steveo@panix.com
                                                   www.cars-suck.org


------------------------------

Date: Wed, 13 Jun 2001 16:33:40 GMT
From: mbower@ibuk.bankgesellschaft.de
Subject: Spreadsheet::WriteExcel  and cgi output
Message-Id: <3b279479.117271031@news>

I'm trying to use Spreadsheet::WriteExcel to stream output to a
browser  .  The following program works fine, but if I alter the
output and run it again the browser uses the cached version instead
and doesn't display the new data.

If I could work out where to add the tag <META name="Expires"
content="0">,  maybe that would fix it ??



#!/usr/bin/perl -w
use strict;
use Spreadsheet::WriteExcel;

# Set the filename and send the content type and disposition
my $filename ="cgitest$$.xls";

print "Content-type: application/vnd.ms-excel\n";
#print "Content-Disposition: attachment; filename=$filename\n\n";
print "\n";

my $workbook  = Spreadsheet::WriteExcel->new("-");
my $worksheet = $workbook->addworksheet('ha');
my $worksheet = $workbook->addworksheet('ho');
my $format      = $workbook->addformat();

$format->set_bold();
$format->set_color('black');
$format->set_align('right');

my $x=0;
my $y=0;
for($y=0; $y<35; $y++) {
        for($x=0; $x<11; $x++) {
                $workbook->write($y, $x, $x*$y, $format);
        }
}

                $workbook->write(0, 0, "hello testing", $format);
                $format->set_color('red');
                $workbook->write(1, 0, "Next line", $format);
$workbook->close();



------------------------------

Date: Wed, 13 Jun 2001 10:44:05 -0500
From: Koen van der Drift <koen@wuchem.wustl.edu>
Subject: Re: weighted average?
Message-Id: <Pine.GSO.4.05.10106131043040.27406-100000@wuchem.wustl.edu>

On Tue, 12 Jun 2001, E.Chang wrote:

> No need to store the values in an array.  Just accumulate the totals as 
> you read the data.   For example:
> 

Thanks alot.

- Koen.



------------------------------

Date: Wed, 13 Jun 2001 15:54:17 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Which C compiler to use for modules?
Message-Id: <413fito41fub76h4i512p0asictentejet@4ax.com>

Godzilla! wrote:

>I am currently looking for a C compiler which is
>well known to work for compiling Perl modules for
>use under Win 32 systems.


<http://aspn.activestate.com/ASPN/Reference/Products/ActivePerl/lib/Pod/perlwin32.html>

Personally, I eventually would like to use lcc, but that one isn't
listed.

-- 
	Bart.


------------------------------

Date: Wed, 13 Jun 2001 09:21:37 -0700
From: Ron Hill <hillr@ugs.com>
Subject: Re: Which C compiler to use for modules?
Message-Id: <3B279311.E877E0E2@ugs.com>


"Godzilla!" wrote:

> I am currently looking for a C compiler which is
> well known to work for compiling Perl modules for
> use under Win 32 systems.

Hello,
Which version of Win32 [95/98/Me,WNT4.0,Windows 2000] and what version
of perl? [Activestate,IndigoPerl]
this will determine which compiler you need. In my case I am running
both WNT 4.0 and Windows2000. I am running Activestate version 5.6.1
build 626.
Acitvestate uses visual stuido 6 to build there distribution ( this is
listed in there documentation when you download the source for there
distribution) this is the compiler that I have.

It is important to note that when compiling modules, the first command
that shuold be run is perl makefile.pl. This will extract information
from the file Config.pm located in the lib directory, and build the
makefile. If you use a different c compiler than that which perl was
built from you will run into problems, namley compile time switches
ccflags etc..

>
> First a gripe, a well deserved gripe. While playing
> around with a couple of modules, trying to circumvent
> a need for a C complier, I discovered some modules
> call other modules. How I discovered this is by
> truncating a module name to standard DOS eight
> characters followed by an extension for successful
> loading without need of C compilation. Loading is
> successful but fails upon calling another module
> from within, which is not DOS eight character.
> I am rather surprised and annoyed modules are being
> written  which are not "stand alone" and require
> other modules to be installed, without this being
> noted in a module's documentation. This is very
> stupid programming and even more stupid documentation.

I have encountered this as well ( namely libwww) However, during the
initial phase of installing the module/bundle [perl makefile.pl] It will
report failed dependencies. In this case I just install the dependent
module and continue on.

>
> Inherently, I will add this to my long list of complaints
> about modules; those which call other modules run even
> slower and are greater memory hogs than I previously knew.
>
> Lousy, such lousy documentation by module writers.
>
> According to most documentation for compiling modules,
> use of Microsoft's Visual C program is needed. Annoyingly
> this information is only casually mentioned or is well
> hidden within a DOS Dynamic Package Manager bat file with
> little information other than,
>
> "...vcvars32.bat to set required environment variables."
>
> Microsoft's most basic C compiler is one-hundred-nine dollars
> which is not too bad of a price. However, their versions,
> with increasing features, range up to eight-hundred dollars.
> This is rather unaffordable for a toy and certainly unaffordable
> for a program which may or may not work for compiling modules.
>

Microsoft does have an nmake utility and it is free.
http://pluto.spaceports.com/~asm32/

>
> Thank Goodness for warez to cover a need to test. This is not
> to suggest I support pirating software; I am adamantly against
> this activity but am equally adamant about software advertisement
> including "full" documentation. Few do leading to justification
> for warez to discover if a purchase price is validated.
>
> Any suggestions for a C compiler which is factually known to
> successfully compile modules? Any little known sites which
> store pre-complied modules other than the usual ActiveState
> and IndigoPerl repositories?

http://www.roth.net/perl

>
> My primary purpose is to attain information about C compilers
> which are tested and documented to correctly compile modules
> before spending my hard earned egg money.
>

I have had mixed results with compiling modules on Windows, On WNT 4.0
the results are quite good as for Windows 2000 not so good.

I hope this helps.
Ron

>
> Thanks.
>
> Godzilla!



------------------------------

Date: Wed, 13 Jun 2001 09:59:00 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Which C compiler to use for modules?
Message-Id: <3B279BD4.1FD0E360@stomp.stomp.tokyo>

Bart Lateur wrote:
 
> Godzilla! wrote:
 
> >I am currently looking for a C compiler which is
> >well known to work for compiling Perl modules for
> >use under Win 32 systems.
 
http://aspn.activestate.com/ASPN/Reference/Products/ActivePerl/lib/Pod/perlwin32.html
 
> Personally, I eventually would like to use lcc, but that one isn't
> listed.


WHOA!!! This is more complicated than I imagined, especially
for this bimbo although my hair is the color of Poe's talking
feathered friend, or fiend, as it should be.

I have downloaded your reference page which I did not locate
during my research. They do suggest a free compiler which will
be my first choice for learning how to compile modules for
Win 32 use. Clearly this will take quite a bit of time and
effort to learn! I can see potential for lots of installation
bugs to overcome. Nevertheless, as you know, I do have the
stubbornness of a Missouri Mule. I can do this.

Thank you Mr. Lateur for your reference. This will save me
money by not having to purchase a Micro$oft program and will
save me the inherent risks of downloading warez to simply
find out if commercial C compilers will work before purchase.
Your reference also provides a lot of good detailed documentation
on how to do this along with expected problems.


Thank you! Your input is of great help to me!


Godzilla!


------------------------------

Date: Wed, 13 Jun 2001 10:27:33 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Which C compiler to use for modules?
Message-Id: <3B27A285.4FE6AC46@stomp.stomp.tokyo>

Ron Hill wrote:
 
> Godzilla! wrote:

(various snippage)
 
> > I am currently looking for a C compiler which is
> > well known to work for compiling Perl modules for
> > use under Win 32 systems.
 

> Which version of Win32 [95/98/Me,WNT4.0,Windows 2000] 
> and what version of perl? [Activestate,IndigoPerl]
> this will determine which compiler you need. 

I elected to use IndigoPerl for easy installation of
both Apache and Perl along with Perl modules. This
is a very nice bundled program which should not
be free! It is too nice to be free.

My system is a Dell Pentium Three with Windows 98 SE.
IndigoPerl actually runs ActiveState, version 5.6 for
Perl. Some will claim it isn't ActiveState but actually
it is. I am not sure if under license from ActiveState
or simply a near duplicate of ActiveState. I suspect
IndigoPerl uses ActiveState under license to avoid
any legal questions.


> It is important to note that when compiling modules, the first command
> that shuold be run is perl makefile.pl. This will extract information
> from the file Config.pm located in the lib directory, and build the
> makefile. If you use a different c compiler than that which perl was
> built from you will run into problems, namley compile time switches
> ccflags etc..

I have made note of this and added this to information
provided by Bart Lateur. Interesting enough, I have tried
a lot of tricks installing modules without compiling. During
testing tricks, I found IndigoPerl will extract tar.gz files
just fine, create a Dynamic Package Manager (dpm) cache and
all that, but eventually cops a "don't know how to install
whatever tar.gz file..." It does try to run makefile under
some conditions.


> > First a gripe, a well deserved gripe. While playing
> > around with a couple of modules, trying to circumvent
> > a need for a C complier, I discovered some modules
> > call other modules...

> > ...I am rather surprised and annoyed modules are being
> > written  which are not "stand alone" and require
> > other modules to be installed, without this being
> > noted in a module's documentation.
 
> I have encountered this as well ( namely libwww) However, during the
> initial phase of installing the module/bundle [perl makefile.pl] It will
> report failed dependencies. In this case I just install the dependent
> module and continue on.

> > Inherently, I will add this to my long list of complaints
> > about modules; those which call other modules run even
> > slower and are greater memory hogs than I previously knew.

> > Lousy, such lousy documentation by module writers.

This lack of documentation really REALLY annoys me. This
behavior is so unprofessional. It is analogous to purchasing
a program, trying to install it and receiving an error message:

"You need defunct Etch-A-Sketch installed first."


> Microsoft does have an nmake utility and it is free.
> http://pluto.spaceports.com/~asm32/

Yeah, I have nmake.exe on file. I haven't figured out
how to successfully use it though.


> http://www.roth.net/perl
 
I am on my way to have a look see at this site.


> > My primary purpose is to attain information about C compilers
> > which are tested and documented to correctly compile modules
> > before spending my hard earned egg money.
 
> I have had mixed results with compiling modules on Windows, On WNT 4.0
> the results are quite good as for Windows 2000 not so good.

Mixed results seem a fact-of-life when it comes to computers.

Fortunately, IndigoPerl installs a lot of modules for use. I really
have all I need. There are times, like Time High Resolution and
Something-Or-Rather Superpositions modules, I would like to test
these in conjunction with code posted here. This High Resolution
module is the one which led me to a discovery it relies on other
modules for operation, or maybe it was Superpositions. One or
the other, maybe both. I became pissed off and deleted my
downloads of these modules. 

* screams *

So annoying when a module author makes no note, provides
no documentation, "My module won't work without Etch-A-Sketch
installed first."


Godzilla!


------------------------------

Date: 13 Jun 2001 10:34:46 -0700
From: isterin@hotmail.com (isterin)
Subject: Re: Which C compiler to use for modules?
Message-Id: <db67a7f3.0106130934.ccf8163@posting.google.com>

On Windows you should have ActiveState and install binary packages
through ppm utility that comes with it.  If you ever need to compile a
module that is not  available through activestate binaries, you must
use VC++, because this is what ActiveState perl is compiled with.  You
must compile all packages with the same compiler that you perl was
compiled with.

Ilya


"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message news:<3B277FA5.F4861A41@stomp.stomp.tokyo>...
> I am currently looking for a C compiler which is
> well known to work for compiling Perl modules for
> use under Win 32 systems.
> 
> First a gripe, a well deserved gripe. While playing
> around with a couple of modules, trying to circumvent
> a need for a C complier, I discovered some modules
> call other modules. How I discovered this is by
> truncating a module name to standard DOS eight
> characters followed by an extension for successful
> loading without need of C compilation. Loading is
> successful but fails upon calling another module
> from within, which is not DOS eight character. 
> I am rather surprised and annoyed modules are being
> written  which are not "stand alone" and require 
> other modules to be installed, without this being
> noted in a module's documentation. This is very
> stupid programming and even more stupid documentation.
> 
> Inherently, I will add this to my long list of complaints
> about modules; those which call other modules run even
> slower and are greater memory hogs than I previously knew.
> 
> Lousy, such lousy documentation by module writers.
> 
> According to most documentation for compiling modules,
> use of Microsoft's Visual C program is needed. Annoyingly
> this information is only casually mentioned or is well
> hidden within a DOS Dynamic Package Manager bat file with
> little information other than,
> 
> "...vcvars32.bat to set required environment variables."
> 
> Microsoft's most basic C compiler is one-hundred-nine dollars
> which is not too bad of a price. However, their versions,
> with increasing features, range up to eight-hundred dollars.
> This is rather unaffordable for a toy and certainly unaffordable
> for a program which may or may not work for compiling modules.
> 
> Thank Goodness for warez to cover a need to test. This is not
> to suggest I support pirating software; I am adamantly against
> this activity but am equally adamant about software advertisement
> including "full" documentation. Few do leading to justification
> for warez to discover if a purchase price is validated.
> 
> Any suggestions for a C compiler which is factually known to
> successfully compile modules? Any little known sites which
> store pre-complied modules other than the usual ActiveState
> and IndigoPerl repositories?
> 
> My primary purpose is to attain information about C compilers
> which are tested and documented to correctly compile modules
> before spending my hard earned egg money.
> 
> Thanks.
> 
> Godzilla!


------------------------------

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 1128
***************************************


home help back first fref pref prev next nref lref last post