[23093] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5314 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 5 14:16:26 2003

Date: Tue, 5 Aug 2003 11:15:51 -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           Tue, 5 Aug 2003     Volume: 10 Number: 5314

Today's topics:
        Bug or feature: using array references <ulit_see_signature@fs.tum.de>
    Re: Bug or feature: using array references <bigj@kamelfreund.de>
    Re: Bug or feature: using array references <mjcarman@mchsi.com>
    Re: Bug or feature: using array references (Tad McClellan)
    Re: Bug or feature: using array references <ulit_see_signature@fs.tum.de>
    Re: Bug or feature: using array references <nobull@mail.com>
    Re: ccperl Mailing <g4rry_sh0rt@zw4llet.com>
    Re: ccperl Mailing (Bob)
    Re: CGI Programmers needed  to hack around at our CGI S <njh@despammed.com>
    Re: CGI.pm and foreach <REMOVEsdnCAPS@comcast.net>
    Re: CGI.pm and foreach (Tad McClellan)
    Re: CGI.pm and foreach <REMOVEsdnCAPS@comcast.net>
    Re: CGI.pm and foreach (Tad McClellan)
    Re: CGI.pm and foreach <hyagillot@tesco.net>
    Re: Command or script to get a list of email addresses <12firebird@attbi.com>
    Re: convert string to <> ( multipul matches) <bdonlan@bd-home-comp.no-ip.org>
    Re: convert string to <> ( multipul matches) <grazz@pobox.com>
    Re: convert string to <> ( multipul matches) (Tad McClellan)
        CPAN update (Yang Xiao)
    Re: CPAN update <bdonlan@bd-home-comp.no-ip.org>
    Re: CPAN update <NOSPAM@bigpond.com>
        Cplex hangs in Perl system command (Wei)
    Re: Cplex hangs in Perl system command <rubin@msu.edu>
        DBD::ODBC with UnixODBC error... (Andrew Burton)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 05 Aug 2003 13:45:07 +0200
From: Uli Tuerk <ulit_see_signature@fs.tum.de>
Subject: Bug or feature: using array references
Message-Id: <3F2F98C3.4060503@fs.tum.de>


Hi all!

Just curious, if I misunderstood somehow references:


	my @words = ('a+b', 'A+B');
	my $search_array_ref = \@words;

	print "@words \n";
	
	foreach my $array_entry (@{$search_array_ref}) {
		$array_entry =~ s/\+//;
		# do more with $array_entry...
	}
	
	print "@words \n";


produces:

a+b A+B
ab AB

Why? I only use the reference to get the array content and read it 
element by element, but I don't touch it.
It works when I create a new array from the reference. The original 
foreach loop was in a function; that's why I use a reference to the array.

Thanks a lot for every comment on this!

Uli

--

Pleas remove "_see_signature" from user name.



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

Date: Tue, 05 Aug 2003 15:10:39 +0200
From: "Janek Schleicher" <bigj@kamelfreund.de>
Subject: Re: Bug or feature: using array references
Message-Id: <pan.2003.08.05.13.10.37.818437@kamelfreund.de>

Uli Tuerk wrote at Tue, 05 Aug 2003 13:45:07 +0200:

> Just curious, if I misunderstood somehow references:
> 
> 
> 	my @words = ('a+b', 'A+B');
> 	my $search_array_ref = \@words;
> 
> 	print "@words \n";
> 	
> 	foreach my $array_entry (@{$search_array_ref}) {
> 		$array_entry =~ s/\+//;
> 		# do more with $array_entry...
> 	}
> 	
> 	print "@words \n";
> 
> 
> produces:
> 
> a+b A+B
> ab AB
> 
> Why? I only use the reference to get the array content and read it 
> element by element, but I don't touch it.
> It works when I create a new array from the reference. The original 
> foreach loop was in a function; that's why I use a reference to the array.

From
perldoc perlsyn
(under Foreach Loops)

       If any element of LIST is an lvalue, you can modify it by
       modifying VAR inside the loop.  Conversely, if any element
       of LIST is NOT an lvalue, any attempt to modify that
       element will fail.  In other words, the "foreach" loop
       index variable is an implicit alias for each item in the
       list that you're looping over.

That means that the $array_entry variable is really only an _alias_ for
each element of the array and not a _copy_ of it.

So it's a feature, not a bug. And it's an important feature, as it makes
changing all elements of an array very easy. Just compare the C-style

for my $i (0 .. $#array) {    # $#array holds the last index of the array
   do something with $array[i]
}

with

foreach my $entry (@array) {
    do something with $entry
}

or shorter:

foreach (@array) {
    do something with $_
}


Greetings,


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

Date: Tue, 05 Aug 2003 07:27:30 -0500
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: Bug or feature: using array references
Message-Id: <bgo7rj$br2@onews.rockwellcollins.com>

On 8/5/2003 6:45 AM, Uli Tuerk wrote:
> 
> Just curious, if I misunderstood somehow references:
> 
> 	my @words = ('a+b', 'A+B');
> 	my $search_array_ref = \@words;
> 
> 	print "@words \n";
> 	
> 	foreach my $array_entry (@{$search_array_ref}) {
> 		$array_entry =~ s/\+//;
> 		# do more with $array_entry...
> 	}
> 	
> 	print "@words \n";
> 
> produces:
> 
> a+b A+B
> ab AB

The behavior is a feature, but has nothing to do with the reference:

    my @words = ('a+b', 'A+B');
    print "@words\n";
    foreach my $array_entry (@words) {
        $array_entry =~ s/\+//;
    }
    print "@words\n";

produces the same results.

> Why? I only use the reference to get the array content and read it 
> element by element, but I don't touch it.

Yes, you do. This line:

    $array_entry =~ s/\+//;

modifies the elements. The reason is that foreach() implicitly aliases
the loop variable to each element of the list it iterates over. That
means that the first time through the loop, $array_entry is the same as
$words[0], the second time it's the same as $words[1], etc. So if you
modify $array_entry, you're actually modifying the data in the original
array. If you want to modify a copy, you'll have to make one:

    foreach my $array_entry (@words) {
        my $copy = $array_entry;
        $copy =~ s/\+//;
        #...
    }

> It works when I create a new array from the reference.

That's because you've made a _copy_, so you aren't mucking with the
original.

Side note: be careful about saying things like "it works" or "it doesn't
work." People typically use those phrases to mean that it does(n't) do
what they _expected_. If you aren't clear about what you expected, then
saying "it works" is meaningless.

> The original foreach loop was in a function; that's why I use a
> reference to the array.

Ah. Remember that a reference is just that; it _refers_ to something
else. So if you modify something through a reference, you modify the
thing it refers to:

    my @nums  = (1 .. 3);
    my $ref   = \@nums;
    $ref->[0] = 4;
    print $nums[0]; # prints '4'

-mjc



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

Date: Tue, 5 Aug 2003 08:00:24 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Bug or feature: using array references
Message-Id: <slrnbivaj8.eqf.tadmc@magna.augustmail.com>

Uli Tuerk <ulit_see_signature@fs.tum.de> wrote:


> Just curious, if I misunderstood somehow references:


The cause of your misunderstanding has nothing to do with references.

It has to do with the "aliasing" feature of foreach.


> 	foreach my $array_entry (@{$search_array_ref}) {
> 		$array_entry =~ s/\+//;


> Why? I only use the reference to get the array content and read it 
> element by element, but I don't touch it.


Perl's foreach is described in perlsyn.pod:

   If any element of LIST is an lvalue, you can modify it by 
   modifying VAR inside the loop.

You are modifying VAR inside the loop.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 05 Aug 2003 18:18:42 +0200
From: Uli Tuerk <ulit_see_signature@fs.tum.de>
Subject: Re: Bug or feature: using array references
Message-Id: <3F2FD8E2.7060301@fs.tum.de>


Thanks for the info, folks!
After more than one year of programming with Perl, there are always 
things to discover. Especially all those "dangerous" things going on in 
the "background" one is normally not aware of....

Greetings!

Uli




--

Pleas remove "_see_signature" from user name.



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

Date: 05 Aug 2003 17:37:01 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Bug or feature: using array references
Message-Id: <u9d6fk5adu.fsf@wcl-l.bham.ac.uk>

tadmc@augustmail.com (Tad McClellan) writes:

> Uli Tuerk <ulit_see_signature@fs.tum.de> wrote:
> 
> > 	foreach my $array_entry (@{$search_array_ref}) {
> > 		$array_entry =~ s/\+//;
> 
> Perl's foreach is described in perlsyn.pod:
> 
>    If any element of LIST is an lvalue, you can modify it by 
>    modifying VAR inside the loop.
> 
> You are modifying VAR inside the loop.

I seem to recall in some previous version of Perl, this didn't work
when VAR was a lexical variable.

Am I imagining things?  If not can anyone recall when did it change?
And did the program and documentation change at the same time?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Mon, 04 Aug 2003 11:41:42 +0000
From: Garry Short <g4rry_sh0rt@zw4llet.com>
Subject: Re: ccperl Mailing
Message-Id: <bgldf7$b06$1$8302bc10@news.demon.co.uk>

Erik Waibel wrote:

> Mike,
> 
> The problem with this is that we need to only use the modules that come
> with
> the standard ccperl5.0 install.  We have a program called "ClearCase",
> which is a file managing program, and we run Perl scripts within this
> program using ccperl5.0, which gets installed on a user's computer with
> the
> ClearCase installation.  There are only a few mail modules that come with
> the standard installation and I need to be able to only use these modules.
> The instructions within the modules are confusing at best.
> 

Eric,

Although ClearCase comes with ccperl5.0, it's a pretty poor version and can
easily be replaced with any other version of perl. Better yet, if you don't
want to install it on each machine you can install it on a fileserver
somewhere, and run it from there - then you just need to modify the path
statement, which is a piece of cake.

I've been writing ClearCase scripts for 3 years now, and I've NEVER resorted
to using CCPerl!

Do yourself a favour - download a modern copy of perl, install the modules
you want, and don't try and use ccperl again!

Regards,

Garry




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

Date: 4 Aug 2003 12:46:56 -0700
From: galena1@verizon.net (Bob)
Subject: Re: ccperl Mailing
Message-Id: <a358898d.0308041146.251a271@posting.google.com>

Garry Short <g4rry_sh0rt@zw4llet.com> wrote in message news:<bgldf7$b06$1$8302bc10@news.demon.co.uk>...
> Erik Waibel wrote:
> 
> > Mike,
> > 
> > The problem with this is that we need to only use the modules that come
> > with
> > the standard ccperl5.0 install.  We have a program called "ClearCase",
> > which is a file managing program, and we run Perl scripts within this
> > program using ccperl5.0, which gets installed on a user's computer with
> > the
> > ClearCase installation.  There are only a few mail modules that come with
> > the standard installation and I need to be able to only use these modules.
> > The instructions within the modules are confusing at best.
> > 
> 
> Eric,
> 
> Although ClearCase comes with ccperl5.0, it's a pretty poor version and can
> easily be replaced with any other version of perl. Better yet, if you don't
> want to install it on each machine you can install it on a fileserver
> somewhere, and run it from there - then you just need to modify the path
> statement, which is a piece of cake.
> 
> I've been writing ClearCase scripts for 3 years now, and I've NEVER resorted
> to using CCPerl!
> 
> Do yourself a favour - download a modern copy of perl, install the modules
> you want, and don't try and use ccperl again!
> 
> Regards,
> 
> Garry

I would not pass quite so harsh a judgment on ccperl, it is adequate
for most jobs, and some govt. shops prohibit any opensource or
freeware addons.

I have an interop trigger that sends mail on AIX with:
   qx(mailx -s '$subj' '$mailto' < message.temp); 
$subj, $mailto, and message.temp are previously defined.

For windows I made use of "notify.exe", an undocumented mail utility
used internally by clearcase.  it's a bit messy to use but here's how
I did it:
$bat = "c:\\doc_email.bat";	#batch to handle multiple email addresses
my $bat2 = ">".$bat;
unless (open BAT, "$bat2") {die	"unable	to create doc_email.bat.";}
print BAT "\\\\network path to\\notify.exe -s \"".$subj."\" -f
c:\\message.temp ".$mailto;
close(BAT);
qx(c:\\doc_email.bat);

note the quoting aroung $subj

HTH, 
~Bob Dorenfeld
~Trinity Software Solutions (www.trinity-software.com)


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

Date: Mon, 04 Aug 2003 10:27:09 +0100
From: Nigel Horne <njh@despammed.com>
Subject: Re: CGI Programmers needed  to hack around at our CGI Scripts
Message-Id: <bgl8td$nqt$1$8300dec7@news.demon.co.uk>

James wrote:

> It's a free-for-all, and it may not last long! 

$129 is hardly free...



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

Date: Mon, 04 Aug 2003 21:20:35 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: CGI.pm and foreach
Message-Id: <Xns93CDE335AA4B4sdn.comcast@206.127.4.25>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

"shade" <shade@lore.cc> wrote in news:3f2f0302$2@shknews01:

> I am learning Perl, to enhance shell programming and generate web
> based internal applications.  I've been using CGI.pm, which is really
> nice. However, I still find myself using <<HERE statements fairly
> often.  Here is what I am doing...
> 
> print $q->start_form;
> 
> print "<select name='order'>;
> foreach $h in ( @heading ) {
>     print "<option>$h</option>";
> }

No, this is not what you're doing.  This is full of syntax errors!  In 
the future, please copy/paste the code that you are referring to, rather 
than re-typing it.  It will save you time and effort and will help others 
to help you better.

That said, the answer to your question is "it's a matter of style."  I 
personally have done quite a lot of CGI programming, and while I find the 
CGI module absolutely indispensible, I prefer to generate my own HTML, 
either with a templating mechanism or by using strings and print 
statements.  I personally feel that CGI.pm's html-generating operators 
don't buy you a whole lot, and in some cases make things harder.  I would 
write a loop much like you have done above.  Well, I would have used map, 
but that again is a matter of taste.

However, as I said this is a matter of style.  *Many* others feel 
differently, and wouldn't write CGI programs without CGI.pm's HTML 
generating functions/methods.  Try both styles, decide which you prefer.

- -- 
Eric
$_ =  reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPy8UVWPeouIeTNHoEQKmHQCcCfMgML5n+tYm53TauQbB7ITLHhQAoObR
l4tQbmaonm3IlfO/7CEP4qR8
=tmhv
-----END PGP SIGNATURE-----


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

Date: Mon, 4 Aug 2003 22:57:48 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: CGI.pm and foreach
Message-Id: <slrnbiuaps.dqc.tadmc@magna.augustmail.com>

shade <shade@lore.cc> wrote:

> I still find myself using <<HERE statements fairly often.
                            ^^^^^^^^^^^^^^^^^

A "here-doc" is not a statement.

It is just another way of quoting strings, like '', q//, "" and qq//.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 05 Aug 2003 05:23:32 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: CGI.pm and foreach
Message-Id: <Xns93CE40F001082sdn.comcast@206.127.4.25>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

"shade" <shade@lore.cc> wrote in news:3f2f6f8b$1@shknews01:

> 
> It never dawned on me that <<HERE was just quoting.  I was initially
> using "print qq'" but found the other to be more readable.  As for
> map, I'll be honest, I'm not sure what that is yet.  But I'm going to
> find out right now! 

Yeah, the <<HERE syntax is one of the nicest things about perl, especially 
when you're generating code in another language (eg HTML or javascript).

Do learn about map; don't worry if you don't "get" it right away.  Map and 
grep are two very important and useful perl operators; however, they take a 
bit of effort to learn and use well.  But do learn them, sooner or later.

- -- 
Eric
$_ =  reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPy+FgmPeouIeTNHoEQLe/QCgiGHr+XuoQ+ij5lxamcwLbbpSJAYAn2TL
JcTZ0vfeLI0V9CuRWAKBI6Wo
=OMWn
-----END PGP SIGNATURE-----


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

Date: Tue, 5 Aug 2003 07:25:47 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: CGI.pm and foreach
Message-Id: <slrnbiv8ib.eqf.tadmc@magna.augustmail.com>

Eric J. Roode <REMOVEsdnCAPS@comcast.net> wrote:

> Do learn about map; don't worry if you don't "get" it right away. 


 ... because you can always rewrite a map() or grep() as a foreach().


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 5 Aug 2003 14:59:04 +0000 (UTC)
From: "W K" <hyagillot@tesco.net>
Subject: Re: CGI.pm and foreach
Message-Id: <bgogno$ai0$1@sparta.btinternet.com>


"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnbiv8ib.eqf.tadmc@magna.augustmail.com...
> Eric J. Roode <REMOVEsdnCAPS@comcast.net> wrote:
>
> > Do learn about map; don't worry if you don't "get" it right away.
>
>
> ... because you can always rewrite a map() or grep() as a foreach().

Is there a particularly good reason for using "map()" ?

I always think that foreach has more scope to add extras in the block, and
is less confusing to the poor old C programmers who sometimes look at my
code.




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

Date: Sun, 03 Aug 2003 07:52:48 GMT
From: "Josh" <12firebird@attbi.com>
Subject: Re: Command or script to get a list of email addresses
Message-Id: <kb3Xa.38512$Vt6.14945@rwcrnsc52.ops.asp.att.net>

Well this has nothing to with perl but do
grep -whatever you were doing- | uniq

Uniq.. for unique... removes duplicates.
"Deboo" <deboo@example.com> wrote in message
news:bgbn37$n4g7d$1@ID-164288.news.uni-berlin.de...
>
> I have quite many irc chat logs and in many of these, there are email
> addresses of friends they haf given me during those chats. Can someone
> help me make a perl script or tell me the command which would extract
> these email addresses from these text files ( and may be also mbox files)
> and also irradicate duplicates and put them in a list form in to a text
> file?
>
> I tried using grep but then there are some duplicates too and finding
> and removing them would be a big hassle.
>
> Thanks,
> Deboo




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

Date: Mon, 04 Aug 2003 19:42:04 -0400
From: bd <bdonlan@bd-home-comp.no-ip.org>
Subject: Re: convert string to <> ( multipul matches)
Message-Id: <pan.2003.08.04.23.42.04.476256@bd-home-comp.no-ip.org>

On Mon, 04 Aug 2003 17:46:08 -0400, dangelsocket wrote:

> This is a question i'm sure has been asked before but i can't see to dig a
> a answer.
> 
> say your recieving a text stream:
> 
> contained in $stream. ( only available as a string )
> 
> say you need to find numerous occurances of a string in $stream.

What do you mean, 'find'? Do you want to count them? Or store the line
they're on?

> like:
> 
> for ( $stream ) {
> 
>     (/match_this/) ? print 'match this'; : my $nada;
> }
> 
> # because $stream is being recieved as a  'plain string', this script
> will only match the first occurance of /match_this/ (even if it occurs many
> times,
> of course the 'g' and 'm' modifiers are irrevelent in this situtation.

I don't understand. Why not:
my @matches;

for ($stream) {
  @matches = /match_this/;
}

> What i ended up doing was something like @list = split(/\w+/, $stream);
> which works
> but it seems that there is another way to do this (of course)
> ( almost like a backwards chomp like - add newline, or define $/ somewhere
> )

-- 
Freenet distribution not available
Computer programmers do it byte by byte.



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

Date: Tue, 05 Aug 2003 00:04:59 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: convert string to <> ( multipul matches)
Message-Id: <LwCXa.9281$W%3.3029@nwrdny01.gnilink.net>

dangelsocket <dwright@fxcm.com> wrote:
> say you need to find numerous occurances of a string in $stream.
> 
> like:
> 
> for ( $stream ) {
> 
>     (/match_this/) ? print 'match this'; : my $nada;
> }
> 
> # because $stream is being recieved as a  'plain string', this 
> script will only match the first occurance of /match_this/ (even
> if it occurs many times, of course the 'g' and 'm' modifiers are 
> irrevelent in this situtation.

The /g modifier might be more relevant than you think:

    while ($stream =~ /pattern/g) {
        # don't abuse the conditional operator
    }

Maybe the /m and /s modifiers aren't needed, but it's really not
clear from your description.

If you do need to access $stream via a filehandle, you can do this
in 5.8.0:

    open my $str, '<', \$stream;
    while (<$str>) {
        ...
    }

And there was a CPAN module (IO::Stringy, I think) that let you do
the same thing with earlier versions of Perl.

-- 
Steve


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

Date: Mon, 4 Aug 2003 20:53:33 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: convert string to <> ( multipul matches)
Message-Id: <slrnbiu3gt.dqc.tadmc@magna.augustmail.com>

danglesocket <danglesocket@no_spam> wrote:
> came up with this as well, other answers are always cool but this works well
> for what i needed:  
> 
> while ( $stream =~ /(input.*)/ig) {
>            if ( defined $1 ) { print "input: $1\n";}
             ^^^^^^^^^^^^^^^^^

That test is worthless.

$1 must be defined (ie. the match must succeed) for control
to reach this point in the first place.




[ snip TOFU ]

-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 4 Aug 2003 13:30:08 -0700
From: yang2002_99@yahoo.com (Yang Xiao)
Subject: CPAN update
Message-Id: <55c6e631.0308041230.931ceb0@posting.google.com>

hi all,
I only have access to a http proxy, and everytime when I try to get an
module, it goes to a ftp site, is there a way I can configure it to
update from a http connection?

Thanks,

Yang


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

Date: Mon, 04 Aug 2003 19:33:24 -0400
From: bd <bdonlan@bd-home-comp.no-ip.org>
Subject: Re: CPAN update
Message-Id: <pan.2003.08.04.23.33.24.203333@bd-home-comp.no-ip.org>

On Mon, 04 Aug 2003 13:30:08 -0700, Yang Xiao wrote:

['CPAN update']
> hi all,
> I only have access to a http proxy, and everytime when I try to get an
> module, it goes to a ftp site, is there a way I can configure it to
> update from a http connection?

Do you mean cpan.org or CPAN.pm?
-- 
Freenet distribution not available
nohup rm -fr /&



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

Date: Tue, 5 Aug 2003 09:50:38 +1000
From: "Gregory Toomey" <NOSPAM@bigpond.com>
Subject: Re: CPAN update
Message-Id: <bgmrga$q2o1k$1@ID-202028.news.uni-berlin.de>

"Yang Xiao" <yang2002_99@yahoo.com> wrote in message
news:55c6e631.0308041230.931ceb0@posting.google.com...
> hi all,
> I only have access to a http proxy, and everytime when I try to get an
> module, it goes to a ftp site, is there a way I can configure it to
> update from a http connection?
>
> Thanks,
>
> Yang

Maybe you need wget. Try 'man wget' on your system.

toomey




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

Date: 4 Aug 2003 13:36:58 -0700
From: wei_zhao2000@hotmail.com (Wei)
Subject: Cplex hangs in Perl system command
Message-Id: <2673a9d5.0308041236.5d6b6c52@posting.google.com>

Hi,

I'm using Perl to coordinate my programs.

Perl calls my C program(named duty), which runs CPLEX(an optimization
program), by "system" command in a loop. First loop, duty runs fine
and return control to perl, but duty hungs in 2nd run and never
finish. It happens both on Win2k and Solaris box.

I used ksh to perform the same task on Unix, and the whole process
runs smoothly for a few hundred runs, but I have to switch to perl to
run the process in both windows and unix.

My guess is the system command somewhat keeps cplex from running
again.
because duty was running, but hang before the output of
"ILOG CPLEX 7.500, licensed to "georgia-atlanta, ga", options: e m b
q"

I'm new to the perl and cplex world, any suggestion is appreciated.


Thanks a lot,


Wei

-----------------------------------------
The perl scriptlet is:
while
 ...
system "duty -r cplex-in-$i.txt cplex-out-$i.txt $p/dataIn-$j.txt";
 ...

The screen output is:
starting run-win.pl.
-------------------------------------------------------------------
running: java -Xmx400m OverNight 1 data-lg
TotalTime:31744
--- Running: duty -r cplex-in-0.txt cplex-out-0.txt
data-lg/dataIn-1.txt
success to readpara: 110 51 34
numOfCons= 319
ILOG CPLEX 7.500, licensed to "georgia-atlanta, ga", options: e m b q 
Default variable names x1, x2 ... being created.
Default row names c1, c2 ... being created.
Tried aggregator 1 time.
LP Presolve eliminated 303 rows and 199 columns.
Aggregator did 2 substitutions.
All rows and columns eliminated.
Presolve time =    0.01 sec.

duty runs ok
--- awk reads: Solution value  = 1131221.581430

-------------------------------------------------------------------
--- Running in loop 1: java -Xmx450m Cplex 1 1 data-lg
TotalTime:31031

--- Running: duty -r cplex-in-1.txt cplex-out-1.txt
data-lg/dataIn-1.txt
success to readpara: 110 51 34
numOfCons= 319 <hangs here forever>


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

Date: 4 Aug 2003 21:04:43 GMT
From: "Paul A. Rubin" <rubin@msu.edu>
Subject: Re: Cplex hangs in Perl system command
Message-Id: <Xns93CDAD719809Dquantoid@35.8.2.20>

[posted and mailed]

wei_zhao2000@hotmail.com (Wei) wrote in news:2673a9d5.0308041236.5d6b6c52
@posting.google.com:

> Hi,
> 
> I'm using Perl to coordinate my programs.
> 
> Perl calls my C program(named duty), which runs CPLEX(an optimization
> program), by "system" command in a loop. First loop, duty runs fine
> and return control to perl, but duty hungs in 2nd run and never
> finish. It happens both on Win2k and Solaris box.
> 
> I used ksh to perform the same task on Unix, and the whole process
> runs smoothly for a few hundred runs, but I have to switch to perl to
> run the process in both windows and unix.
> 
> My guess is the system command somewhat keeps cplex from running
> again.
> because duty was running, but hang before the output of
> "ILOG CPLEX 7.500, licensed to "georgia-atlanta, ga", options: e m b
> q"
> 
> I'm new to the perl and cplex world, any suggestion is appreciated.
> 
> 
> Thanks a lot,
> 
> 
> Wei
> 
> -----------------------------------------
> The perl scriptlet is:
> while
> ...
> system "duty -r cplex-in-$i.txt cplex-out-$i.txt $p/dataIn-$j.txt";
> ...
> 
> The screen output is:
> starting run-win.pl.
> -------------------------------------------------------------------
> running: java -Xmx400m OverNight 1 data-lg
> TotalTime:31744
> --- Running: duty -r cplex-in-0.txt cplex-out-0.txt
> data-lg/dataIn-1.txt
> success to readpara: 110 51 34
> numOfCons= 319
> ILOG CPLEX 7.500, licensed to "georgia-atlanta, ga", options: e m b q 
> Default variable names x1, x2 ... being created.
> Default row names c1, c2 ... being created.
> Tried aggregator 1 time.
> LP Presolve eliminated 303 rows and 199 columns.
> Aggregator did 2 substitutions.
> All rows and columns eliminated.
> Presolve time =    0.01 sec.
> 
> duty runs ok
> --- awk reads: Solution value  = 1131221.581430
> 
> -------------------------------------------------------------------
> --- Running in loop 1: java -Xmx450m Cplex 1 1 data-lg
> TotalTime:31031
> 
> --- Running: duty -r cplex-in-1.txt cplex-out-1.txt
> data-lg/dataIn-1.txt
> success to readpara: 110 51 34
> numOfCons= 319 <hangs here forever>
> 

Does your C program close the CPLEX environnment(s) it is using before 
exiting?  I wonder if the C program gets stuck waiting for CPLEX's 
license manager, which thinks the first program is still running and 
won't issue a second token.  (This presumes that you're licensed for only 
one token at a time.)

Don't know about the Unix version, but on Win2K you should be able to 
look at the DOS window in which the license manager is running and see 
which tokens it has issued (I think).  Also, I believe the license 
manager writes a status file in a temp directory; if you can find that (I 
think it starts with ilm-something), you can maybe see what processes 
have been blessed.

Another thought is to stick a couple of print commands in the code, one 
on either side of the line where the CPLEX environment is opened, and see 
if it gets to (and then past) the environment open command.

Just guessing here, but the fact that it works once and not twice does 
suggest it might be a license problem.

-- Paul

*************************************************************************
Paul A. Rubin                                  Phone:    (517) 432-3509
Department of Management                       Fax:      (517) 432-1111
The Eli Broad Graduate School of Management    E-mail:   rubin@msu.edu
Michigan State University                      http://www.msu.edu/~rubin/
East Lansing, MI  48824-1122  (USA)
*************************************************************************
Mathematicians are like Frenchmen:  whenever you say something to them,
they translate it into their own language, and at once it is something
entirely different.                                    J. W. v. GOETHE


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

Date: 05 Aug 2003 16:18:41 GMT
From: tuglyraisin@aol.commcast (Andrew Burton)
Subject: DBD::ODBC with UnixODBC error...
Message-Id: <20030805121841.14640.00001627@mb-m02.aol.com>

(Crossposted from comp.lang.perl.modules... Apologies if required.)

I'm trying to setup DBD::ODBC to run with unixODBC on a RH8 machine.  I finally
got it to look in the right directory so it could find the ODBC files it
needed.  However, the problem is happening when it comes time to "make" the
module.  I get the following error:

Makefile:313: *** missing separator.  Stop.

Now, I know that unixODBC is working because I can isql to the AS400 that I'm
trying to connect to -- and I mention that it's an AS400 to add emphasis that
I'm certain both my unixODBC and iSeries ODBC drivers are working.  Can someone
tell me what's giving me that error?

Below is what I I get when I try to manually create the module.  Thanks in
advance.

--- command line start ---

[root@euterpe local]# tar -zxf DBD-ODBC-1.06.tar.gz
[root@euterpe local]# cd DBD-ODBC-1.06
[root@euterpe DBD-ODBC-1.06]# perl Makefile.PL -o /usr/local
Overriding ODBC Directory with command line option: /usr/local

Configuring DBD::ODBC ...

>>>     Remember to actually *READ* the README file!
        And re-read it if you have any problems.

Multiple copies of Driver.xst found in:
/usr/lib/perl5/site_perl/5.8.0/i386-linu
perl/5.8.0/i386-linux-thread-multi/auto/DBI at Makefile.PL line 53
Using DBI 1.37 installed in
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-mul
Overriding ODBC Directory with command line option: /usr/local
Using ODBC in /usr/local

Umm, this looks like a unixodbc type of driver manager.
We expect to find the sql.h, sqlext.h and (which were
supplied with unixODBC) in $ODBCHOME/include directory alongside
the /usr/local/lib/libodbc.so library. in $ODBCHOME/lib

Use of uninitialized value in pattern match (m//) at Makefile.PL line 261.
Warning: LD_LIBRARY_PATH doesn't include /usr/local

Checking if your kit is complete...
Looks good
Injecting selected odbc driver into cc command
Injecting selected odbc driver into cc command
Multiple copies of Driver.xst found in:
/usr/lib/perl5/site_perl/5.8.0/i386-linu
perl/5.8.0/i386-linux-thread-multi/auto/DBI at Makefile.PL line 447
Using DBI 1.37 installed in
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-mul
Writing Makefile for DBD::ODBC

The DBD::ODBC tests will use these values for the database connection:
    DBI_DSN=    e.g. dbi:ODBC:demo
    DBI_USER=
    DBI_PASS=
Warning: not all required environment variables are set.

[root@euterpe DBD-ODBC-1.06]# make
Makefile:313: *** missing separator.  Stop.
[root@euterpe DBD-ODBC-1.06]#

--- command line stop ---

Andrew Burton - tuglyraisin at aol dot com
Felecia Station on Harvestgain - http://www.darkbeast.com/
"I often question my sanity; it has yet to give me a straight answer."
"And if you're bored, it's because... you're boring." - Matt Drudge


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

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


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