[25433] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7678 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 21 14:06:02 2005

Date: Fri, 21 Jan 2005 11:05:27 -0800 (PST)
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, 21 Jan 2005     Volume: 10 Number: 7678

Today's topics:
        "Can't modify non-lvalue subroutine call" furrows my br <rick@rickcasey.net>
    Re: "Can't modify non-lvalue subroutine call" furrows m (Anno Siegel)
    Re: "Can't modify non-lvalue subroutine call" furrows m <1usa@llenroc.ude.invalid>
    Re: "Can't modify non-lvalue subroutine call" furrows m <nobull@mail.com>
    Re: "Can't modify non-lvalue subroutine call" furrows m <mritty@gmail.com>
        [VERY OT] Seeya all! <bik.mido@tiscalinet.it>
    Re: [VERY OT] Seeya all! <wyzelli@yahoo.com>
        ANNOUNCE: Zoidberg 0.93 <j.g.karssenberg@student.utwente.nl>
    Re: Catch stdout from eval possible xhoster@gmail.com
        cgi scripts stops executing? squash@peoriadesignweb.com
    Re: cgi scripts stops executing? <jgibson@mail.arc.nasa.gov>
        Compare 2 files and put the matching part in a 3rd file <bernac001@aol.com>
    Re: Compare 2 files and put the matching part in a 3rd  <do-not-use@invalid.net>
    Re: Compare 2 files and put the matching part in a 3rd  <bernac001@aol.com>
    Re: Compare 2 files and put the matching part in a 3rd  <do-not-use@invalid.net>
    Re: Compare 2 files and put the matching part in a 3rd  <someone@example.com>
    Re: CRAXDDRT problems <THarmon@ftb.com>
    Re: CRAXDDRT problems <THarmon@ftb.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 21 Jan 2005 08:54:17 -0800
From: "rickcasey" <rick@rickcasey.net>
Subject: "Can't modify non-lvalue subroutine call" furrows my brow
Message-Id: <1106326457.245696.272500@z14g2000cwz.googlegroups.com>

I modified a small subroutine in a larger Perl module that we are
attempting to port from a version that uses a commercial database
(Sybase) to an open source one (PostGres). One small modification has
resulted in this error message that I don't understand:
"Can't modify non-lvalue subroutine call at
lib/NHGRI/LDM/TableManager.pm line 1159."

1) does the message mean I cannot modify this subroutine at all?
2) or, hopefully, is there something wrong with my Perl syntax?
(judging from other group messages that also mention this error, I hope
it's the latter.)

TIA,
Rick


Here is what the code looks like around line 1159:

sub getQuotableFieldsHash {
my $self     = shift;
my $dbh      = $self->{dbc}->connect;
my $table    = $self->{table};
my $db_type = $self->getDBD();
my %quotable = ();
my %quoted_types = ();
my $sql;

if ($db_type eq "Sybase") {
%quoted_types = (text => 1, varchar => 1, char => 1, datetime => 1);
$sql   = qq!
SELECT c.name as Field,
t.name as Type
FROM   sysobjects o, syscolumns c, systypes t
WHERE  c.id = o.id
AND  t.usertype = c.usertype
AND  o.name = '$table'!;

} elsif ($db_type eq "Oracle") {
%quoted_types = (varchar2 => 1, nvarchar2 => 1, long => 1, char => 1,
nchar => 1, date => 1, clob => 1, nclob => 1);
$sql = qq!
SELECT column_name, data_type
FROM all_tab_columns
WHERE table_name = '$table'
!;
} elsif ($db_type eq "Pg") {
# (rc, 20Jan05)
# Here is where the SQL must get all columns in all tables from
PostGres system tables,
# Here, we make use of the convenient system view Columns in
information_schema.
%quoted_types = (varchar2 => 1, nvarchar2 => 1, long => 1, char => 1,
nchar => 1, date => 1, clob => 1, nclob => 1);
$sql = qq!
select column_name, data_type
from information_schema.columns
WHERE table_name = '$table'
!;
}

1159-->	$dbh->errstr = $dbh->errstr . $sql;
my $ra_result = $dbh->selectall_arrayref($sql) or croak
$dbh->errstr;

foreach my $ra_row (@{$ra_result}) {
my $dtype = lc($ra_row->[1]);
my $field_name = $ra_row->[0];
$field_name = uc($field_name);  #if ($db_type eq "Oracle");
$quotable{$field_name} = 1 if $quoted_types{$dtype};
}
    

    return \%quotable;



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

Date: 21 Jan 2005 18:09:21 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: "Can't modify non-lvalue subroutine call" furrows my brow
Message-Id: <csrggh$nfh$1@mamenchi.zrz.TU-Berlin.DE>

rickcasey <rick@rickcasey.net> wrote in comp.lang.perl.misc:
> I modified a small subroutine in a larger Perl module that we are
> attempting to port from a version that uses a commercial database
> (Sybase) to an open source one (PostGres). One small modification has

So what *was* the modification?  You're hiding info that would help
enormously in telling what is going on.

> resulted in this error message that I don't understand:
> "Can't modify non-lvalue subroutine call at
> lib/NHGRI/LDM/TableManager.pm line 1159."
> 
> 1) does the message mean I cannot modify this subroutine at all?

It's not modification of the sub that fails (you're not attempting that).
It's assignment to the *call* of a subroutine (a method, in this case),
that doesn't work without additional measures.

> 2) or, hopefully, is there something wrong with my Perl syntax?
> (judging from other group messages that also mention this error, I hope
> it's the latter.)

Your syntax is fine.  It wouldn't compile otherwise.

[code snipped]

> 1159-->	$dbh->errstr = $dbh->errstr . $sql;

Assigning to a method call is only possible if the method is declared an
"lvalue" routine.  That is apparently not the case.  I'll assume that
the class of $dbh is not yours, so you can't change that.

Look up the documentation of the ->errstr method and see how to change
an error string.  If ->errstr is like many accessor methods,

    $dbh->errstr( $dbh->errstr . $sql);

may work, but that's just a guess.

Anno


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

Date: 21 Jan 2005 17:18:08 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: "Can't modify non-lvalue subroutine call" furrows my brow
Message-Id: <Xns95E57D25529CFasu1cornelledu@132.236.56.8>

"rickcasey" <rick@rickcasey.net> wrote in news:1106326457.245696.272500
@z14g2000cwz.googlegroups.com:

> 1159-->     $dbh->errstr = $dbh->errstr . $sql;

Compare with the following:

use strict;
use warnings;

sub dontmodify { "I said, don't modify!!!" }

dontmodify = 5;

__END__


Sinan


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

Date: Fri, 21 Jan 2005 17:53:31 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: "Can't modify non-lvalue subroutine call" furrows my brow
Message-Id: <csrf8u$920$1@sun3.bham.ac.uk>



rickcasey wrote:

> I modified a small subroutine in a larger Perl module that we are
> attempting to port from a version that uses a commercial database
> (Sybase) to an open source one (PostGres). One small modification has
> resulted in this error message that I don't understand:
> "Can't modify non-lvalue subroutine call at
> lib/NHGRI/LDM/TableManager.pm line 1159."
> 
> 1) does the message mean I cannot modify this subroutine at all?

What do you mean by "modify" and "this subroutine"?

The DBI method strerr is not non-lvalued.  It just returns a value.  You 
cannot use it on the left of an assignment statement.

This means it is wrong to say

   $dbh->errstr = $dbh->errstr . $sql;

Is this the line you changed?

What did it say before you changed it?



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

Date: Fri, 21 Jan 2005 18:00:41 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: "Can't modify non-lvalue subroutine call" furrows my brow
Message-Id: <drbId.13041$qu2.9468@trndny08>

"rickcasey" <rick@rickcasey.net> wrote in message
news:1106326457.245696.272500@z14g2000cwz.googlegroups.com...
> I modified a small subroutine in a larger Perl module that we are
> attempting to port from a version that uses a commercial database
> (Sybase) to an open source one (PostGres). One small modification has
> resulted in this error message that I don't understand:
> "Can't modify non-lvalue subroutine call at
> lib/NHGRI/LDM/TableManager.pm line 1159."
>
> 1) does the message mean I cannot modify this subroutine at all?
> 2) or, hopefully, is there something wrong with my Perl syntax?
> (judging from other group messages that also mention this error, I
hope
> it's the latter.)

If you don't know what an error message means, you can always look it up
in
perldoc perldiag

or even have Perl tell you itself, by adding
use diagnostics;
to your code (when developing - not recommended for released code)

> Here is what the code looks like around line 1159:

<snip>

> 1159--> $dbh->errstr = $dbh->errstr . $sql;

<snip>

So do you see what you've done wrong, when comparing this code to the
explanation of the error message?  If not, feel free to post back with
what part of the documentation you're having difficulty understanding.

Paul Lalli



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

Date: Thu, 20 Jan 2005 20:56:45 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: [VERY OT] Seeya all!
Message-Id: <5920v0hg7oeocelneqvj514h20partgbck@4ax.com>

Dear all,


I can't go on like this any more: I must take this f**ked up degree!
So what? Well, I realize that if I'm _really_ serious about this then
I must abandon a whole series of distractions, and I'd include taking
part to discussions here in the (black-)list.

So it's with considerable sadness that I greet you all for some time.
I've learnt more about Perl here than anywhere else, and I've not only
learnt about Perl! Also I hope to have contributed helping others...

Of course it's not all clpmisc's fault, but indeed if I stop lying to
myself I must admit it's a bigger time sink than I've ever recognized.
And it's one out of many!

So I will still follow recent threads for followups directly addressed
to me and in a few days I will leave altoghether. (Well occasionally
I'll pay a visit to perlmonks.org not to loose the good habit - it's
not so addictive _for me_.)


Hope to be back soon,
Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Thu, 20 Jan 2005 22:13:47 GMT
From: "Peter Wyzl" <wyzelli@yahoo.com>
Subject: Re: [VERY OT] Seeya all!
Message-Id: <v2WHd.126388$K7.97116@news-server.bigpond.net.au>

"Michele Dondi" <bik.mido@tiscalinet.it> wrote in message 
news:5920v0hg7oeocelneqvj514h20partgbck@4ax.com...
: Dear all,
:
:
: I can't go on like this any more: I must take this f**ked up degree!
: So what? Well, I realize that if I'm _really_ serious about this then
: I must abandon a whole series of distractions, and I'd include taking
: part to discussions here in the (black-)list.
:
: So it's with considerable sadness that I greet you all for some time.
: I've learnt more about Perl here than anywhere else, and I've not only
: learnt about Perl! Also I hope to have contributed helping others...
:
: Of course it's not all clpmisc's fault, but indeed if I stop lying to
: myself I must admit it's a bigger time sink than I've ever recognized.
: And it's one out of many!
:
: So I will still follow recent threads for followups directly addressed
: to me and in a few days I will leave altoghether. (Well occasionally
: I'll pay a visit to perlmonks.org not to loose the good habit - it's
: not so addictive _for me_.)

Sad choice, Good choice.  Wish you well for the study!  You have taught me 
some things so your contribution here has been useful (I know more than just 
to me).

All the best.

P
-- 
print "Just another Perl Hacker";




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

Date: Fri, 21 Jan 2005 13:33:01 GMT
From: Jaap Karssenberg <j.g.karssenberg@student.utwente.nl>
Subject: ANNOUNCE: Zoidberg 0.93
Message-Id: <IAo6nI.1CLK@zorch.sf-bay.org>

Just uploaded zoidberg 0.93 to CPAN.

Zoidberg (a.k.a. zoid) provides a modular Perl shell written,
configured, and operated entirely in Perl. It aspires to be a fully
operational login shell with all the features one normally
expects. But it also gives direct access to Perl objects and data
structures from the command line, and allows you to run Perl code
within the scope of your command line.

This is mainly a bugfix release: a serious bug in the evaluation of
logic operators was fixed, delayed jobs now remember their PWD and the
'fc' builtin should work correctly now. It also contains some
documentation updates and two example scripts were added.

To install try 'cpan Bundle::Zoidberg'

For downloading see http://zoidberg.student.utwente.nl/download.shtml

The new arch archive is pardus@cpan.org--Perl-GPL/Zoidberg--main--0.94

-- 
    )   (     Jaap Karssenberg || Pardus [Larus]                | |0| |
    :   :     http://pardus-larus.student.utwente.nl/~pardus    | | |0|
  )  \ /  (                                                     |0|0|0|
  ",.*'*.,"   Proud owner of "Perl6 Essentials" 1st edition :)  wannabe




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

Date: 20 Jan 2005 17:28:39 GMT
From: xhoster@gmail.com
Subject: Re: Catch stdout from eval possible
Message-Id: <20050120122839.075$zb@newsreader.com>

mikael.petterson@nospam.se wrote:
> Hi,
>
> When I execute the jar command with eval I want to catch STDOUT.

You are not executing the jar command with eval.  You are executing
it with backticks.

> Is it possible? How?
>
> This is the line I am trying to execute.
> ********
> eval{`jar -cvf ${data_type}.jar -C $root_dir\/${data_type}`};

my $stdout = `jar -cvf ${data_type}.jar -C $root_dir\/${data_type}`;

I don't know why the eval is necessary, or why you think it is necessary.
So I did away with it.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 20 Jan 2005 11:56:50 -0800
From: squash@peoriadesignweb.com
Subject: cgi scripts stops executing?
Message-Id: <1106251010.239866.259090@z14g2000cwz.googlegroups.com>

I have a cgi perl script that appears to randomly stop executing. Is
this a known issue with cgi scripts or is there some bug in my
programming logic? It seems to happen when the server is slow to
respond to the user request so the user gets impatient and starts
double clicking on the link. Does this result in some requests not
going through all the way and just terminating in the middle of
execution?
I am hoping it is a bug in my program and not perl/cgi!

Thx!



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

Date: Thu, 20 Jan 2005 12:45:14 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: cgi scripts stops executing?
Message-Id: <200120051245148239%jgibson@mail.arc.nasa.gov>

In article <1106251010.239866.259090@z14g2000cwz.googlegroups.com>,
<squash@peoriadesignweb.com> wrote:

> I have a cgi perl script that appears to randomly stop executing. Is
> this a known issue with cgi scripts or is there some bug in my
> programming logic? It seems to happen when the server is slow to
> respond to the user request so the user gets impatient and starts
> double clicking on the link. Does this result in some requests not
> going through all the way and just terminating in the middle of
> execution?
> I am hoping it is a bug in my program and not perl/cgi!

Your hopes will be realized. Perl/CGI programs can, like other computer
programs, produce what appears to be random effects, including
termination. It is much more likely that these are due to a bug in your
program rather than a bug in Perl. There are very few bugs left in
Perl. Those few that remain are considered "features" by some and
cannot be removed.

CGI is an interface specification, and as such has no bugs, just
features. Any implementation trying to conform to the CGI spec can have
bugs, however. There is one popular Perl module called CGI.pm. Are you
using that? It doesn't have many bugs, though, having been around a
long time and used by many.

Seriously, multiple submissions of a form causing terminations are an
indication of a race condition or other synchronization problem. What
do your server logs tell you?

You will have to post some code if you really want help from others.
You also need to describe your environment a little better. What Perl?
What web server? What OS?


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


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

Date: Fri, 21 Jan 2005 15:50:23 +0100
From: BerNaC <bernac001@aol.com>
Subject: Compare 2 files and put the matching part in a 3rd file
Message-Id: <mn.abb67d519ce75a90.18030@aol.com>

Hi all,

I need to compare two text files and put the maching result in another 
file. Does anybody have an idea?

file1                  file2         comprare and match=                
     file3
------              -----------                                         
                   -----------
1                           3                                           
                            3
2                           4                                           
                            4
3                           5                                           
                            5
4                           6
5                           7


Thank you

-- 
-----------------------
BerNaC
___________



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

Date: 21 Jan 2005 16:03:13 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Compare 2 files and put the matching part in a 3rd file
Message-Id: <yzd8y6mlt8u.fsf@invalid.net>


BerNaC <bernac001@aol.com> writes:
> 
> I need to compare two text files and put the maching result in another
> file. Does anybody have an idea?

Is anything known about the format of the files and in what ways they
can differ? Doing a general comparison and present the differences as
a minimal set of individual differences is quite complex. In that case
I would choose running the Unix 'diff' program on the files and
post-process the output.

CPAN has only "compare and stop when finding a difference", it seems.


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

Date: Fri, 21 Jan 2005 16:26:10 +0100
From: BerNaC <bernac001@aol.com>
Subject: Re: Compare 2 files and put the matching part in a 3rd file
Message-Id: <mn.abda7d510cb12aa6.18030@aol.com>

Arndt Jonasson a formulé ce vendredi :
> BerNaC <bernac001@aol.com> writes:
>> 
>> I need to compare two text files and put the maching result in another
>> file. Does anybody have an idea?
>
> Is anything known about the format of the files and in what ways they
> can differ? Doing a general comparison and present the differences as
> a minimal set of individual differences is quite complex. In that case
> I would choose running the Unix 'diff' program on the files and
> post-process the output.
>
> CPAN has only "compare and stop when finding a difference", it seems.

Well the 2 text files have 1 ID from sendmail log per line, it looks 
like that :

1U34334Y34
1ZRTRG345
2SDFSDF17
and so on

So one file is ID from mail the other one is ID to mail so il they 
match that mean that one mail with this ID has been sent from this guy 
to this guy :).
So as you can see i'm trying to make a script that parse sendmail log 
to find all email from someone to somebody.

-- 
-----------------------
BerNaC
___________



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

Date: 21 Jan 2005 16:47:08 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Compare 2 files and put the matching part in a 3rd file
Message-Id: <yzdvf9qkcn7.fsf@invalid.net>


BerNaC <bernac001@aol.com> writes:
> Arndt Jonasson a formulé ce vendredi :
> > BerNaC <bernac001@aol.com> writes:
> >> I need to compare two text files and put the maching result in
> >> another
> >> file. Does anybody have an idea?
> >
> > Is anything known about the format of the files and in what ways they
> > can differ? Doing a general comparison and present the differences as
> > a minimal set of individual differences is quite complex. In that case
> > I would choose running the Unix 'diff' program on the files and
> > post-process the output.
> >
> > CPAN has only "compare and stop when finding a difference", it seems.
> 
> Well the 2 text files have 1 ID from sendmail log per line, it looks
> like that :
> 
> 1U34334Y34
> 1ZRTRG345
> 2SDFSDF17
> and so on
>
> So one file is ID from mail the other one is ID to mail so il they
> match that mean that one mail with this ID has been sent from this guy
> to this guy :).
> So as you can see i'm trying to make a script that parse sendmail log
> to find all email from someone to somebody.

That seems to mean that no valuable information is lost if you sort
the files first, which makes the job of comparing them much easier (I'd
say trivial, but maybe that's overstating it). Is that enough for an
idea, or is there some particular aspect of it which you don't know
how to do in Perl?

If the files are not very large, reading in their contents into perl (*)
and sorting there will be OK, otherwise it's better to sort them on disk.

(*) "perl", "Perl", what do I want here? I want a
"case-doesn't-matter-perl"...


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

Date: Fri, 21 Jan 2005 18:59:46 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Compare 2 files and put the matching part in a 3rd file
Message-Id: <CicId.134864$KO5.57461@clgrps13>

BerNaC wrote:
> 
> I need to compare two text files and put the maching result in another 
> file. Does anybody have an idea?
> 
> file1                  file2         comprare and match=                
>     file3
> ------              -----------                                         
>                   -----------
> 1                           3                                           
>                            3
> 2                           4                                           
>                            4
> 3                           5                                           
>                            5
> 4                           6
> 5                           7

$ perl -ne'$a?$x{$_}&&print:$x{$_}++;$a||=eof' file1 file2
3
4
5


John
-- 
use Perl;
program
fulfillment


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

Date: 20 Jan 2005 11:44:59 -0800
From: "Grixxly" <THarmon@ftb.com>
Subject: Re: CRAXDDRT problems
Message-Id: <1106250299.877759.112220@c13g2000cwb.googlegroups.com>

Okay, I did a little more research and found the error I'm getting;
didn't realize OLE puts the error somewhere else. I'm getting:
"Win32::OLE(0.1702) error 0x800401f3: "Invalid class string" at
C:\GFS\Reports\CLOSEReports_2.pl line 17." The line it's referencing is
as follows: "$CRRptApp = Win32::OLE->new("CRAXDDRT.Report") or die
Win32::OLE->LastError();" And according to the OLE browser that was
installed with ActiveState that library/class do exist within the
Win32::OLE module. Could that mean that I have an incomplete module? Do
I need to make perl aware of craxddrt.dll? How would I do that?
Thanks,
Tony



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

Date: 20 Jan 2005 13:32:43 -0800
From: "Grixxly" <THarmon@ftb.com>
Subject: Re: CRAXDDRT problems
Message-Id: <1106256763.075730.250250@c13g2000cwb.googlegroups.com>

Back... I did some more research and found the program oleview, turns
out the dll is called CRAXDDRT.dll but the progid for the object is
actually CrystalReport.CrystalReport.8.5 at least that's one class
within the library. So with that, do I trust the rest of the ole
browser documentation was correct or how do I find out for sure what
properties/methods are available?

Thanks,
Tony



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

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 V10 Issue 7678
***************************************


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