[29641] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 885 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 27 06:09:45 2007

Date: Thu, 27 Sep 2007 03:09:07 -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           Thu, 27 Sep 2007     Volume: 11 Number: 885

Today's topics:
        [OT] optimal vs. optimized [was: Re: string concatentat <ben@morrow.me.uk>
    Re: Deleting a section of file using perl <ver_amitabh@yahoo.com>
        Invalid top directory at d:\perl\lib\file\find.pm line  <ninad.29@gmail.com>
    Re: Invalid top directory at d:\perl\lib\file\find.pm l  usenet@DavidFilmer.com
        new CPAN modules on Thu Sep 27 2007 (Randal Schwartz)
        perl open/close file leaks memory??  jimlee2004@gmail.com
    Re: perl open/close file leaks memory?? <rvtol+news@isolution.nl>
    Re: perl open/close file leaks memory?? <dummy@example.com>
    Re: perl open/close file leaks memory?? <paduille.4061.mumia.w+nospam@earthlink.net>
    Re: perl open/close file leaks memory?? <bik.mido@tiscalinet.it>
        Small doubt in perl <anilkumar.iitm@gmail.com>
    Re: Small doubt in perl <vilain@spamcop.net>
    Re: Small doubt in perl <dummy@example.com>
    Re: Small doubt in perl <zen13097@zen.co.uk>
    Re: string concatentation vs. interpolation: which one  <bik.mido@tiscalinet.it>
    Re: tail recursion <rvtol+news@isolution.nl>
    Re: Upgrading Bundle::CPAN freezes during tests <elsiddik@gmail.com>
    Re: Upgrading Bundle::CPAN freezes during tests <allergic-to-spam@no-spam-allowed.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 27 Sep 2007 02:59:52 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: [OT] optimal vs. optimized [was: Re: string concatentation...]
Message-Id: <odfrs4-dud.ln1@osiris.mauzo.dyndns.org>


Quoth Michele Dondi <bik.mido@tiscalinet.it>:
> On Wed, 26 Sep 2007 22:27:56 +0100, Ben Morrow <ben@morrow.me.uk>
> wrote:
> 
> >Quoth Michele Dondi <bik.mido@tiscalinet.it>:
> >> Something can't be "more optimal" than something else. Perhaps
> >> "optimized"?
> >
> >Yes it can. 'more optimal' implies 'better, in an absolute sense',
> >whereas 'more optimized' would imply 'has been improved more'. That is,
> >if you have A which executes 10 times a second and B which executes 20
> >times, and you improve this to A executing 15 times and B executing 21
> >times, then A is 'more optimized' than B even though B is still 'more
> >optimal' than A. (Did that make any sense? :) )
> 
> Well, "optimal" is an adjective of clear latin descent. In Italian it
> maps to "ottimale" which is somewhat a variant (with a slightly
> restricted acceptation) of "ottimo" (best) which in turn is the
> superlative of "buono" (good) and IMHO still has attached the sense of
> a superlative. I don't know if in English it's the same or I'm simply
> biased by Italian grammar, but...
> 
> (/me realizes that he can check dict to be sure -\|/-\|/-\|/-\|/)
<snipped>
>
> So to say that something is "more optimal" (than something else) is
> like saying that something is "more best" (than something else). To
> me, it's not correct.

You have a good point; however, as is usual in English grammar,
arguments from ancestry don't always help :). For instance, if 'optimum'
and derived words are necessarily superlative, then 'optimized' means
'made best', and A cannot be more optimized than B either. A has either
been 'made best' or it hasn't.

I think what has happened is that, in English, 'optimal' and
'optimized' have acquired something of a sense of 'efficient', which is
clearly comparative, rather than of 'best' in a more general sense. So
optimizing a program doesn't necessarily make it better, it simply makes
it more efficient: other things may be more important than efficiency,
portability or readability for example. 'Optimum' has not (I would say)
changed like this, so I find it odd that the dictionaries you quoted say
it is synonymous with 'optimal': I would entirely agree that 'more
optimum' is obviously wrong.

Theory aside, a quick google shows that 'more optimal' is definitely
acceptable usage; for instance (a random example from the results)

    This is because the claim that A is more optimal or better adapted
    than B with respect to some function does not entail that A is
    optimal or even good with respect to that function.
    
    http://www.seop.leeds.ac.uk/archives/fall1999/entries/teleology-biology/

which shows that 'optimal' can have the sense of 'efficient' or
'effective' rather than simply 'best'.

    [English] not only borrows words from other languages; it has on
    occasion chased other languages down dark alley-ways, clubbed them
    unconscious and rifled their pockets for new vocabulary.
                                                        -- James Nicoll
:)

Ben



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

Date: Wed, 26 Sep 2007 22:19:49 -0700
From:  Ami <ver_amitabh@yahoo.com>
Subject: Re: Deleting a section of file using perl
Message-Id: <1190870389.165298.94670@g4g2000hsf.googlegroups.com>

On Sep 26, 9:08 pm, xhos...@gmail.com wrote:
> Ami <ver_amit...@yahoo.com> wrote:
> > Hi All,
> >    I am reading and file and same time modifying it (Inline edit).
>
> By that do you mean -i (or $^I) ?
>
> > I
> > store a particular position of file on some criteria using tell() and
> > than after reading some other stuff, i need to decide, if i want to
> > delete the contents of file from previously stored position till
> > current position.
>
> Can you just delay printing that chunk, storing it in memory instead,
> until you make that decision?  Then either print it or discard it.  If you
> can't do it this way, rather than with tell or whatever, then I think that
> trying to use -i is a mistake.
>
> > It would be great help, if some one can give me idea/code snippet to
> > do it.
> > I need a code to delete file contents from one position to another
> > position and again continue processing file in same way.
>
> See the implementation of Tie::File.  It is not easy, and will probably
> be slower than molasses.
>
> 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.

Hi All,
   Thanks for your response. I have opted to go for using another
output file and keeping track of what part of file is needed to be
truncated. By using this method, i can serve my purpose.
Regards,



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

Date: Thu, 27 Sep 2007 09:02:29 -0000
From:  Perler <ninad.29@gmail.com>
Subject: Invalid top directory at d:\perl\lib\file\find.pm line 562
Message-Id: <1190883749.295285.167990@57g2000hsv.googlegroups.com>

Hi, i am using the following script to find a file entered by a user.

 use Win32::DriveInfo;
 use File::Find;

 my @drives = Win32::DriveInfo::DrivesInUse(); #Get the drives on a
Machine

 my $cnt=@drives;  #Number of Drives

 my $i=$cnt; #Counter assignment

 #The following loop appends "/" to the drive letter  #if the drive is
a
fixed drive.

 for($i;$i>0;$i--)
 {
  $type=Win32::DriveInfo::DriveType($drives[$i-1]);
  if($type==3)#fixed drives
  {
              $d[$i-1]=$drives[$i-1].":"."\\","\\";
      }
 }

 $temp=$ARGV[0]; #store filename to be found

 my @t=split(/\./,$temp); #Split the filename to get the extension

 my $cnt=@t;

 $f=".".$t[$cnt-1]; #Append "." and extension

 find(\&cleanup,@d);  #standard file find function

 sub cleanup {

      if ((/$f/))#$f= appneding "." and file extension for eg:
$f=.pl,$f=.txt
 {
              $path=$File::Find::name;   #$path will contain the
complete
path of a file

          @p=split(/\//,$path); #just get the file name

          $cnt=@p;
          if($p[$cnt-1] eq $temp)
              {
                      print "\n File Found",$path;
              }



 }

 }


If i run this script i am getting the error as  "Invalid top directory
at
d:\perl\lib\file\find.pm line 562, <DATA> line164"

Pls help me.


Thanks in advances :)



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

Date: Thu, 27 Sep 2007 09:45:32 -0000
From:  usenet@DavidFilmer.com
Subject: Re: Invalid top directory at d:\perl\lib\file\find.pm line 562
Message-Id: <1190886332.584881.105760@y42g2000hsy.googlegroups.com>

On Sep 27, 1:29 am, ninad...@gmail.com (Perler) wrote:
> [a multipost]

Please don't multipost.


--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)



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

Date: Thu, 27 Sep 2007 04:42:18 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Sep 27 2007
Message-Id: <Jp0FqI.y1B@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Algorithm-NGram-0.4
http://search.cpan.org/~revmischa/Algorithm-NGram-0.4/
----
Apache2-Filter-Minifier-CSS-1.02
http://search.cpan.org/~gtermars/Apache2-Filter-Minifier-CSS-1.02/
CSS minifying output filter 
----
Apache2-Filter-Minifier-JavaScript-1.02
http://search.cpan.org/~gtermars/Apache2-Filter-Minifier-JavaScript-1.02/
JS minifying output filter 
----
Business-OnlinePayment-viaKLIX-0.01
http://search.cpan.org/~jef/Business-OnlinePayment-viaKLIX-0.01/
viaKLIX backend for Business::OnlinePayment 
----
CGI-Application-Plugin-DevPopup-1.00
http://search.cpan.org/~rhesa/CGI-Application-Plugin-DevPopup-1.00/
Runtime cgiapp info in a popup window 
----
CORBA-C-2.46
http://search.cpan.org/~perrad/CORBA-C-2.46/
----
CORBA-Cplusplus-0.22
http://search.cpan.org/~perrad/CORBA-Cplusplus-0.22/
----
CORBA-HTML-2.42
http://search.cpan.org/~perrad/CORBA-HTML-2.42/
----
CORBA-IDL-2.47
http://search.cpan.org/~perrad/CORBA-IDL-2.47/
----
CORBA-JAVA-2.50
http://search.cpan.org/~perrad/CORBA-JAVA-2.50/
----
CORBA-Perl-0.24
http://search.cpan.org/~perrad/CORBA-Perl-0.24/
----
CORBA-Python-0.41
http://search.cpan.org/~perrad/CORBA-Python-0.41/
----
CORBA-XMLSchemas-0.42
http://search.cpan.org/~perrad/CORBA-XMLSchemas-0.42/
----
CORBA-XPIDL-0.04
http://search.cpan.org/~perrad/CORBA-XPIDL-0.04/
----
CORBA-XS-0.54
http://search.cpan.org/~perrad/CORBA-XS-0.54/
----
CPAN-Testers-Report-0.02
http://search.cpan.org/~fhoxh/CPAN-Testers-Report-0.02/
Creates CPAN Testers test-report objects 
----
Catalyst-Controller-Atompub-0.1.5
http://search.cpan.org/~takeru/Catalyst-Controller-Atompub-0.1.5/
A Catalyst controller for the Atom Publishing Protocol 
----
Crypt-Eksblowfish-0.003
http://search.cpan.org/~zefram/Crypt-Eksblowfish-0.003/
the Eksblowfish block cipher 
----
Crypt-Skip32-0.03
http://search.cpan.org/~esh/Crypt-Skip32-0.03/
32-bit block cipher based on Skipjack 
----
Crypt-Skip32-0.04
http://search.cpan.org/~esh/Crypt-Skip32-0.04/
32-bit block cipher based on Skipjack 
----
DBIx-Class-FormTools-0.000006
http://search.cpan.org/~djo/DBIx-Class-FormTools-0.000006/
Helper module for building forms with multiple related DBIx::Class objects. 
----
Data-ID-Exim-0.005
http://search.cpan.org/~zefram/Data-ID-Exim-0.005/
generate Exim message IDs 
----
Data-ID-Maildir-0.002
http://search.cpan.org/~zefram/Data-ID-Maildir-0.002/
generate maildir-style unique IDs 
----
DateTime-Format-Natural-0.50
http://search.cpan.org/~schubiger/DateTime-Format-Natural-0.50/
Create machine readable date/time with natural parsing logic 
----
Devel-StringInfo-0.01
http://search.cpan.org/~nuffin/Devel-StringInfo-0.01/
----
Devel-StringInfo-0.02
http://search.cpan.org/~nuffin/Devel-StringInfo-0.02/
Gather information about strings 
----
File-Copy-Link-0.100
http://search.cpan.org/~rmbarker/File-Copy-Link-0.100/
Perl extension for replacing a link by a copy of the linked file. 
----
File-Rename-0.03
http://search.cpan.org/~rmbarker/File-Rename-0.03/
Perl extension for renaming multiple files 
----
HTML-Template-Pluggable-0.17
http://search.cpan.org/~rhesa/HTML-Template-Pluggable-0.17/
Extends HTML::Template with plugin support 
----
HTML-Tiny-0.903
http://search.cpan.org/~andya/HTML-Tiny-0.903/
Lightweight, dependency free HTML/XML generation 
----
Mobile-WURFL-0.02
http://search.cpan.org/~valdez/Mobile-WURFL-0.02/
List capabilities of mobile handsets using WURFL data 
----
Net-Z3950-Simple2ZOOM-1.01
http://search.cpan.org/~mirk/Net-Z3950-Simple2ZOOM-1.01/
Gateway between Z39.50 and SRU/SRW 
----
PDF-API2-0.65
http://search.cpan.org/~areibens/PDF-API2-0.65/
A Perl Module Chain to faciliate the Creation and Modification of High-Quality "Portable Document Format (aka. PDF)" Files. 
----
SQL-Translator-0.08001
http://search.cpan.org/~jrobinson/SQL-Translator-0.08001/
manipulate structured data definitions (SQL and more) 
----
Test-Moose-MockObjectCompile-0.2
http://search.cpan.org/~zaphar/Test-Moose-MockObjectCompile-0.2/
A Module to help when testing compile time Moose 
----
Test-WWW-Declare-0.01_01
http://search.cpan.org/~sartak/Test-WWW-Declare-0.01_01/
declarative testing for your web app 
----
Text-CSV-Unicode-0.05
http://search.cpan.org/~rmbarker/Text-CSV-Unicode-0.05/
comma-separated values manipulation routines with potentially wide character data 
----
TinyAuth-0.92
http://search.cpan.org/~adamk/TinyAuth-0.92/
Extremely light-weight web-based authentication manager 
----
TinyAuth-0.93
http://search.cpan.org/~adamk/TinyAuth-0.93/
Extremely light-weight web-based authentication manager 
----
WebService-FogBugz-0.0.2
http://search.cpan.org/~shigeta/WebService-FogBugz-0.0.2/
Perl interface to the FogBugz API 
----
WebService-FogBugz-0.0.3
http://search.cpan.org/~shigeta/WebService-FogBugz-0.0.3/
Perl interface to the FogBugz API 
----
Workflow-0.31
http://search.cpan.org/~jonasbn/Workflow-0.31/
Simple, flexible system to implement workflows 
----
XML-Compile-0.55
http://search.cpan.org/~markov/XML-Compile-0.55/
Compilation based XML processing 
----
ack-1.67_01
http://search.cpan.org/~petdance/ack-1.67_01/
grep-like text finder 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Wed, 26 Sep 2007 22:30:04 -0700
From:  jimlee2004@gmail.com
Subject: perl open/close file leaks memory??
Message-Id: <1190871004.873381.40940@y42g2000hsy.googlegroups.com>

I have a test script below.
It seems that there is memory leaks but all this script does is simply
open and close file handle,
Could somebody explain to me what is happening?

use strict;
use FileHandle;
open MY_HANDLE,">>","/tmp/test/testlog.1" or die $!;
my $a=0;
my $b=0;

while(1){
  my $mystr="Something";
  print MY_HANDLE $mystr;
  $a++;
  if ($a>1000)
  {
    $a=0;
    close MY_HANDLE or die $!;
    system("rm /tmp/test/testlog.$b");
    $b++;
    open MY_HANDLE,">>","/tmp/test/whatever.$b" or die $!;
  }
}



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

Date: Thu, 27 Sep 2007 08:51:30 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: perl open/close file leaks memory??
Message-Id: <fdfqvh.lo.1@news.isolution.nl>

jimlee2004@gmail.com schreef:

> I have a test script below.
> It seems that there is memory leaks but all this script does is simply
> open and close file handle,

No, it doesn't. For one, your $b is out of sync. Further,
s/whatever/testlog/. And I don't see why you have "use FileHandle;".


> Could somebody explain to me what is happening?
>
> use strict;
> use FileHandle;
> open MY_HANDLE,">>","/tmp/test/testlog.1" or die $!;
> my $a=0;
> my $b=0;
>
> while(1){
>   my $mystr="Something";
>   print MY_HANDLE $mystr;
>   $a++;
>   if ($a>1000)
>   {
>     $a=0;
>     close MY_HANDLE or die $!;
>     system("rm /tmp/test/testlog.$b");
>     $b++;
>     open MY_HANDLE,">>","/tmp/test/whatever.$b" or die $!;
>   }
> }


#!/usr/bin/perl
  use strict;
  use warnings;

  my $pre = "/tmp/test/testlog";
  my $ext = 1;

  my $fname;  #  "$pre.$ext"
  my $fh;

  my $i   = 0;
  my $max = 1000;

  my $str = "Something ";

  while(1){
      if (0 == $i) {
          $fname = "$pre.$ext";
          open $fh, ">>", $fname
            or die "Error opening '$fname': $!";
      }

      print $fh $str;

      ++ $i <= $max and next;

      close $fh
        or die "Error closing '$fname': $!";
      unlink($fname)
        or die "Error deleting '$fname': $!";

      $i = 0;
      ++ $ext;
  }

-- 
Affijn, Ruud

"Gewoon is een tijger."



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

Date: Thu, 27 Sep 2007 07:14:12 GMT
From: "John W. Krahn" <dummy@example.com>
Subject: Re: perl open/close file leaks memory??
Message-Id: <8LIKi.18041$nO3.7744@edtnps90>

jimlee2004@gmail.com wrote:
> I have a test script below.
> It seems that there is memory leaks but all this script does is simply
> open and close file handle,
> Could somebody explain to me what is happening?
> 
> use strict;

And don't forget:

use warnings;


> use FileHandle;

You are not using this module?


> open MY_HANDLE,">>","/tmp/test/testlog.1" or die $!;
> my $a=0;
> my $b=0;
> 
> while(1){

This is an infinite loop.  That means that it will continue running until you 
run out disk space.


>   my $mystr="Something";
>   print MY_HANDLE $mystr;
>   $a++;
>   if ($a>1000)
>   {
>     $a=0;
>     close MY_HANDLE or die $!;
>     system("rm /tmp/test/testlog.$b");

Why not use perl's built-in unlink() function?


>     $b++;
>     open MY_HANDLE,">>","/tmp/test/whatever.$b" or die $!;

You are creating new files that will never be deleted.

"/tmp/test/testlog.$b" ne "/tmp/test/whatever.$b"


>   }
> }
> 


John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall


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

Date: Thu, 27 Sep 2007 01:59:41 -0500
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: perl open/close file leaks memory??
Message-Id: <13fmma94rvshs86@corp.supernews.com>

On 09/27/2007 12:30 AM, jimlee2004@gmail.com wrote:
> I have a test script below.
> It seems that there is memory leaks but all this script does is simply 
> open and close file handle,
> Could somebody explain to me what is happening?
> 
> use strict;
> use FileHandle;
> open MY_HANDLE,">>","/tmp/test/testlog.1" or die $!;
> my $a=0;
> my $b=0;
> 
> while(1){
>   my $mystr="Something";
>   print MY_HANDLE $mystr;
>   $a++;
>   if ($a>1000)
>   {
>     $a=0;
>     close MY_HANDLE or die $!;
>     system("rm /tmp/test/testlog.$b");
>     $b++;
>     open MY_HANDLE,">>","/tmp/test/whatever.$b" or die $!;
>   }
> }
> 

I don't see a memory leak with your program. However, your program does 
eventually use all of the memory available to the /tmp filesystem.

On line 4 you open /tmp/test/testlog.1, but on line 19 you open 
/tmp/test/whatever.$b. Was that intentional?


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

Date: Thu, 27 Sep 2007 11:46:51 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: perl open/close file leaks memory??
Message-Id: <luumf3tfmjflltaqfdj9s82lctbr2g9n4b@4ax.com>

On Thu, 27 Sep 2007 07:14:12 GMT, "John W. Krahn" <dummy@example.com>
wrote:

>>     open MY_HANDLE,">>","/tmp/test/whatever.$b" or die $!;
>
>You are creating new files that will never be deleted.

Which are in /tmp which maybe is really held in RAM.


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: Wed, 26 Sep 2007 22:55:59 -0700
From:  anil <anilkumar.iitm@gmail.com>
Subject: Small doubt in perl
Message-Id: <1190872559.131854.319920@57g2000hsv.googlegroups.com>

Hi,
      I need a small help, how shall i call shell script and java
program in the perl?

I am using the following snippet of code,

system("sample.sh");
system("java test");

In the "sample.sh" i have set some environmental variables,  but the
environment variables which are set in the sample.sh are not used by
the java pgm.

Is there any other way to achieve this functionality?

Thanks & Regards
Anil.



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

Date: Wed, 26 Sep 2007 23:46:10 -0700
From: Michael Vilain <vilain@spamcop.net>
Subject: Re: Small doubt in perl
Message-Id: <vilain-B2511F.23461026092007@comcast.dca.giganews.com>

In article <1190872559.131854.319920@57g2000hsv.googlegroups.com>,
 anil <anilkumar.iitm@gmail.com> wrote:

> Hi,
>       I need a small help, how shall i call shell script and java
> program in the perl?
> 
> I am using the following snippet of code,
> 
> system("sample.sh");
> system("java test");
> 
> In the "sample.sh" i have set some environmental variables,  but the
> environment variables which are set in the sample.sh are not used by
> the java pgm.
> 
> Is there any other way to achieve this functionality?
> 
> Thanks & Regards
> Anil.

If you think about how programs run in a UNIX system (forking, exec, 
children, etc.) how would you think that this might work?  The system() 
function creates two independent child processes, completely seprate of 
each other with no connection.  They share the parent process which is 
running the perl script, but that's it.

Your only hope to have any sorts of environment variables propagated to 
another process is to have the shell script _call_ the java program.

-- 
DeeDee, don't press that button!  DeeDee!  NO!  Dee...





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

Date: Thu, 27 Sep 2007 07:34:56 GMT
From: "John W. Krahn" <dummy@example.com>
Subject: Re: Small doubt in perl
Message-Id: <A2JKi.92608$Pd4.60830@edtnps82>

anil wrote:
> Hi,
>       I need a small help, how shall i call shell script and java
> program in the perl?
> 
> I am using the following snippet of code,
> 
> system("sample.sh");
> system("java test");

Open two xterms (or your favourite terminal program) and run "sample.sh" in 
one and "java test" in the other.  This is essentially what you are doing there.

> In the "sample.sh" i have set some environmental variables,  but the
> environment variables which are set in the sample.sh are not used by
> the java pgm.

How do you set them?

> Is there any other way to achieve this functionality?

open SHELL, '>>', 'sample.sh' or die "Cannot open 'sample.sh' $!";
print SHELL "java test\n";
close SHELL;
system( '/bin/sh', 'sample.sh' ) == 0 or die "system '/bin/sh sample.sh' 
failed: $?";




John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall


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

Date: 27 Sep 2007 07:35:50 GMT
From: Dave Weaver <zen13097@zen.co.uk>
Subject: Re: Small doubt in perl
Message-Id: <46fb5d56$0$21095$da0feed9@news.zen.co.uk>

On Wed, 26 Sep 2007 22:55:59 -0700, anil <anilkumar.iitm@gmail.com> wrote:
> 
>  system("sample.sh");
>  system("java test");
> 
>  In the "sample.sh" i have set some environmental variables,  but the
>  environment variables which are set in the sample.sh are not used by
>  the java pgm.

perldoc -q environ



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

Date: Thu, 27 Sep 2007 11:41:14 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: string concatentation vs. interpolation: which one is more optimal?
Message-Id: <2lumf3h1iqr4uq5ija29sg651k90ol1u7c@4ax.com>

On Thu, 27 Sep 2007 00:35:45 +0200, Michele Dondi
<bik.mido@tiscalinet.it> wrote:

>>"List" seems to be always fastest w/all print
>>varieties, except when going through stdio?
>
>Maybe one needs to $++?

I meant $|++;  # Sorry


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, 27 Sep 2007 08:20:11 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: tail recursion
Message-Id: <fdfpbp.1ig.1@news.isolution.nl>

Michele Dondi schreef:
> Dr.Ruud:
>> Michele Dondi:

>>> (Mostly as an aside) if the recursion can be cast in the form of
>>> tail recursion than much hassle can be eliminated, but existing
>>> perls unfortunately don't handle it natively so one has to take
>>> care of that "manually" with *magic* goto()s.
>>
>> Can you show an example?
>
> It's surely discussed in HOP, but I don't know if it's online yet. No,
> it isn't - see <http://hop.perl.plover.com/>. Then there's a free
> online book (ongoing work as of when I bookmarked it) available at
> <http://billhails.net/Book/> which talks about it, with examples, at
> <http://billhails.net/Book/interpreter-0-0-10.html#tail-recursion>.

Thanks.

-- 
Affijn, Ruud

"Gewoon is een tijger."



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

Date: Thu, 27 Sep 2007 03:17:29 -0000
From:  elsiddik <elsiddik@gmail.com>
Subject: Re: Upgrading Bundle::CPAN freezes during tests
Message-Id: <1190863049.976680.80700@22g2000hsm.googlegroups.com>

On Sep 26, 11:45 am, Matthew Cline <khym.cha...@gmail.com> wrote:
> While using "perl -MCPAN -eshell" to install some Perl packages, I was
> told that there was a new version of CPAN that I could upgrade to.  I
> try to upgrade, and everything goes fine until it gets to the tests:
>
>   /usr/bin/make  -- OK
> Running make test
> PERL_DL_NONLAZY=1 /usr/bin/perl5.8.8 "-MExtUtils::Command::MM" "-e"
> "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
> t/00signature.......ok
>         1/1 skipped: various reasons
> t/01loadme..........ok
> t/02nox.............ok
> t/03pkgs............ok 1/11
>
> And it just freezes at "t/03pkgs............ok 1/11".  It's not using
> up any CPU, so it's not an infinite loop, but other than that I have
> no clue.  I'm using perl 5.8.8
>
> Thanks in advance.

I could solve it by force install.

cheers.


zaher el siddik
http://www.unixshells.nl/



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

Date: Thu, 27 Sep 2007 06:23:23 +0200 (CEST)
From: Jim Cochrane <allergic-to-spam@no-spam-allowed.org>
Subject: Re: Upgrading Bundle::CPAN freezes during tests
Message-Id: <slrnffmc1m.5m0.allergic-to-spam@no-spam-allowed.org>

On 2007-09-26, elsiddik <elsiddik@gmail.com> wrote:
>
> I'm having here the same problem tho.

How odd - so am I - running:

$ sudo cpan install CPAN::FindDependencies
 - last few lines up to the hanging point:

Manifying blib/man3/CPAN::Nox.3pm
Manifying blib/man3/CPAN::FirstTime.3pm
  /usr/bin/make  -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00signature.......ok                                                       
        1/1 skipped: various reasons
t/01loadme..........ok                                                       
t/02nox.............ok                                                       
t/03pkgs............ok 1/11                                                  

>
> ...
> cpan
> Manifying blib/man1/cpan.1
> Manifying blib/man3/CPAN.3pm
> Manifying blib/man3/CPAN::Admin.3pm
> Manifying blib/man3/CPAN::Tarzip.3pm
> Manifying blib/man3/CPAN::Debug.3pm
> Manifying blib/man3/CPAN::HandleConfig.3pm
> Manifying blib/man3/CPAN::Queue.3pm
> Manifying blib/man3/CPAN::Version.3pm
> Manifying blib/man3/CPAN::Kwalify.3pm
> Manifying blib/man3/CPAN::API::HOWTO.3pm
> Manifying blib/man3/CPAN::Nox.3pm
> Manifying blib/man3/CPAN::FirstTime.3pm
>   /usr/bin/make  -- OK
> Running make test
> PERL_DL_NONLAZY=1 /usr/bin/perl5.8.7 "-MExtUtils::Command::MM" "-e"
> "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
> t/00signature.......ok
>         1/1 skipped: various reasons
> t/01loadme..........ok
> t/02nox.............ok
> t/03pkgs............ok 1/11
>
> it keeps hanging...
>
> On Sep 26, 11:45 am, Matthew Cline <khym.cha...@gmail.com> wrote:
>> While using "perl -MCPAN -eshell" to install some Perl packages, I was
>> told that there was a new version of CPAN that I could upgrade to.  I
>> try to upgrade, and everything goes fine until it gets to the tests:
>>
>>   /usr/bin/make  -- OK
>> Running make test
>> PERL_DL_NONLAZY=1 /usr/bin/perl5.8.8 "-MExtUtils::Command::MM" "-e"
>> "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
>> t/00signature.......ok
>>         1/1 skipped: various reasons
>> t/01loadme..........ok
>> t/02nox.............ok
>> t/03pkgs............ok 1/11
>>
>> And it just freezes at "t/03pkgs............ok 1/11".  It's not using
>> up any CPU, so it's not an infinite loop, but other than that I have
>> no clue.  I'm using perl 5.8.8
>>
>> Thanks in advance.
>
>


-- 



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

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


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