[9848] in Perl-Users-Digest
Perl-Users Digest, Issue: 3441 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 13 19:07:16 1998
Date: Thu, 13 Aug 98 16:00:20 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 13 Aug 1998 Volume: 8 Number: 3441
Today's topics:
#!usr/bin/perl is ignored, WHY? <Raik.Lietzow@stud.uni-hannover.de>
Re: #!usr/bin/perl is ignored, WHY? <bkosch@omnicast.net>
5.002 and 5.004 question <shenge@ece.ucdavis.edu>
Argument to 'use lib'? jboes@my-dejanews.com
Re: Argument to 'use lib'? (Sean McAfee)
Re: Argument to 'use lib'? (Karlon West)
Re: checking if files exist ()
Re: data integrity <rootbeer@teleport.com>
Re: File updating question <kpatel@mathworks.com>
File::Find, wanted(), and parameters (Thomas Frederick O'Connell)
freeware documentation <nonspammers.start.after.this.period.hot_redox@hotmail.com>
HELP !!!! HTTP ERROR 404 <aaa@dms2.com>
here's an implementation of diff in perl <ekoontz@lsi.sel.nospam.sony.com>
if/elsif menu? <bkosch@omnicast.net>
Re: Index-Counter in foreach-Block!? <jhi@alpha.hut.fi>
JAPH (was: Re: Newbie Question About 'for') <mgregory@asc.sps.mot.com>
Re: long story - fork & multiprocessing problem <usenet-replies@rocketmail.com>
Re: long story - fork & multiprocessing problem <conmara@tcon.net>
Re: make test error in compiling Perl under AIX 4.2.1 (Jens-Uwe Mager)
Re: Perl, Win32::OLE, and Excel boerio@arocknid.com
Re: Piping input/output. <jeff.stampes@xilinx.com>
PLEASE - SOMEONE <galebe@hotmail.com>
Re: Setting DOS environment variables in a perl script (Ilya Zakharevich)
Using formats, way to avoid exact formatting??? <B20666@merck.de>
Re: What is the purpose of Perl <ajohnson@gpu.srv.ualberta.ca>
Re: What is the purpose of Perl (Marc Haber)
Re: Y2K Error in CGI::Base.pm (Larry Rosler)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 08 Aug 1998 01:31:08 +0200
From: Raik Lietzow <Raik.Lietzow@stud.uni-hannover.de>
Subject: #!usr/bin/perl is ignored, WHY?
Message-Id: <35CB8E3C.A53F8E65@stud.uni-hannover.de>
Hi there,
I just started to learn something about CGI's and Perl. I found a
brilliant URL:
http://lightsphere.com/dev/class/
to get an introduction. But my first script doesn't work, unfortunately:
#!/usr/bin/perl
print "Content-type:text/html\n\n";
print <<EndOfHTML;
<html><head><title>Test Page</title></head>
<body>
<h2>Hello, world!</h2>
</body></html>
EndOfHTML
;
I save the file and from the Unix shell, I typed: chmod 755 first.pl
(Now, there's a * behind...)
When my HTML-File calls the URL:
http://.../cgi-bin/first.pl
I get a text-file back showing the commands of first.pl but not "Hello,
world!"
Could it be that the first command
#!usr/bin/perl
is ignored?
Being in the cgi-bin directory (Unix shell), I tried to start another
script using:
./test.pl
It didn't work, as well. But using:
usr/bin/perl test.pl
it worked perfectly...
Can anyone tell me what's wrong with my lovely scripts?
Thanks, Raik
Raik.Lietzow@gmx.de
------------------------------
Date: Thu, 13 Aug 1998 15:56:08 -0700
From: <bkosch@omnicast.net>
To: Raik Lietzow <Raik.Lietzow@stud.uni-hannover.de>
Subject: Re: #!usr/bin/perl is ignored, WHY?
Message-Id: <Pine.LNX.3.96.980813155544.25856B-100000@postal>
Try renaming it from first.pl to first.cgi
On Sat, 8 Aug 1998, Raik Lietzow wrote:
> Hi there,
>
> I just started to learn something about CGI's and Perl. I found a
> brilliant URL:
> http://lightsphere.com/dev/class/
> to get an introduction. But my first script doesn't work, unfortunately:
>
> #!/usr/bin/perl
>
> print "Content-type:text/html\n\n";
> print <<EndOfHTML;
> <html><head><title>Test Page</title></head>
> <body>
> <h2>Hello, world!</h2>
> </body></html>
>
> EndOfHTML
> ;
>
> I save the file and from the Unix shell, I typed: chmod 755 first.pl
> (Now, there's a * behind...)
>
> When my HTML-File calls the URL:
> http://.../cgi-bin/first.pl
> I get a text-file back showing the commands of first.pl but not "Hello,
> world!"
>
> Could it be that the first command
> #!usr/bin/perl
> is ignored?
>
> Being in the cgi-bin directory (Unix shell), I tried to start another
> script using:
> ./test.pl
> It didn't work, as well. But using:
> usr/bin/perl test.pl
> it worked perfectly...
>
> Can anyone tell me what's wrong with my lovely scripts?
>
> Thanks, Raik
> Raik.Lietzow@gmx.de
>
>
>
------------------------------
Date: 13 Aug 1998 20:37:46 GMT
From: Eric Sheng <shenge@ece.ucdavis.edu>
Subject: 5.002 and 5.004 question
Message-Id: <6qviqq$att$1@mark.ucdavis.edu>
Hi all,
I have made the following observation:
In PERL 5.002, if you don't define a variable i.e. $my_string and
do an operation such as:
$my_string .= "\n";
you'll get an "use of uninitialize value message".
But in PERL 5.004, I don't get it. Is this a correct explaination
for the observation I made or is it something?
Thanks
--Eric
------------------------------
Date: Thu, 13 Aug 1998 20:28:36 GMT
From: jboes@my-dejanews.com
Subject: Argument to 'use lib'?
Message-Id: <6qvi9k$r70$1@nnrp1.dejanews.com>
Why doesn't this work:
$MY_HOME = '/home/me';
use lib $MY_HOME . '/perl';
--
Jeff Boes jboes@qtm.net
http://www.qtm.net/~jboes/
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 13 Aug 1998 20:49:55 GMT
From: mcafee@breakout.rs.itd.umich.edu (Sean McAfee)
Subject: Re: Argument to 'use lib'?
Message-Id: <TjIA1.366$QT4.1500080@newbabylon.rs.itd.umich.edu>
In article <6qvi9k$r70$1@nnrp1.dejanews.com>, <jboes@my-dejanews.com> wrote:
>Why doesn't this work:
> $MY_HOME = '/home/me';
> use lib $MY_HOME . '/perl';
Because the "use lib" happens at compile time, while $MY_HOME is not set
until run time. Say "BEGIN { $MY_HOME = '/home/me' }" to make the
assignment happen at compile time.
--
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: 13 Aug 1998 20:56:11 GMT
From: karlon@bnr.ca (Karlon West)
Subject: Re: Argument to 'use lib'?
Message-Id: <6qvjtb$jt6@crchh14.us.nortel.com>
jboes@my-dejanews.com wrote:
> Why doesn't this work:
> $MY_HOME = '/home/me';
> use lib $MY_HOME . '/perl';
This is my first post here, I've been perling
about 6 weeks, but I'll take a crack at it.
This line doesn't get executed until runtime:
$MY_HOME = '/home/me';
But this line is required at compile time:
use lib $MY_HOME . '/perl';
So, the variable is unset, so you end up
doing this:
use lib '/perl';
which of course doesn't work.
Try something like this, unless the gurus
here tell you otherwise :)
BEGIN {$MY_HOME = '/home/me';}
use lib "$MY_HOME/perl";
That way, the variable is set as soon as possible,
before the compile time stuff needed for the 'use'
line.
Karlon
------------------------------
Date: Thu, 13 Aug 1998 21:53:39 GMT
From: nicholas@neko.binary9.net ()
Subject: Re: checking if files exist
Message-Id: <slrn6t6o33.6p6.nicholas@neko.binary9.net>
>:How do I go about checking if files exist in a directory? Thanks.
>
>Assuming that you bothered to install a reasonable operating system and
>traditional filesystem, the following is efficient and effective:
>
> $is_empty = (stat($dir))[3] == 2;
>
>If one of my premises is false, you're on your own.
How 'bout
$is_empty = ($#{[</my/dir/*>]} == -1);
? This should work across platforms and sane fs's. I think :-/
>
>--tom
--
G'day!
-----------------------------------------------------------------------------
Nicholas J. Leon "Elegance Through Simplicity"
nicholas@binary9.net - - http://mrnick.binary9.net
8 4 9 1 7 3 <-- what is the pattern?
------------------------------
Date: Thu, 13 Aug 1998 22:44:33 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: data integrity
Message-Id: <Pine.GSO.4.02.9808131543320.10161-100000@user2.teleport.com>
On Thu, 13 Aug 1998 dsrenterprises@my-dejanews.com wrote:
> I can read from data, and write to data. But when we want to read
> existing records and make modifications to them, when resubmitted a
> duplicate record will be created.
Without seeing your code, I can only guess. My guess: You're not using
seek()? (It's probably not a very good guess... :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 13 Aug 1998 18:14:09 -0400
From: Ketan Patel <kpatel@mathworks.com>
Subject: Re: File updating question
Message-Id: <35D36531.1D8061C4@mathworks.com>
Ha wrote:
>
> >If the second method is recommended, I'm not quite sure how to go line
> >by line (as recommended earlier) and make changes without reading in the
> >whole array in the beginning...
>
> didn't i post something to the effect? or is the clock on my computer
> forboding an easter egg disaster?
>
Yes, you did post 'something to the effect'... I tried the following
code, and I know there is some fundamental error, but I don't quite know
what it is... I'm trying to edit one file instead of open A, write to B,
rename B to A:
open(DATA,"+<$dataPath") || die "die!";
flock DATA, 2;
while(<DATA>) {
@sitesArray = split(/\|/,$_);
[do stuff to @sitesArray]
}
print DATA $_; #This is not right... ??
close(DATA);
I don't understand how to save (write to file) the changes I make when
going line by line... When I used the read-in-the-whole-array method, I
would just overwrite the whole file with the new array...
------------------------------
Date: Thu, 13 Aug 1998 14:55:52 -0500
From: tfo@telalink.net (Thomas Frederick O'Connell)
Subject: File::Find, wanted(), and parameters
Message-Id: <tfo-1308981455520001@jesus.telalink.net>
okay, i have a question that i have not been able to answer myself and for
which i have not yet seen an answer.
i would like to be able to have wanted(), the companion function to
find(), take parameters. is this possible? for example, suppose i wanted
to simulate the behavior of chown -R.
what i would like to be able to do is pass wanted() the uid and gid for
the chown function i would like to run on each encountered file.
i.e.
find( \&wanted( $uid, $gid ), '/' );
sub wanted {
my( $uid, $gid ) = @_;
chown( $uid, $gid, $_ );
}
unfortunately, this does not seem to work. and i can't figure out a way to
get find2perl generate anything remotely related to what i want. is it
possible to pass parameters to wanted? is my syntax correct (the answer to
this question is only relevant if the answer to the previous question is
"yes", but i guess i'd like to know in any case...)?
direct help or pointers to help come much appreciated.
-freddie
------------------------------
Date: 13 Aug 1998 22:40:37 GMT
From: "Sabre Taylor" <nonspammers.start.after.this.period.hot_redox@hotmail.com>
Subject: freeware documentation
Message-Id: <01bdc70b$51039980$c1620c8a@lnxcompaq.lexis-nexis.com>
Not to start a holy war but...
has anyone else read:
http://www.gnu.org/philosophy/free-doc.html
?
It presents an argument for free documentation
of freeware.
I thought some of the same things myself when I
first started learning Perl, but gave up because
I needed a book enough to justify buying one of
O'reilly's books and can borrow the other O'reilly
book I need.
Copyrighting the books doesn't seemed a burden to
Perl programmers (well maybe other college kids
like myself), but the real problem is the precedent
the O'reilly situation sets.
I mention O'reilly because it seems posters here
_expect_ others to have their books.
Any thoughts on this subject?
Sabre
------------------------------
Date: Thu, 13 Aug 1998 17:34:42 -0400
From: Alee Ali <aaa@dms2.com>
Subject: HELP !!!! HTTP ERROR 404
Message-Id: <35D35BF2.241@dms2.com>
Hi,
I have the hello.pl perl program which prints the IP Address. I have
that in my cgi-bin directory on NT 4.0. Does anyone know why I keep
getting the HTTP Error 404 that it can't find the file or the script.
Thanks.
Alee
aaa@dms2.com
------------------------------
Date: Thu, 13 Aug 1998 14:38:20 -0700
From: Eugene Koontz <ekoontz@lsi.sel.nospam.sony.com>
Subject: here's an implementation of diff in perl
Message-Id: <35D35CCC.938C5AAF@lsi.sel.nospam.sony.com>
This is a multi-part message in MIME format.
--------------E6F1C7D1B73F45C56BEB17E8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
hope it's useful to someone...
wrote it because I needed a diff to run on windows.
--------------E6F1C7D1B73F45C56BEB17E8
Content-Type: application/x-perl; name="diff.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="diff.pl"
#!/usr/local/bin/perl
# $Id: diff.pl,v 1.2 1998/08/03 22:14:36 ekoontz Exp $
@states = ('start','advance_file_1','advance_file_2','compare_and_report','stop');
$state = 'start';
$filename1 = @ARGV[0];
$filename2 = @ARGV[1];
$i = 0;
open FILE1, "$filename1" || die "couldn't open $filename1!";
while(<FILE1>) {
chomp;
@filearray1[$i++] = $_;
}
if ($#filearray1 == -1) {
die "couldn't open $filename1!";
}
$i = 0;
open FILE2, "$filename2" || die "couldn't open $filename2!";
while(<FILE2>) {
chomp;
@filearray2[$i++] = $_;
}
if ($#filearray2 == -1) {
die "couldn't open $filename2!";
}
$position1 = 0;
$position2 = 0;
$end_of_file = 0;
while ($state ne 'stop') {
SWITCH: {
if ($state eq 'start') {
$advance1 = $position1;
$advance2 = $position2;
$string1 = @filearray1[$position1];
$string2 = @filearray2[$position2];
if ($string1 eq $string2) {
$position1++;
$position2++;
}
else {
$advance1 = $position1;
$state = 'advance_file_1';
}
last SWITCH;
}
if ($state eq 'advance_file_1') {
$advance1++;
$string1 = @filearray1[$advance1];
$string2 = @filearray2[$position2];
if ($string1 eq $string2) {
$advance2 = $position2;
$state = 'advance_file_2';
}
elsif ($advance1 > $#filearray1) {
$state = 'advance_file_2';
}
else {
$state = 'advance_file_1';
}
last SWITCH;
}
if ($state eq 'advance_file_2') {
$advance2++;
$string1 = @filearray1[$position1];
$string2 = @filearray2[$advance2];
if ($string1 eq $string2) {
$state = 'compare_and_report';
}
elsif ($advance2 > $#filearray2) {
$state = 'compare_and_report';
}
else {
$state = 'advance_file_2';
}
last SWITCH;
}
if ($state eq 'compare_and_report') {
if (($advance1 > $#filearray1) && ($advance2 > $#filearray2)) {
printf(STDOUT "%sc%s\n", $position1+1,$position2+1);
print STDOUT "< @filearray1[$position1]\n";
print STDOUT "---\n";
print STDOUT "> @filearray2[$position2]\n";
$position1++;
$position2++;
}
elsif (((($advance1-$position1) > ($advance2-$position2)) && ($#filearray2 > $advance2))
|| ($advance1 > $#filearray1)) {
printf(STDOUT "%sd%s\n", $position1,$position2+1);
for ($i = $position2; $i < $advance2; $i++) {
print STDOUT "> @filearray2[$i]\n";
}
$position2 = $advance2;
}
elsif (((($advance2-$position2) > ($advance1-$position1) && ($#filearray1 > $advance1)))
|| ($advance2 > $#filearray2)) {
printf(STDOUT "%sd%s\n", $position1+1,$position2);
for ($i = $position1; $i < $advance1; $i++) {
print STDOUT "< @filearray1[$i]\n";
}
$position1 = $advance1;
}
if (($position1 > $#filearray1) || ($position2 > $#filearray2)) {
$state = 'stop';
}
else {
$state = 'start';
}
last SWITCH;
}
}
}
# We're at the end of at least one of the files. print out anything left over from the other.
if ($position1 < $#filearray1) {
printf(STDOUT "%sd%s\n", $position1+1,$position2);
for ($i = $position1; $i < $#filearray1; $i++) {
print STDOUT "< @filearray1[$i]\n";
}
}
elsif ($position2 < $#filearray2) {
printf(STDOUT "%sd%s\n", $position1,$position2+1);
for ($i = $position2; $i < $#filearray2; $i++) {
print STDOUT "> @filearray2[$i]\n";
}
}
--------------E6F1C7D1B73F45C56BEB17E8--
------------------------------
Date: Thu, 13 Aug 1998 15:25:27 -0700
From: <bkosch@omnicast.net>
Subject: if/elsif menu?
Message-Id: <Pine.LNX.3.96.980813151601.25856A-100000@postal>
what would be the best way to setup a menu system? kind of like this:
1 - email
2 - add user
3 - remove user
4 - exit
Enter option =>
right now I have a whole if/elsif/elsif/elsif/else thing going on, but I
was wondering if there was a better way. I also wanted to clear the screen
after each option (choose something, do it there, when that program exits,
it clears the screen and reprints the menu). Also, I cannot find anywhere
how to remove a line of text from a file. Such as remove a user from
/etc/passwd. Thanks in advance.
Bryan
------------------------------
Date: 13 Aug 1998 23:06:50 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Index-Counter in foreach-Block!?
Message-Id: <oeeww8cr6hx.fsf@alpha.hut.fi>
> In article <35D300C3.5F8F9BBE@informatik.uni-marburg.de>,
> K.Posern <posern@informatik.uni-marburg.de> wrote:
> >Hi.
> >I KNOW the Index-Counter-Skalar-Variable for a Filehandle: $.
> >But I DON'T know the Skalar-Varialbe which holds the current
> >Index-value of a list in a foreach-Block. So this for example:
> >
> >foreach (@foo) {
> > print $_;
> > ##how do I know here at WHICH position in @foo I am?!
> >}
> >
> >I know, I COULD use an extra Counter-Variable, but it would be SOOOO
> >GREAT if I don't need it.... ?!
> >
> >And if there isn't such a Special-variable in Perl - who could tell me
> >why?! - because I would think such a variable would be needed for a
> >foreach-Loop - or how does Perl count the loops?!
I too sometimes long for something like that...but then I remember
that the below is possible
foreach (@a,$b,@c) { ... }
(yes, that's real code. Consider:
foreach (@try_these_first, @try_these_second) {
if (match($_)) {
$match = $_;
last;
}
}
)
Now what should this special variable be at $b? $#a + 1 or 0 or undef?
What should it be at $c[0]? $#a + 2 or 0?
--
$jhi++; # http://www.iki.fi/~jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: 13 Aug 1998 13:34:13 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: JAPH (was: Re: Newbie Question About 'for')
Message-Id: <r8emulbk8y.fsf_-_@asc.sps.mot.com>
Martin Gregory <mgregory@asc.sps.mot.com> writes:
> I read this and thought "Bah hah - that's funny, but now I get it!"
>
> Then I did this:
>
> perl -e 'for ($a=1, $a < 7, $a++){print;}'
>
> Then I was confused again.
This thread seems to surely deserve a JAPH based on it. Here is my
humble attempt.
@JAPH = reverse split(/ /, "Just Hacker\n Another Perl ", 3);
for ($a=1, $a == 2, $a++){print $JAPH[$_]};
I was disappointed that I had to refer to $_ inside the for loop -
there must be something more elegant, but I can't think of it.
(At least the use of $_ inside the loop does do something slightly
tricky at one point)
Martin.
------------------------------
Date: Thu, 13 Aug 1998 16:01:34 -0400
From: Debbie Whitten <usenet-replies@rocketmail.com>
Subject: Re: long story - fork & multiprocessing problem
Message-Id: <35D3461E.8C7BFBD6@rocketmail.com>
Thanks John - I managed to shave 20 seconds off using rename and mkpath,
but for the life of me I can't figure out how to do ls -t - the opendir
function didn't seem to have that option.
Deb
John Porter wrote:
>
> Debbie Whitten wrote:
> >
>
> Some tips: since time is so critical, avoid forking whenever
> possible. This includes calling system(). In your code I find:
>
> > `date`;
> > `ls -t $from`;
> > system "mkdir -p $dir3_name";
> > system "mv $from\/$file $dest_file 2>/dev/null";
> > system "gzip -qf1 $dest_file 2>/dev/null";
>
> All but the last of these can and should be replaced by the
> equivalent perl code.
> And that's true even if speed isn't important!
------------------------------
Date: Thu, 13 Aug 1998 22:34:06 GMT
From: Ken McNamara <conmara@tcon.net>
Subject: Re: long story - fork & multiprocessing problem
Message-Id: <35D34DB5.E2FA8829@tcon.net>
Larry Rosler wrote:
> [Posted to comp.lang.perl.misc and a copy mailed.]
>
> In article <35D3233C.BA4C8908@tcon.net> on Thu, 13 Aug 1998 19:32:50 GMT,
> Ken McNamara <conmara@tcon.net> says...
> > > $err = system "mv $from\/$file $dest_file 2>/dev/null";
> >
> > It looks like you are moving files one at a time. Why not hand 'mv'
> > multiple files to move.
> >
> > Something like:
> >
> > $mvlist = join(" ",@filelist);
> > $err = system "mv $mvlist $dest";
>
> $err = system "mv @filelist $dest";
>
> But the list form is probably better, because of potential line-length
> limitations in the command processor:
>
> $err = system 'mv', @filelist, $dest;
>
> > 'mkdir' and 'gzip' probably have similiar options.
>
> They do.
>
> > Even if you use equivalent Perl code for the 'mv' this still seems like it
> > would speed things up.
>
> Hard to say without benchmarking. The bulk of the time may be spent in
> the 'rename' system call, rather in process overhead.
>
What about using Perl to generate shell scripts and then running them
separately. Then use Perl to monitor the results.
Would this speed execution?
KenMc
------------------------------
Date: Thu, 13 Aug 1998 20:01:00 GMT
From: jum@anubis.han.de (Jens-Uwe Mager)
Subject: Re: make test error in compiling Perl under AIX 4.2.1
Message-Id: <jum-1308982201010001@anubis.han.de>
In article <35D21325.17CCF186@email.mot.com>, Steven Lai
<o10382@email.mot.com> wrote:
> I have a question concerning the compilation of Perl 5.004_04 under IBM
> AIX 4.2.1. I use gcc to compile the package. Everything is going fine
> before
> I perform the 'make test' command. When I make test, only about 83% of
> the
> test is ok. The following are example of failed test.
[snipped test results]
I have used IBM's C compiler, works without any failed tests. Either use
IBM's C compiler or get the compiled one from <http://www.bull.de/pub/>.
--
Jens-Uwe Mager <pgp-mailto:62CFDB25>
------------------------------
Date: 13 Aug 1998 13:43:47 -0700
From: boerio@arocknid.com
Subject: Re: Perl, Win32::OLE, and Excel
Message-Id: <6qvj63$tka$1@shell2.aracnet.com>
boerio@arocknid.com writes:
>Hi,
>I'm trying to launch a macro from inside a perl script. Unfortunately, I
>don't know the correct syntax for doing this. I have no problems opening
>the spreadsheet and manipulating other cells n' so forth, but I just don't
>know how to launch a macro.
>Can someone provide me with the correct syntax?
Hmmm ... I'll answer my own question :-)
$ex = Win32::OLE->new('excel.application', sub{$_[0]->Quit;}) or die;
$book = $ex->Workbooks->Open("$file");
$ex->Run("Macro");
Who would have known it was that simple.
- Jeff
--
---------------------------------------------------------------------------
Blah ... who needs a signature file anyway. Cyberpromotions already knows
who you are. F$%&#@ing bastards.
------------------------------
Date: Thu, 13 Aug 1998 13:07:48 -0600
From: Jeff Stampes <jeff.stampes@xilinx.com>
Subject: Re: Piping input/output.
Message-Id: <35D33984.EFFDB46B@xilinx.com>
Duncan Christie wrote:
> open (PROG,"| theprog");
> open (PROG,"theprog |");
>
> however, combining them ("| theprog |") does not seam to work. What can
> I do?
You can read the following in perlfaq8:
How can I open a pipe both to and from a command?
Cheers,
Jeff
------------------------------
Date: 12 Aug 1998 02:07:41 GMT
From: "Alfredo Galebe" <galebe@hotmail.com>
Subject: PLEASE - SOMEONE
Message-Id: <01bdc59e$a9c979e0$709ef5c8@interbra.sao.zaz.com.br>
I would like to find where i can get a developer ... fast and reliable ...
need it fast
please respond to
galebe@hotmail.com
thanx
------------------------------
Date: 13 Aug 1998 21:38:23 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Setting DOS environment variables in a perl script
Message-Id: <6qvmcf$52$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.103ca2ffc68b5fab9897c6@nntp.hpl.hp.com>:
> Look in perlvar for the hash %ENV. Keep in mind that you can change the
> environment for yourself or for your children, but not for your parent.
Strangely enough, this is true. I always thought that on DOS the
environment leaks to the parent, but a test with perl shows that this
is not true. Apparently only cwd leaks...
Ilya
------------------------------
Date: Thu, 13 Aug 1998 22:40:24 +0200
From: Wolfgang Reimann <B20666@merck.de>
Subject: Using formats, way to avoid exact formatting???
Message-Id: <35D36B58.5BA5F3B0@merck.de>
Hi ,
i'm trying to write perl scripts with formats, example:
$Disk = "Disk1" ;
$Label = "120898" ;
$Log = $Disk."_".$Label.".log" ;
write ;
format F1 =
$ Proc /log=@<<<<_@<<<<<<<<.log /verify
$Disk,$Label
.
Running the code results in:
>>> $ Proc /log=Disk1_120898 .log /verify
To avoid the space in the outputfield i normally use a second way:
format =
$ Proc /log=@<<<<<<<<<<<<<<<< /verify
$Log
which gives the correct output:
>>> $ Proc /log=Disk1_120898.log /verify
But that's what i'm trying to avoid, explicitely combining all of my
variables to the exactly formatted output-fields.
Question: Is there any way to use a format character that fills up a
variable field up to the length of the variable and then continues with
the fixed text with no more blanks? I tried these ^,~,~~ and even @* but
had no success.
One reason for that is, that the format-areas contain some kind of self
explaining text, not only a bunch of placeholders.
Any ideas, any hints?
Many thanks,
Wolfgang Reimann,
Merck KGaA
------------------------------
Date: Thu, 13 Aug 1998 15:00:13 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: What is the purpose of Perl
Message-Id: <35D345CD.3E43CC28@gpu.srv.ualberta.ca>
Jarkko Hietaniemi wrote:
>
> : Andre Merzky (am@am.westblaak.spirit.nl) wrote:
> : A final question remains: Is the universe open or closed?
>
> Definitely closed. Or have you seen the source code?
open ... its figuring out the language that's tough.
andrew
------------------------------
Date: Thu, 13 Aug 1998 20:58:22 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Re: What is the purpose of Perl
Message-Id: <6qvjq6$bbh$2@nz12.rz.uni-karlsruhe.de>
gburnore@databasix.com (Gary L. Burnore) wrote:
>What about the non-religious version:
>
>print 'BANG';
That is not an option since perl is a very religious language.
Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Karlsruhe, Germany | Beginning of Wisdom " | Fon: *49 721 966 32 15
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29
------------------------------
Date: Thu, 13 Aug 1998 13:47:13 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Y2K Error in CGI::Base.pm
Message-Id: <MPG.103cf0ac3a52c621989768@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <35D33748.2901B7AE@harp.gsfc.nasa.gov> on Thu, 13 Aug 1998
14:58:16 -0400, Mark Solomon <solomon@harp.gsfc.nasa.gov> says...
> There is a year 2000 bug in CGI::Base.pm in:
> sub timestamp.
>
> This is the way the code was:
> $last_str = sprintf("%02d%02d%02d %02u:%02u:%02u",
> $year,$mon+1,$mday, $hour,$min,$sec);
>
> This is the way the code should be:
> $last_str = sprintf("%04d%02d%02d %02u:%02u:%02u",
> $year+1900,$mon+1,$mday, $hour,$min,$sec);
Others might find this acceptable:
$last_str = sprintf("%02d%02d%02d %02u:%02u:%02u",
$year%100,$mon+1,$mday, $hour,$min,$sec);
Judging by the flow of questions in c.l.p.misc, I strongly suspect that
this failure to truncate to two digits will be Perl programs' most
frequent manifestation of the century bug.
BTW, looking at those snippets I am puzzled by the use od 'd' conversion
for date components and 'u' conversion for time components. Each is just
as much unsigned as the other.
--
Larry Rosler
Hewlett-Packard Laboratories
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 3441
**************************************