[23008] in Perl-Users-Digest
Perl-Users Digest, Issue: 5228 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 16 09:05:55 2003
Date: Wed, 16 Jul 2003 06:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 16 Jul 2003 Volume: 10 Number: 5228
Today's topics:
[ANNOUNCE] OpenECG programming contest - new data set contest@openecg.net
A perl prayer <ingvar@linpro.no>
Re: building C DLL for calling from Perl using (*.XS) <nospam-abuse@ilyaz.org>
Re: Help understanding MAP <REMOVEsdnCAPS@comcast.net>
Re: Help understanding MAP nobull@mail.com
macros in perl <marc0@autistici.org>
Re: macros in perl <krahnj@acm.org>
Re: macros in perl <sgt19@tid.es>
Re: macros in perl <marc0@autistici.org>
Re: macros in perl <marc0@autistici.org>
Newbie can't get CgiComments to name files correctly, a <me@privacy.net>
Perl Graphics <moliverius@w-link.net>
Re: Problem executing a BAT file (or EXE file) using Pe <cat@no-spam.com>
Re: Running CGI through browser from local hard disk <cat@no-spam.com>
Re: shorten expression <abigail@abigail.nl>
Re: transform 3*0.0 into 0.0, 0.0, 0.0 nobull@mail.com
Re: using fifo <abigail@abigail.nl>
Re: using fifo (jr)
Re: using fifo <noreply@gunnar.cc>
Why is 'last' not allowed here (Ronald Fischer)
Re: Why is 'last' not allowed here <tassilo.parseval@rwth-aachen.de>
Re: Why is 'last' not allowed here <mpapec@yahoo.com>
Re: Win32::GUI <peter_wilson@mail.com>
Re: Win32::GUI <bart.lateur@pandora.be>
Re: Win32::OLE, Excel and OLE Automation question (Domenico Discepola)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 16 Jul 2003 08:16:49 GMT
From: contest@openecg.net
Subject: [ANNOUNCE] OpenECG programming contest - new data set
Message-Id: <3f150887.422740843@news.grnet.gr>
OpenECG Programming Contest - New Data Set
A new data set is now available at the OpenECG portal. This new data
set replaces the old one and is composed of 12 ECGs in 3 different
formats: raw data, SCP with redundancy reduction and SCP with high
compression. The accuracies of all files in this data set have been
carefully tested and are within the limits set by the standard.
You can see the announcement of the new data set in the "What's new"
section and can download the data set from the section "Programming
Contest" -> "Useful Information" of the OpenECG portal:
http://www.openecg.net/
The Programming Contest is still open for submissions, final deadline
is 24:00 hours GMT, 31 December 2003.
The OpenECG consortium.
--
OpenECG Programming contest
http://www.openecg.net
e-mail: contest@openecg.net
------------------------------
Date: 16 Jul 2003 13:36:36 +0200
From: Ingvar Hagelund <ingvar@linpro.no>
Subject: A perl prayer
Message-Id: <ujcn0fe8zzv.fsf@route.linpro.no>
#!/usr/bin/perl
PRAYER:
my $Lord = my $shepherd;
my $wants = {};
for ( ever,
let, me ) { sleep in,
green, pastures
and send me, beside,
still, waters
and my $soul = restored; }
send me,
in, righteousness;
for ( your, names, sake ) {
do stay if I;
seek ( death and shadow
and I, shall,
fear ); not evil;
for ( $you = with, me, your )
{ rod and $staff = my $comfort }
Goodness and mercy;
shall follow me
until all, days
and I; do last }
for (ever and ever,
in, Gods ) { house }
# Psalm 23
# A perl prayer
# Ingvar Hagelund 2003
--
Many that live deserve death. And some that die deserve life. Can you
give it to them? Then do not be too eager to deal out death in
judgement. For even the very wise cannot see all ends.
Gandalf
------------------------------
Date: Wed, 16 Jul 2003 13:04:22 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: building C DLL for calling from Perl using (*.XS)
Message-Id: <bf3igm$2t1n$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Tassilo v. Parseval
<tassilo.parseval@post.rwth-aachen.de>], who wrote in article <bev8kd$kij$1@nets3.rz.RWTH-Aachen.DE>:
> In case of XS code, you shouldn't be using your libc's malloc anyways.
> Instead use the macros provided by perl.h: safemalloc, safefree,
> saferealloc etc. They aren't listed in perlapi.pod, though. I wonder
> why not.
Because they are not a part of the API? New(), Safefree() and Renew() are.
Ilya
------------------------------
Date: Wed, 16 Jul 2003 05:21:23 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Help understanding MAP
Message-Id: <Xns93BA40AFDF882sdn.comcast@206.127.4.25>
"Christian Winter" <thepoet@nexgo.de> wrote in news:3f14f4b1$0$6766
$9b4e6d93@newsread2.arcor-online.net:
> If i got it right, you then simply want to construct
> a reverse hash in %b36.
> $n = 0;
> my %b36 = map { chr($_) => $n++ } (48..57,65..90);
> or using the previously generated %b hash:
> my %b36 = map { $b{$_} => $_ } keys %b;
my %b36 = reverse %b;
--
Eric
$_ = reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print
------------------------------
Date: 16 Jul 2003 04:49:11 -0700
From: nobull@mail.com
Subject: Re: Help understanding MAP
Message-Id: <4dafc536.0307160349.6045a71d@posting.google.com>
"Christian Winter" <thepoet@nexgo.de> wrote in message news:<3f14f4b1$0$6766$9b4e6d93@newsread2.arcor-online.net>...
> If i got it right, you then simply want to construct
> a reverse hash in %b36.
^^^^^^^
> my %b36 = map { $b{$_} => $_ } keys %b;
Why use map at all? Why not simply reverse it?
my %b36 = reverse %b;
------------------------------
Date: Wed, 16 Jul 2003 09:35:31 GMT
From: marc0 <marc0@autistici.org>
Subject: macros in perl
Message-Id: <871xwqu8a3.fsf@autistici.org>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Hi all,
I'm new to perl.
How it's possible to write macros in perl?
C-like macros would be OK.
I can find nothing in the perl manual (the one at perldoc.com).
Or macros are just considered a Bad Thing in Perl?
- --
marc0@autistici.org http://www.autistici.org/marc0
(rot13-string "znep0@pelcgberoryf.arg")
2143 9E77 D5E6 115A 48AD A170 D0EE F736 4E88 99C2
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE/FRuM0O73Nk6ImcIRAqD5AKCqm807OlD/6YBiLYN/tOSHsSi1SQCg6zB5
kCIyGlQ2QCl0O9B+3+XPUoc=
=WobI
-----END PGP SIGNATURE-----
------------------------------
Date: Wed, 16 Jul 2003 10:05:40 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: macros in perl
Message-Id: <3F1523B1.3AD7572E@acm.org>
marc0 wrote:
>
> I'm new to perl.
>
> How it's possible to write macros in perl?
>
> C-like macros would be OK.
Yes, use the -P command line switch.
perldoc perlrun
John
--
use Perl;
program
fulfillment
------------------------------
Date: Wed, 16 Jul 2003 12:48:08 +0200
From: "Stephane G. Titard" <sgt19@tid.es>
Subject: Re: macros in perl
Message-Id: <3F152D68.4FFD331F@tid.es>
marc0 wrote:
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi all,
>
> I'm new to perl.
>
> How it's possible to write macros in perl?
>
> C-like macros would be OK.
>
> I can find nothing in the perl manual (the one at perldoc.com).
>
> Or macros are just considered a Bad Thing in Perl?
>
Well, most of the time you don't need them.
you should ask yourself where you want them?
perl data structures grow at need, if you need some global defaults
you might wrap it in a small config module (Like the CPAN's one for
example)
anyway you can use
use constant MAX_LENGTH => 20;
better to put this at the beginning of your code in a BEGIN BLOCK
to protect against some redefinition...
(this defines internally some subroutine which is optimized)
HTH
stephan
>
> - --
> marc0@autistici.org http://www.autistici.org/marc0
> (rot13-string "znep0@pelcgberoryf.arg")
> 2143 9E77 D5E6 115A 48AD A170 D0EE F736 4E88 99C2
> -----BEGIN xxx SIGNATURE-----
> Version: GnuPG v1.0.7 (GNU/Linux)
>
> iD8DBQE/FRuM0O73Nk6ImcIRAqD5AKCqm807OlD/6YBiLYN/tOSHsSi1SQCg6zB5
> kCIyGlQ2QCl0O9B+3+XPUoc=
> =WobI
> -----END PGP SIGNATURE-----
------------------------------
Date: Wed, 16 Jul 2003 12:41:23 GMT
From: marc0 <marc0@autistici.org>
Subject: Re: macros in perl
Message-Id: <87n0fek5p7.fsf@autistici.org>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Stephane G. Titard on Wed, 16 Jul 2003 12:48:08 +0200 writes:
> marc0 wrote:
>> Hi all,
>>
>> I'm new to perl.
>> How it's possible to write macros in perl?
>> C-like macros would be OK.
>> I can find nothing in the perl manual (the one at perldoc.com).
>> Or macros are just considered a Bad Thing in Perl?
>
> Well, most of the time you don't need them.
> you should ask yourself where you want them?
I desire them because I desire to modify the syntax where IMHO makes
sense, for example something like:
#include <stdio.h>
#define loop(n) for (i = 0; i < n; i++)
int main ()
{
unsigned int i;
loop (10)
do_something ();
return 0;
}
In the Perl script I'm working on I would use it to write something
like
#define walk_file(FILE) for ($walk_file_line = <FILE>)
walk_file (FILE) {
...
}
and alike.
That's not necessary but IMHO it helps to make the code more clear.
Another way to do it would be to use the C preprocessor or M4 (likely
better) on the file but this adds complexity.
Thanks
- --
marc0@autistici.org http://www.autistici.org/marc0
(rot13-string "znep0@pelcgberoryf.arg")
2143 9E77 D5E6 115A 48AD A170 D0EE F736 4E88 99C2
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE/FUcA0O73Nk6ImcIRAqR7AKC67QipcDJvLUAhARJ5VZNDI6QIxACfVkOw
kxGHQIkJhIIoRz+rNmwnPQc=
=ZMcG
-----END PGP SIGNATURE-----
------------------------------
Date: Wed, 16 Jul 2003 13:02:52 GMT
From: marc0 <marc0@autistici.org>
Subject: Re: macros in perl
Message-Id: <87fzl6k4pd.fsf@autistici.org>
marc0 on Wed, 16 Jul 2003 12:41:23 GMT writes:
> #define walk_file(FILE) for ($walk_file_line = <FILE>)
s/for/while/
>
> walk_file (FILE) {
> ...
> }
------------------------------
Date: Wed, 16 Jul 2003 11:04:25 +0100
From: "Anthony Litton" <me@privacy.net>
Subject: Newbie can't get CgiComments to name files correctly, and begs for help
Message-Id: <bf3802$alprk$1@ID-168665.news.uni-berlin.de>
Hi,
I'm a complete novice at this and I've been banging my head against a brick
wall. I apologise if this is not an appropriate place to ask this question,
and appreciate any help anyone can give me.
I've been trying to uses the perl script CgiComments by Jules Chan
(www.knurdle.com) to add comment functionality to my blog
(www.anthonyemigration.net/blogger.html. Nothing interesting has happened to
me since I started it). It does almost everything it's supposed to.
The problem is this: the script successfully creates, shows, and adds to a
file, but when the showcount part of the script checks to see if the file
exists, it looks for the wrong name. Why would they be different? Aren't
they using the same variable?
For what it's worth, it seems to be the file creation part that's incorrect.
The showcount section looks for the file named as $BlogItemNumber, but the
file actually created is named something else.
For example, the BlogItemNumber is 105761154411180725. The comment file
created is called 105761154411180720. The script looks for
105761154411180725 and doesn't find it. Another identical example: the
BlogItemNumber is 105828670390199586, and the file created is
105828670390199580.
Why are the files named incorrectly? Why does it always change the final
digit to 0?
Here are the sections of the script I'm having problems with. The full
script is available at
http://alumni.eecs.berkeley.edu/~rayning/cgicomments.txt.
The HTML in the actual page is at the bottom.
#!/usr/local/bin/perl -w
#
# CGI commenting system. Inspired by DotComments and Phil Ulrich
#
# Version 1.0 - Initial release to the public.
# Version 2.0 - Cookies to remember people,
# select the order which comments are displayed, comment counts.
#
# Copyright 2001 Aaron Chan. All Rights Reserved.
use strict;
use CGI;
use Template;
<snip>
my(@class) = ('class1', 'class2');
my($order) = 0;
my($comment_directory) = '/home/MyUserName/public_html/cgi-bin/comments/';
my($mailprog) = "/usr/lib/sendmail";
my($recipient) = "anthony\@anthonyemigration.net";
my($subject) = "New comment";
#------------------------------------------
my($cgiquery) = new CGI;
my($blog_id) = $cgiquery->param('blog_id');
if ($blog_id !~ /^\d+$/)
{
print $cgiquery->header;
print "Invalid Blog ID<br>\n";
exit;
}
########## Here's my problem ###########
if ($cgiquery->param('showcount'))
{
#TopKnot's Tweak - just check existence and answer accordingly. Both fast
and cool!
print $cgiquery->header;
if (-e "$comment_directory$blog_id") #TopKnot's - check for existence
{
print "document.write('Read Comments. Add New Ones.')"
}
else
{
print "document.write('Anything to add?');";
}
exit;
}
if ($cgiquery->param('add') && $cgiquery->param('name') &&
$cgiquery->param('comments'))
{
if ($cgiquery->param('remember_me'))
{
my($cookie_value) = $cgiquery->param('name') . "[+]" .
$cgiquery->param('email') . "[+]" . $cgiquery->param('url');
my($set_cookie) = $cgiquery->cookie(-name => "cgicomments",
-value => $cookie_value,
-expires => "+6M",
-secure => 0);
print $cgiquery->header(-cookie => $set_cookie);
}
my($comments) = $cgiquery->param('comments');
$comments =~ s/\n/<BR>/g; # \r represents a newline
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
my($recorded) = sprintf("%.2d-%.2d-%.4d %d:%.2d", $mon+1, $mday,
$year+1900, $hour, $min);
open (COMMENTS, ">>$comment_directory$blog_id") or die ("Can't write to
file $blog_id");
seek (COMMENTS, 0, 0);
print COMMENTS $cgiquery->param('name') . "[$blog_id]";
print COMMENTS $cgiquery->param('email') . "[$blog_id]";
print COMMENTS $cgiquery->param('url') . "[$blog_id]";
print COMMENTS $comments . "[$blog_id]";
print COMMENTS $recorded . "\n";
close(COMMENTS);
# Added to email comments to me
mailme($cgiquery->param('comments')."\n\n".$cgiquery->param('name').",
".$cgiquery->param('email')."\n".$cgiquery->param('url'));
}
if (!$cgiquery->param('remember_me'))
{
print $cgiquery->header;
}
my($headertemplate) = new Template("cgicommentsheader.html");
my($headerhtml) = $headertemplate->cast();
my($outputtemplate) = new Template("cgicommentsoutput.html");
open (COMMENTS, "<$comment_directory$blog_id");
my($count) = 0;
my(@outputhtml);
my($outputcount) = 0;
while (<COMMENTS>)
{
my(@variable) = split(/\[$blog_id\]/);
my($email, $url);
if ($variable[1])
{
$email = "<b>[</b><a href='mailto:$variable[1]'>email</a><b>]</b>";
}
if (($variable[2] !~ /^http:\/\/$/) && ($variable[2]))
{
if ($variable[2] !~ /^http:\/\//)
{
$url = "<b>[</b><a href='http://$variable[2]'
target='new'>www</a><b>]</b>";
}
else
{
$url = "<b>[</b><a href='$variable[2]' target='new'>www</a><b>]</b>";
}
}
my(%data) = (name => $variable[0],
email => $email,
url => $url,
comments => $variable[3],
recorded => $variable[4],
class => $class[$count]);
$outputhtml[$outputcount] .= $outputtemplate->cast(\%data);
$outputcount++;
if ($count == $#class)
{
$count = 0;
}
else
{
$count++;
}
}
close(COMMENTS);
my($get_cookie) = $cgiquery->cookie("cgicomments");
my($name_value, $email_value, $url_value);
if ($get_cookie)
{
my(@cookie_array) = split(/\[\+\]/,$get_cookie);
$name_value = $cookie_array[0];
$email_value = $cookie_array[1];
$url_value = $cookie_array[2];
}
my($footertemplate) = new Template("cgicommentsfooter.html");
my(%data) = (blog_id => $blog_id,
name_value => $name_value,
email_value => $email_value,
url_value => $url_value);
my($footerhtml) = $footertemplate->cast(\%data);
print $headerhtml;
if ($order)
{
@outputhtml = reverse(@outputhtml);
}
for my $i (0 ..$#outputhtml)
{
print $outputhtml[$i];
}
print $footerhtml;
<snip>
The html document header contains:
<script language="javascript">
<!--
function cgicomments(n) {
window.open('http://www.anthonyemigration.net/cgi-bin/cgicomments.cgi?blog_i
d='+n,'comments'+n,'directories=0,height=400,width=500,location=0,resizable=
1,scrollbars=1,toolbar=0');
}
//-->
</script>
And in the body of the html:
<a href="#" OnClick="cgicomments(<$BlogItemNumber$>);return false;"><SCRIPT
language="JavaScript"
src="/cgi-bin/cgicomments.cgi?showcount=1&blog_id=<$BlogItemNumber$>"
type=text/javascript></SCRIPT>
</a>
I appreciate that you've read this far. My hope is that it's incredibly
obvious and that I'm an idiot. If this is a bad place to look for these
answers, I hope you can point me in the right direction.
Cheers,
--
Anthony
------------------------------
Date: Wed, 16 Jul 2003 01:52:33 -0400
From: Matt Oliverius <moliverius@w-link.net>
Subject: Perl Graphics
Message-Id: <vha3lf6tfl428b@corp.supernews.com>
Hello all,
First things first. I would like to say thank you to everyone who has
helped me on this newsgroup in the past.
I have a quick question that I hope someone finds remotely relevant to this
newsgroup. Is there any way to dynamically generate an image with Perl?
I've used Perl and regular expressions in the past to parse a vector
graphics image and replace flags in a dummy document (very tedious to set
up) to generate what I want. However, now I would like to do something
similar to this so that I can return a rastor image via the web. It would
also be nice if I didn't have to use an intermediate dummy document.
Thanks again for your help,
Matt
------------------------------
Date: Wed, 16 Jul 2003 23:06:59 +1000
From: Cat <cat@no-spam.com>
Subject: Re: Problem executing a BAT file (or EXE file) using Perl as CGI script under Apache.
Message-Id: <3F154DF3.F7A365A8@no-spam.com>
Tom Salzmann wrote:
>
> The return code I get is 65280... exit_code of 255.
>
> ??
>
> Thoroughly confused...
>
> Tom
>
> "Tom Salzmann" <salzo@yahoo.com> wrote in message
> news:zjUQa.458$x16.19236@eagle.america.net...
> > Cat, Thanks for the reply.
> >
> > I have tried your advice to no avail. The perl file works FINE from the
> > commandline and it does RUN from apache (I echo things to the resulting
> > html) but the calls to NT to run the BAT file fail... I tried it two ways
> > this time - the open() approach and using system().
> >
> > Again, from the commandline, the PERL program runs the BAT file fine every
> > time. From Apache, the perl file runs but the BAT file is apparently
> > ignored.... I'll try to get return codes from system() next.
> >
Sorry i can't help you any further as I'm running Linux and W2K. But I'll
keep thinking... good luck.
------------------------------
Date: Wed, 16 Jul 2003 23:03:42 +1000
From: Cat <cat@no-spam.com>
Subject: Re: Running CGI through browser from local hard disk
Message-Id: <3F154D2E.63B090E6@no-spam.com>
"Dr. John P. Costella" wrote:
>
> I am trying to test what a browser would show when accessing a CGI
> script, but without going through an actual server. I have Perl
> running fine on the local machine (Win XP) and am working through some
> tutorials etc. But if I try to access the file through MSIE it runs
> the script from a command prompt rather than piping the result back to
> the browser.
>
> Is this possible to do without the actual server? (I intend to put the
> final working script onto a real server down the track, but for
> various reasons that's not possible at this time.)
It is a security risk to allow your browser to execute external commands
and is the reason why good browsers (forget MSIE) do not permit such behaviour.
------------------------------
Date: 16 Jul 2003 08:10:02 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: shorten expression
Message-Id: <slrnbha22p.oa.abigail@alexandra.abigail.nl>
Jeff 'japhy' Pinyan (pinyaj@rpi.edu) wrote on MMMDCV September MCMXCIII
in <URL:news:Pine.SGI.3.96.1030715112248.17707C-100000@vcmr-64.server.rpi.edu>:
)) On Tue, 15 Jul 2003, ZZT wrote:
))
)) >is there a way to shorten this expression?
)) >
)) >$host=~/^(\S*)\s*/; $host=$1;
))
)) Well, as it stands, even if the regex FAILS, $host will be set to whatever
)) $1 was before the regex.
But the only string on which the regexp can fail is a string that
doesn't have a beginning. Now, in perl6, with lazy evaluation, we
might be able to construct strings without an end.
But how do I make a string without a beginning?
Abigail
--
split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};
------------------------------
Date: 16 Jul 2003 04:49:30 -0700
From: nobull@mail.com
Subject: Re: transform 3*0.0 into 0.0, 0.0, 0.0
Message-Id: <4dafc536.0307160349.19f29301@posting.google.com>
CM <starobs99@yahoo.com> spits TOFU in my face...
> Thanks a lot,
Please express your gratitude by refraining from top-posting and
full-quoting henseforth.
------------------------------
Date: 16 Jul 2003 08:13:33 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: using fifo
Message-Id: <slrnbha29d.oa.abigail@alexandra.abigail.nl>
jr (scw_00@yahoo.com) wrote on MMMDCV September MCMXCIII in
<URL:news:b574c5ab.0307150824.57d3e9d2@posting.google.com>:
@@ i would like to use fifo to maintain a db server connection ( such as
@@ isql ...), so when there is not enough connection error i still can
@@ send kill cmd to db server to kill some users and free up some
@@ connections. i know how to use fifo to a file, but not "isql -Usa
@@ ...". Any information is greatly appreciated.
I strongly recommend *not* using isql to connect from a program
to a database, but to use the DBI.
Having said that, what I think you want is:
open my $db => "| isql -Usa ..." or die "popen failed: $!";
Abigail
--
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
------------------------------
Date: 16 Jul 2003 04:44:29 -0700
From: scw_00@yahoo.com (jr)
Subject: Re: using fifo
Message-Id: <b574c5ab.0307160344.11a02144@posting.google.com>
scw_00@yahoo.com (jr) wrote in message news:<b574c5ab.0307150824.57d3e9d2@posting.google.com>...
> i would like to use fifo to maintain a db server connection ( such as
> isql ...), so when there is not enough connection error i still can
> send kill cmd to db server to kill some users and free up some
> connections. i know how to use fifo to a file, but not "isql -Usa
> ...". Any information is greatly appreciated.
>
> jr
Thanks. i found out the solution.
jr
------------------------------
Date: Wed, 16 Jul 2003 13:49:59 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: using fifo
Message-Id: <bf3e4p$akcan$1@ID-184292.news.uni-berlin.de>
jr wrote:
> Thanks. i found out the solution.
We are all very happy for you. Would you mind sharing it?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 16 Jul 2003 01:01:25 -0700
From: ronaldf@eml.cc (Ronald Fischer)
Subject: Why is 'last' not allowed here
Message-Id: <219750c.0307160001.5dfb82ae@posting.google.com>
The program
#!/usr/bin/perl -w
use strict;
if(1)
{
last;
}
when run under perl 5.8, raises the error
Can't "last" outside a loop block at ./lasttest.pl line 5.
Note that 'man perlsyn' says:
"A BLOCK by itself (labeled or not) is semantically
equivalent to a loop that executes once. Thus you can
use any of the loop control statements in it to leave
or restart the block."
So my example above should be legal....
Ronald
------------------------------
Date: 16 Jul 2003 09:15:41 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Why is 'last' not allowed here
Message-Id: <bf353t$8e6$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Ronald Fischer:
> The program
>
> #!/usr/bin/perl -w
> use strict;
> if(1)
> {
> last;
> }
>
> when run under perl 5.8, raises the error
>
> Can't "last" outside a loop block at ./lasttest.pl line 5.
That's because the blocks of 'if', 'unless' and 'do' (missed one?)
aren't treated as a block that is subject to 'last' or 'next'.
> Note that 'man perlsyn' says:
>
> "A BLOCK by itself (labeled or not) is semantically
> equivalent to a loop that executes once. Thus you can
> use any of the loop control statements in it to leave
> or restart the block."
This refers to a bare-block. In fact this is the solution to your
problem: just add another pair of curlies. Looks odd, but works as
expected:
if (1) {{
last; # 'next' is actually equivalent in these cases
}}
Unfortunately, this trick wont work for map(), grep() and sort() blocks.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Wed, 16 Jul 2003 14:57:48 +0200
From: Matija Papec <mpapec@yahoo.com>
Subject: Re: Why is 'last' not allowed here
Message-Id: <8liahvkmqa14ftfafe67d63i2hmlv2vd7v@4ax.com>
X-Ftn-To: Ronald Fischer
ronaldf@eml.cc (Ronald Fischer) wrote:
>The program
>
>#!/usr/bin/perl -w
>use strict;
>if(1)
>{
> last;
>}
>
>when run under perl 5.8, raises the error
Don't know why it isn't allowed, but you can try same thing with loop,
for (1) {
last;
#... rest of code to be skipped
}
--
Matija
------------------------------
Date: Wed, 16 Jul 2003 08:32:31 +0000 (UTC)
From: "Peter Wilson" <peter_wilson@mail.com>
Subject: Re: Win32::GUI
Message-Id: <bf32iv$r80$1@titan.btinternet.com>
<jnk@kenobiz.com> wrote in message
news:2ui9hv8uq1oeo7o3m53t0a4g57b8gb1rj5@4ax.com...
> I dont think I explained myself correctly. I dont want to actually
> create any windows. I just want my perl program to "press" an "ok"
> button on an open dialog box so that i dont have to do it. I am just
> trying to automate a process so that i dont have to be present at the
> computer when this dialog box appears and needs clicking.
>
Have you tried looking at sendkeys? (GuiTest module its on www.cpan.org)
http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?search=send+keys&filetype=
+distribution+name+or+description&site=ftp.funet.fi&join=and&stem=no&arrange
=file&case=clike&download=auto&age=
might help?
Peter
------------------------------
Date: Wed, 16 Jul 2003 11:08:24 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Win32::GUI
Message-Id: <l3bahv84iu1iolmvj0224nu52r68s5h7n5@4ax.com>
jnk@kenobiz.com wrote:
>In the documentation that I have read about this module it tells only
>about manipulating the windows that you have created with it. What
>about windows that are already in existence....how can i manipulate
>them. Press buttons, close them and what not.
>
>Should I seek a different module?
IMO: yes.
Using the raw Windows API (module Win32::API), you have to find the
proper window handle, by traversing the window and subwindows tree. If
you can read VB, you can find some inspiration in the code
(FindWindowLike) here:
<http://support.microsoft.com/support/kb/articles/Q147/6/59.asp>
And when you have it, you could use SendMessage (or its brother
PostMessage) to actually produce an event. For the basic concept, search
for "SendMessage" and go to the first result, here:
<http://msdn.microsoft.com/library/default.asp>
(The actual resulting URL is far too long to quote here: 191 characters)
Again, much of the more readable sample code is in VB. For example,
here:
<http://home.att.net/~geekStuff/wshAvoidingSendkeysPage.htm>
That page describes pretty much what you're trying to do here. Now it's
only just a matter of translating the VB code to Perl, using
Win32::API... piece of cake :) Well, it's not *too* bad.
--
Bart.
------------------------------
Date: 16 Jul 2003 05:53:42 -0700
From: joeminga@yahoo.com (Domenico Discepola)
Subject: Re: Win32::OLE, Excel and OLE Automation question
Message-Id: <698c67f.0307160453.5d14bb97@posting.google.com>
"A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu> wrote in message news:<Xns93B95B725E3A7asu1cornelledu@132.236.56.8>...
> joeminga@yahoo.com (Domenico Discepola) wrote in
> news:698c67f.0307150434.998152e@posting.google.com:
>
> > Thanks for the reply
>
> You are wlcome.
>
> ...
> > I then remembered that the Excel workbook was password protected. I
> > added the line: $Sheet->Unprotect("${my_password}"); and it worked
> > fine. Thanks for the Activestate URL...
>
> I am curious: $my_password is simply a string variable, right? Why do you
> use
>
> $Sheet->Unprotect("${my_password}");
>
> rather than
>
> $Sheet->Unprotect($my_password);
>
> It seems to work, but I'd like to know if there is any reason to prefer
> the former.
>
> Sinan
Force of habit from my UNIX shell programming days I guess. In any
case, I tried to 'break' the program by setting the ${my_password}
variable = "blah.blah" (with a metacharacter), plus other combinations
and $Sheet->Unprotect($my_password); still worked fine. I guess I
should take a refresher look at quoting, braces and variables...
------------------------------
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 5228
***************************************