[31133] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2378 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 30 00:17:48 2009

Date: Wed, 29 Apr 2009 21:09:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 29 Apr 2009     Volume: 11 Number: 2378

Today's topics:
    Re: Can't locate object method "dslip_status" <smallpond@juno.com>
    Re: Can't locate object method "dslip_status" <1usa@llenroc.ude.invalid>
        discrete waveform <m.muskala@googlemail.com>
    Re: How to find duplicate in certain fields of array??  <some@body.com>
    Re: How to find duplicate in certain fields of array?? <some@body.com>
    Re: linked list <alexxx.magni@gmail.com>
        Perl command call check <n@solenttechnology.co.uk>
    Re: Perl command call check <ben@morrow.me.uk>
    Re: Perl command call check <tadmc@seesig.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 29 Apr 2009 14:38:14 -0700 (PDT)
From: smallpond <smallpond@juno.com>
Subject: Re: Can't locate object method "dslip_status"
Message-Id: <2d137d79-4ab8-4ada-a557-e7e8874fbbdb@z23g2000prd.googlegroups.com>

On Apr 29, 3:57 pm, Mala Dibbs <m...@web.de> wrote:
> Hi,
>
> i'm trying to install a plugin for Twiki which has an installer script written in perl.
>
> It gives me "Can't locate object method "dslip_status" via package "CPAN::Module" at
> tools/extender.pl line 256, <STDIN> chunk 1." before dying.
>
> Is there something wrong with my perl installation?
>
> Greets, mala

When I look in my Module.pm I don't see dslip_status either
so I'm guessing there is nothing wrong with perl but
something wrong with the installer program extender.pl.
Maybe it is not up to date with your version of perl or CPAN?


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

Date: Thu, 30 Apr 2009 00:03:15 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Can't locate object method "dslip_status"
Message-Id: <Xns9BFCCBFABD7A3asu1cornelledu@127.0.0.1>

smallpond <smallpond@juno.com> wrote in
news:2d137d79-4ab8-4ada-a557-e7e8874fbbdb@z23g2000prd.googlegroups.com: 

> On Apr 29, 3:57 pm, Mala Dibbs <m...@web.de> wrote:
>> Hi,
>>
>> i'm trying to install a plugin for Twiki which has an installer
>> script written in perl. 
>>
>> It gives me "Can't locate object method "dslip_status" via package
>> "CPAN::Module" at tools/extender.pl line 256, <STDIN> chunk 1."
>> before dying. 
>>
>> Is there something wrong with my perl installation?
>>
 ...

> 
> When I look in my Module.pm I don't see dslip_status either

http://search.cpan.org/~andk/CPAN-1.9304/lib/CPAN.pm

Search the page for dslip_status

dslip_status is in CPAN.pm. Package CPAN::Module is in that file, not in 
Module.pm

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/


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

Date: Wed, 29 Apr 2009 09:10:49 -0700 (PDT)
From: "m.muskala@googlemail.com" <m.muskala@googlemail.com>
Subject: discrete waveform
Message-Id: <e964838c-3524-46fd-802a-442b48f64c23@y10g2000prc.googlegroups.com>

hi ng,

can i plot also discrete waveform using GD::Graph?
Or what is the alternative way to reach the  goal?

Thanks in advance

Greetings
Magda


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

Date: Wed, 29 Apr 2009 22:34:56 -0400
From: somebody <some@body.com>
Subject: Re: How to find duplicate in certain fields of array?? - SOLUTION
Message-Id: <pan.2009.04.30.02.34.52.123019@body.com>

Here's the solution I came up with:


while ( <DATAFILE> ) { 

##while ( <DATA> ) {

  my @tokens = ();
  my @names = ();
  my $arg;
  my %seen;
  my @origrec = $_;
  my @record = split /\|/;

  #Place all 4 name fields in names array (first, mi, last, suffix).
  push @names, @record[ 3 .. 6 ];

  #Split space separated "words" in 4 name fields.  E.g., the last name field
  #might contain "SMITH JR.".
  foreach $arg (@names) {
    push (@tokens, split(/ /, $arg));
  }

  #Iterate over each token and if duplicate, print record.
  foreach (@tokens) {
    #ORG print @record if ($seen{$_}++);
    print @origrec if ($seen{$_}++);
    next;
  } 


On Mon, 27 Apr 2009 17:54:00 -0400, somebody wrote:

> In the __DATA__ below, the first and last rows contain duplicate names,
> i.e., WILLIAM in the first row, and HARRIS in the last row.  I need to
> check each of the 4 name fields (first, middle, last, and suffix) for
> duplicate names.  So, I've pushed the 4 name fields into a separate array
> named @array.  How do I check for duplicates within the 4 named fields?
> This is a bit more involved than finding duplicate array elements, since
> sub-strings are involved.
> 
> -Thanks
> 
> 
> while ( <DATA> ) {
> 
>   @row = split /\|/;
> 
>   #Place all 4 name fields in array(first, middle, last, suffix).
>   for ($i=3; $i <= 6; $i++) {
>     push (@array, "$row[$i]");
>   }
> 
> 
> __DATA__
> CA|6299| |WILLIAM| |S|SMITH WILLIAM|
> DE|6209| |MANNY|J|MORALES|JR.|
> WA|1838| |KATHLEEN| |MCDONALD| |
> OH|3968| |JR|SCOTT HARRIS|HARRIS|JR|



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

Date: Wed, 29 Apr 2009 22:36:48 -0400
From: somebody <some@body.com>
Subject: Re: How to find duplicate in certain fields of array??
Message-Id: <pan.2009.04.30.02.36.48.380724@body.com>

> The only duplicates I see are 'JR' in the last record.
> If your data is this screwed up you need to eyeball the
> data and forget about a computer program.
> 
> Btw, your half assed attempt at the obligatory sample code
> won't even compile. WTF do *you* think you should do huh?
> 
> -sln


You are a dimwit.  I posted the solution.  

WAFA


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

Date: Wed, 29 Apr 2009 04:11:10 -0700 (PDT)
From: "alexxx.magni@gmail.com" <alexxx.magni@gmail.com>
Subject: Re: linked list
Message-Id: <8f494a5e-ef1a-4f7e-9136-bb8c1a2aac44@r31g2000prh.googlegroups.com>

On 29 Apr, 11:57, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
> On 2009-04-29 06:45, alexxx.ma...@gmail.com <alexxx.ma...@gmail.com> wrot=
e:
>
>
>
> > please forgive me if this is a dumb question, but I'm unable to code a
> > linked list in perl - to be precise I'm able to create it but I'm
> > unable to delete nodes...
>
> > the linked list contains 2 coordinates 'x','y' for each node:
>
> > my $pixies=3Dundef;
>
> > for(1..10)
> > { $pixies=3D [ $pixies, {'x'=3D>int(3*rand()), 'y'=3D>int(10*rand())} ]=
 }
>
> > my $head=3D$pixies;
>
> > for $i(1..10)
> > {
> > =A0 =A0 print("$i\t",$pixies->[1]{'x'},"\t",$pixies->[1]{'y'},"\n");
> > =A0 =A0 $pixies=3D$pixies->[0];
> > }
>
> Here you just walked beyond the tenth (=3D last) node of your list.
> So, $pixies is undef here.
>
>
>
> > # trying to delete the 8th node:
> > for $i(1..7)
> > { =A0 $pixies=3D$pixies->[0] }
>
> And here you try to walk 7 more steps.
> $pixies stays undef (sometimes autovivification is a bitch - there
> should be a way to get a warning in this case).
>
>
>
> > # now!
> > =A0 =A0$pixies->[0]=3D$pixies->[0][0];
>
> So here you don't delete the 8th node, you just create a new array,
> assign undef to it's element 0, and ...
>
>
>
> > print"\n\n\tdeleted 8...\n\n\n";
>
> > # check:
> > $pixies=3D$head;
>
> immediately overwrite it.
>
>
>
> > for $i(1..10)
> > {
> > =A0 =A0 print("$i\t",$pixies->[1]{'x'},"\t",$pixies->[1]{'y'},"\n");
> > =A0 =A0 $pixies=3D$pixies->[0];
> > }
>
> > and I got the same nodes again!!! What am I doing wrong?
>
> You forgot
>
> =A0 =A0 $pixies=3D$head;
>
> before
>
> =A0 =A0 # trying to delete the 8th node:
>
> (You also forgot "use warnings; use strict;", but in that case it
> wouldn't have helped).
>
> > Thanks a lot for any help on this...
>
> > P.S.: I read often that linked lists implemented this way are =A0not th=
e
> > way to go in perl, that you can do the same things with arrays (arrays
> > of hashes, in my case).
> > Do you agree?
>
> Yes.
>
> > And in that case, how would you delete a node in the
> > middle of the array without too much copying around of large
> > structures?
>
> Perl arrays really contain only pointers to the elements. So if you
> delete 1 element from the middle of a 1-million-element array, you only
> have to move 500000 pointers (about 2 MB on a 32 bit system), not
> 500000 perl scalars. That's pretty fast, especially if you compare it
> to the time needed to walk through 500000 nodes.
>
> There may be some situations where a simple singly-linked list is better
> than a perl array, but I am sure they are rare. More complicated data
> structures (especially various kinds of trees) are useful more often.
>
> =A0 =A0 =A0 =A0 hp

many many thanks

alessandro


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

Date: Wed, 29 Apr 2009 05:56:56 -0700 (PDT)
From: neilsolent <n@solenttechnology.co.uk>
Subject: Perl command call check
Message-Id: <0510ca1e-9ab5-454c-ab9b-25c562edacd0@y33g2000prg.googlegroups.com>

Before calling a command with system() or with backticks, is there a
neat way to check that the executable exists in the path (i.e. like
the UNIX "which" command) ?

Seems a bit untidy to attempt to run the command blindly and then use
the return code / output to first check whether the command was even
found.

thanks,
Neil


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

Date: Thu, 30 Apr 2009 00:17:09 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Perl command call check
Message-Id: <lo3nc6-gk7.ln1@osiris.mauzo.dyndns.org>


Quoth neilsolent <n@solenttechnology.co.uk>:
> Before calling a command with system() or with backticks, is there a
> neat way to check that the executable exists in the path (i.e. like
> the UNIX "which" command) ?

File::Which. Note that this won't find shell builtins, even though you
can invoke them with system.

It is worth mentioning that there is a race condition between this check
and the actual invocation, and that trying something and letting it fail
is usually a better strategy than trying to second-guess the answer;
however, I'm pretty sure that all implementations of system that search
the PATH have the same race condition internally, so it doesn't matter
much in this case.

Ben



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

Date: Wed, 29 Apr 2009 18:45:40 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Perl command call check
Message-Id: <slrngvhpl4.oda.tadmc@tadmc30.sbcglobal.net>

neilsolent <n@solenttechnology.co.uk> wrote:
> Before calling a command with system() or with backticks, is there a
> neat way to check that the executable exists in the path (i.e. like
> the UNIX "which" command) ?


It is a Really Good Idea to use a full pathspec for external
commands rather than relying on PATH.

If PATH=/opt/badbin:/bin and there is an "ls" in badbin/ then
    system 'ls *' 
will run badbin/ls whereas 
    system '/bin/ls *' 
will run /bin/ls.


> Seems a bit untidy to attempt to run the command blindly and then use
> the return code / output to first check whether the command was even
> found.

If you adopt the security measure suggested above then:

    die "/bin/ls could not be executed" unless -x '/bin/ls';

:-)


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

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


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