[30699] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1944 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 24 21:09:42 2008

Date: Fri, 24 Oct 2008 18:09:11 -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           Fri, 24 Oct 2008     Volume: 11 Number: 1944

Today's topics:
        DBI Oracle dbms_application_info package <balvey27@gmail.com>
    Re: Filehandle STDIN reopened as $fh1 only for output <nospam-abuse@ilyaz.org>
    Re: Format for data exchange? <tzz@lifelogs.com>
    Re: Help: Nested quantifiers in regex Problem <openlinuxsource@gmail.com>
        OT: test (fidokomik\)
    Re: OT: test <jurgenex@hotmail.com>
    Re: OT: test <jurgenex@hotmail.com>
    Re: OT: test (fidokomik\)
        system() behavior <skochkarev@gmail.com>
    Re: system() behavior (Darren Dunham)
    Re: system() behavior xhoster@gmail.com
    Re: system() behavior <jurgenex@hotmail.com>
    Re: test <rvtol+news@isolution.nl>
    Re: Unix, Perl, IE, and Excel <glex_no-spam@qwest-spam-no.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 24 Oct 2008 11:04:20 -0700 (PDT)
From: Ben <balvey27@gmail.com>
Subject: DBI Oracle dbms_application_info package
Message-Id: <a3b5a7b4-2623-4333-a2f9-03ceadca3f39@i76g2000hsf.googlegroups.com>

Here's my environment information

mach1> perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 2)
configuration:
  Platform:
    osname=aix, osvers=5.2.0.0, archname=aix-thread-multi
    uname='aix animals 2 5 000709cf4c00 '
    config_args=''
    hint=previous, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef

using DBI for an Oracle database connection to a 10.2.0.2 version
database.

Is it possible or logical to use the
dbms_application_info.set_session_longops procedure to pass
information of long running processes from a perl script? If so how
have you done it?

I typically use dbms_application_info.set_module or set_action to pass
information on the program and area within the program. But I'd like
to use set_session_longops to track the progress of perl scripts from
within the database.



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

Date: Fri, 24 Oct 2008 19:40:33 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Filehandle STDIN reopened as $fh1 only for output
Message-Id: <gdt8bh$1q5k$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Eric Pozharski 
<whynot@pozharski.name>], who wrote in article <slrngg2pa1.1vm.whynot@orphan.zombinet>:
> On 2008-10-23, Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> *SKIP*
> > The 2nd time you open A FILE for writing, OS (again!) chooses the
> > first unused handle, so get handle 0 again.  This time Perl detects
> > that STDIN is opened for write, and decides to warn().

> > This time Perl heuristic is wrong, and this warning is not relevant.
> > You can selectively disable it, as another poster recommends.

> What heuristic?

Compiler warnings are always heuristic:

 "I see something fishy".

 Should I risk to annoy the user if this is an intended behaviour?  Is
 this annoyance balanced against having good enough chance that this
 behaviour is not intended?

This is a difference between compiler warnings and compliler errors...

Hope this helps,
Ilya


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

Date: Fri, 24 Oct 2008 12:15:15 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Format for data exchange?
Message-Id: <86ej253of0.fsf@lifelogs.com>

On Thu, 23 Oct 2008 07:17:44 -0700 (PDT) Roy M <setesting001@gmail.com> wrote: 

RM> We are using XMLRPC to communicate between servers (cross languages
RM> with PHP and Java)  for many years.

RM> Seems nowadays better choices would be YAML, JSON or even Google
RM> protocol buffer?

RM> Which format your are using, and why?

If XML-RPC works, keep using it.  You can always switch to XML if you
must.

If you need to optimize for speed and your data changes rarely, Google
protocol buffers are decent.

Otherwise, JSON can handle almost anything I've thrown at it, as long as
you're OK with its serialization rules and data types.

Ted


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

Date: Sat, 25 Oct 2008 01:16:50 +0800
From: Amy Lee <openlinuxsource@gmail.com>
Subject: Re: Help: Nested quantifiers in regex Problem
Message-Id: <pan.2008.10.24.15.37.31.652897@gmail.com>

On Fri, 24 Oct 2008 17:51:14 +1100, Martien Verbruggen wrote:

> On Fri, 24 Oct 2008 12:50:23 +0800,
> 	Amy Lee <openlinuxsource@gmail.com> wrote:
>> Hello,
>>
>> I use qw to make a list with
>> my @sample = qw/"A..." "A..+" "A.+." "A+.." "A.++" "A+.+" "A++." "A+++"/;
>> Then there's a list called @ar and I want check whether the element at
>> @sample belongs to @ar. So I wrote the following codes
>> foreach my $item_sample (@sample)
>> {
>>   unless (grep /$item_sample/, @ar) #line 38
>>   {
>>     push @ar, "$item_sample";
>>   }
>> }
>> But wehn I run my script it shows following error messages
>> Nested quantifiers in regex; marked by <-- HERE in m/"A.++ <-- HERE "/
>>     at ./x.pl line 38, <> line 44.
>>
>> So I really feel very confused about it. Could you tell me why it happens
>> and how can I fix that?
> 
> In the above $item_sample is being treated as a regular expression. A
> few of the things in @sample are simply not valid regular expressions. I
> am assuming that you actually didn't mean them to be regular
> expressions and that you wanted to check for string equality.
> 
> Also, are you aware that the strings you're looking at have double
> quotes in them as well? Did you mean them to have those quotes in them?
> 
> There are a few ways in which you can fix this.
> 
> The minimal change is to correctly quote any metacharacters in the
> regular expression (see the perlre documentation)
> 
> Change one line (your line 38):
> 
>    unless (grep /\Q$item_sample/, @ar) #line 38
> 
> This does, however, probably not the right thing. It checks whether
> $item_sample is PART of one of the elements of @ar. If you had "A+++"
> and "A++" in that order in @sample, the second element would not end up
> in @ar. I doubt that that was intentional.
> 
> You could anchor the regex at the start and end, but it would probably
> be better to simply say what (I think) you mean, and test for equality:
> 
>   unless (grep {$_ eq $item_sample} @ar) #line 38
> 
> This still is rather inefficient, because you have to loop through the
> whole of @ar for every element of @sample. For small arrays that makes
> no difference, but for larger arrays that is a problem.
> 
> I think that what you're trying to do is to assign the unique elements
> of @sample to @ar, right? The canonical way to do that in Perl is by
> using a hash:
> 
> my %seen;
> my @ar = grep { ! $seen{$_}++ } @sample;
> 
> (Note that grep is used here only ones. These two lines are meant to
> replace all the code you quoted above, not just line 38.)
> 
> Also check out the perlFAQ entry in perlfaq4 with the title "How can I
> remove duplicate elements from a list or array?" This entry also
> descibes this method with an explicit loop, instead of grep, which you
> might find easier.
> 
> Martien
Thank you guys, I use \Q to solve that. Really thank you very much.


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

Date: Fri, 24 Oct 2008 18:43:14 +0200
From: "Petr Vileta \(fidokomik\)" <stoupa@practisoft.cz>
Subject: OT: test
Message-Id: <gdsu0i$bet$1@ns.felk.cvut.cz>

I test only if message will go across all NNTP servers.

-- 
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. 
Send me your mail from another non-spammer site please.)
Please reply to <petr AT practisoft DOT cz>



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

Date: Fri, 24 Oct 2008 11:24:22 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: OT: test
Message-Id: <fj44g4plc76t7fml2q371drffreqjcehkq@4ax.com>

"Petr Vileta \(fidokomik\)" <stoupa@practisoft.cz> wrote:
>I test only if message will go across all NNTP servers.

How exactly are you going to confirm this considering that there are
thousand and thousands of NNTP servers?
Had you posted to one of the text NGs, then at least you would have
gotten autoresponses from some of those servers.

jue


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

Date: Fri, 24 Oct 2008 11:47:16 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: OT: test
Message-Id: <0064g45ms2ua303uqvieellkq4e2kkl5vl@4ax.com>

Jürgen Exner <jurgenex@hotmail.com> wrote:
>Had you posted to one of the text NGs, then at least you would have
>gotten autoresponses from some of those servers.

Never post until you had your second cup of coffee: 
	s/text/test/ 
of course

jue


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

Date: Sat, 25 Oct 2008 02:36:37 +0200
From: "Petr Vileta \(fidokomik\)" <stoupa@practisoft.cz>
Subject: Re: OT: test
Message-Id: <gdtptv$2ola$1@ns.felk.cvut.cz>

Jürgen Exner wrote:
> "Petr Vileta \(fidokomik\)" <stoupa@practisoft.cz> wrote:
>> I test only if message will go across all NNTP servers.
>
> How exactly are you going to confirm this considering that there are
> thousand and thousands of NNTP servers?

I read this group as news from news.felk.cvut.cz NNTP server. Few month ago 
something was be wrong and when I sent message I got it back to my news client 
but this message never crossed our "state border", in other word message never 
came say to groups.google.com.
I tied to use other public NNTP server (for example aiob.cjb.net) but these 
servers have problem with speed or sometime are temporary down etc.
For these reasons I was going back to news.felk.cvut.cz but I sent the "test" 
message to see if this message will appear in google groups. Today I see my test 
message in google groups so all looks fine.

-- 
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail.
Send me your mail from another non-spammer site please.)
Please reply to <petr AT practisoft DOT cz>



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

Date: Fri, 24 Oct 2008 10:18:54 -0700 (PDT)
From: "skochkarev@gmail.com" <skochkarev@gmail.com>
Subject: system() behavior
Message-Id: <3192494e-a877-43f9-8f6f-d7979ce1d363@c60g2000hsf.googlegroups.com>

Hi,

I'm new to perl and find it strange sometimes. So, my question is.

As stated to perldoc, system() does not output. This is true for my
console application. But when I port it to Apache/cgi, it starts to
display all output. This is highly unwanted. Can I turn it off?

Another question. The `` works just I want with one difference: it
seems like perl does not stop until the `` finishes (but the rest of
my program needs `` finished). What operator should I put to make perl
wait until `` finishes?

Here is the piece of code:

-----------------------------------------------------------------------------------
my $cmdline = "c:\\tools\\decomp.bat";
my $param1 = "$tempdir";
my $param2 = "C:$tempfile";

my @args = ("$cmdline", "\"$param1\"", "\"$param2\"");
------ This operator puts all output to the browser  ------------
system(@args);

------ This operator does not stop processing  ------------
my $output = `$cmdline $param1 $param2`;

------- Code that reads files created by decomp.bat --------

Thanks in advance!


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

Date: Fri, 24 Oct 2008 17:31:57 GMT
From: ddunham@taos.com (Darren Dunham)
Subject: Re: system() behavior
Message-Id: <hEnMk.3176$Ei5.64@flpi143.ffdc.sbc.com>

skochkarev@gmail.com <skochkarev@gmail.com> wrote:
> Hi,
> 
> I'm new to perl and find it strange sometimes. So, my question is.
> 
> As stated to perldoc, system() does not output.

Where does it say that?

system() doesn't output itself, nor does it capture output.  But the
program that system() runs may output.

> This is true for my
> console application. But when I port it to Apache/cgi, it starts to
> display all output. This is highly unwanted. Can I turn it off?

Have whatever system() is running not output.  Maybe you want to
redirect the output to a file or to /dev/null....

> Another question. The `` works just I want with one difference: it
> seems like perl does not stop until the `` finishes (but the rest of
> my program needs `` finished). What operator should I put to make perl
> wait until `` finishes?

I don't know what youe mean with that sentence.

> 
> Here is the piece of code:


> ------ This operator puts all output to the browser  ------------
> system(@args);
> 
> ------ This operator does not stop processing  ------------
> my $output = `$cmdline $param1 $param2`;

Both system and `` will wait until the command completes before
returning.

-- 
Darren


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

Date: 24 Oct 2008 17:34:27 GMT
From: xhoster@gmail.com
Subject: Re: system() behavior
Message-Id: <20081024133454.036$Tx@newsreader.com>

"skochkarev@gmail.com" <skochkarev@gmail.com> wrote:
> Hi,
>
> I'm new to perl and find it strange sometimes. So, my question is.
>
> As stated to perldoc, system() does not output.

It says that system does not *capture* output.  Instead, the output
leaks out to the started program's stdout, which is usually the same thing
as the parent's STDOUT.

> This is true for my
> console application. But when I port it to Apache/cgi, it starts to
> display all output. This is highly unwanted. Can I turn it off?

redirect stdout to /dev/null, or whatever Windows equiv of that is.

>
> Another question. The `` works just I want with one difference: it
> seems like perl does not stop until the `` finishes

I don't know what that means.  Perl doesn't restart until `` finishes,
it just sits in the `` operation and wait for it finish.

> (but the rest of
> my program needs `` finished). What operator should I put to make perl
> wait until `` finishes?

That is already what it does.


>
> ------ This operator does not stop processing  ------------
> my $output = `$cmdline $param1 $param2`;

What does that mean?  What are you seeing?

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

Date: Fri, 24 Oct 2008 11:20:21 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: system() behavior
Message-Id: <qm34g4la65qu50pgd2jcmfb9o6afhtebc1@4ax.com>

"skochkarev@gmail.com" <skochkarev@gmail.com> wrote:
>As stated to perldoc, system() does not output. 

That is not true. Or maybe it is, depending upon what you mean by "does
not output".
- the system() command does not _produce_ any output. If you want that
use print()
- it also doesn't capture or influence the output generated by the
command that is called. If the called command produces output, then it
will be displayed just as if system() was never involved. 

>This is true for my
>console application. But when I port it to Apache/cgi, it starts to
>display all output. This is highly unwanted. Can I turn it off?

If you script behaves differently from a command line then when run as a
CGI program, then you may want to investigate why. A good place to start
is some CGI newsgroup.
As for turning output off: well, system() doesn't produce any output in
the first place. You will have to silence whatever external command you
are running, maybe by using some option of that command if available or
by redirecting that commands output to a file or /dev/null or something
along that line.

>Another question. The `` works just I want with one difference: it
>seems like perl does not stop until the `` finishes (but the rest of
>my program needs `` finished). 

Ahhhmmm, no. system() and qx() (aka ``) will both stop execution of the
perl program until the external command has returned.
Maybe you are running the external command in the background, such that
the calling shell returns immediately?
 
>What operator should I put to make perl
>wait until `` finishes?

`` does wait for the external program to return. Your problem is with
the external program. Maybe it launches child processes in the
background?

>Here is the piece of code:
>
>-----------------------------------------------------------------------------------
>my $cmdline = "c:\\tools\\decomp.bat";
>my $param1 = "$tempdir";
>my $param2 = "C:$tempfile";
>
>my @args = ("$cmdline", "\"$param1\"", "\"$param2\"");
>------ This operator puts all output to the browser  ------------
>system(@args);

No, it doesn't. system() happily ignores any output from the called
program. It's that external program that creates the output.

jue


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

Date: Fri, 24 Oct 2008 20:44:46 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: test
Message-Id: <gdtcbu.v4.1@news.isolution.nl>

Petr Vileta (fidokomik) schreef:

> Send me your mail from another non-spammer site please.

People that send test messages to non-test groups, are spammers
themselves: bulk + unsollicited.

-- 
Affijn, Ruud

"Gewoon is een tijger."



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

Date: Fri, 24 Oct 2008 10:19:48 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Unix, Perl, IE, and Excel
Message-Id: <4901e795$0$87069$815e3792@news.qwest.net>

Andrew DeFaria wrote:
> J.D. Baldwin wrote:
>> In the previous article, cartercc <cartercc@gmail.com> wrote:
>>> Here's the question: I have a user who wants the data embedded in an 
>>> Excel worksheet right on the web page. Can this be done? The web 
>>> server is Apache coming from Linux, but Userland is 100% Windows.
>> I have been mailing Perl-built Excel spreadsheets for some years with 
>> the excellent Spreadseet::WriteExcel, about which you can read more at
>>
>> http://search.cpan.org/dist/Spreadsheet-WriteExcel/lib/Spreadsheet/WriteExcel.pm
> Seemed to me to be a simple "How do I use Perl to interface with 
> <application X>?" type question. Thanks JD for a simple, graceous and 
> direct answer. I was thinking the same thing, though I had not had the 
> need to actually use that particular CPAN module.
> 
> Now why were those other pinheads to rude and dismissive? Perhaps 
> because they let their egos come before their intelligence? That's my 
> guess...

A better 'guess' would be that your statement was interpreted
differently, then what you intended.

I read 'embedded' as they wanted the application (Excel) 'embedded'
in the Web page, which requires iframe/object.

Had you written that sentence to say that you wanted to display
the data from Excel in HTML tables or using CSS, then you would
have received a pointer to CPAN or Spreadsheet::WriteExcel much
sooner.


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 1944
***************************************


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