[30040] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1283 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 17 00:09:44 2008

Date: Sat, 16 Feb 2008 21:09:06 -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           Sat, 16 Feb 2008     Volume: 11 Number: 1283

Today's topics:
        a newbie encounters difficulties in using module <rose@russ.org>
    Re: a newbie encounters difficulties in using module <ben@morrow.me.uk>
    Re: a newbie encounters difficulties in using module <bik.mido@tiscalinet.it>
    Re: a newbie encounters difficulties in using module <ben@morrow.me.uk>
    Re: copying arrays <mritty@gmail.com>
        extraction of info from fixed position <rose@russ.org>
    Re: extraction of info from fixed position <ben@morrow.me.uk>
    Re: extraction of info from fixed position <rose@russ.org>
    Re: extraction of info from fixed position <ben@morrow.me.uk>
        module installation <rose@russ.org>
        Net::Ping - problems with syn proto <dubito.ergo.sum@gmail.com>
    Re: TRAC - Trac, Project Leads, Python, and Mr. Noah Ka <tadmc@seesig.invalid>
    Re: TRAC - Trac, Project Leads, Python, and Mr. Noah Ka <jeff@schwabcenter.com>
    Re: TRAC - Trac, Project Leads, Python, and Mr. Noah Ka <ilias@lazaridis.com>
        use strings for xticklabels <rose@russ.org>
    Re: use strings for xticklabels <rose@russ.org>
        Why `for local $var (LIST) ...' not allowed? <xueweizhong@gmail.com>
    Re: Why `for local $var (LIST) ...' not allowed? <someone@example.com>
    Re: Writers Block <bik.mido@tiscalinet.it>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 16 Feb 2008 23:15:11 +0800
From: "Rose" <rose@russ.org>
Subject: a newbie encounters difficulties in using module
Message-Id: <fp6um2$m54$1@ijustice.itsc.cuhk.edu.hk>

I'm testing the codes obtained from internet:


  use Imager;
  use Imager::Plot;

  $plot = Imager::Plot->new(Width  => 550,
                          Height => 350,
                          GlobalFont => 'ImUgly.ttf');

  my @X = 0..100;
  my @Y = map { sin($_/10) } @X;
  my @Z = map { 1+cos($_/10) } @X;

  $plot->AddDataSet(X  => \@X, Y => \@Z);
  $plot->AddDataSet(X  => \@X, Y => \@Y,
                  style=>{marker=>{size   => 2,
                                   symbol => 'circle',
                                   color  => Imager::Color->new('red'),
                               },
                      });

  $img = Imager->new(xsize=>600, ysize => 400);
  $img->box(filled=>1, color=>'white');

  $plot->{'Ylabel'} = 'angst';
  $plot->{'Xlabel'} = 'time';
  $plot->{'Title'} = 'Quality time';

  $plot->Render(Image => $img, Xoff => 40, Yoff => 370);
  $img->write(file => "testout.png");

I have already installed Imager module by CPAN.

install Imager

then by

install Color

And when I ran the test.pl by perl test.pl, the following error appears. 
What else should I do?

Can't locate Imager/Color.pm in @INC (@INC contains: 
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi 
/usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl 
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi 
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl 
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .) at 
Imager.pm line 7.
BEGIN failed--compilation aborted at Imager.pm line 7.
Compilation failed in require at tst.pl line 1.
BEGIN failed--compilation aborted at tst.pl line 1.




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

Date: Sat, 16 Feb 2008 16:15:15 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: a newbie encounters difficulties in using module
Message-Id: <jpej85-6r5.ln1@osiris.mauzo.dyndns.org>


Quoth "Rose" <rose@russ.org>:
> I'm testing the codes obtained from internet:
> 
> 
>   use Imager;
>   use Imager::Plot;
<snip>
> 
> I have already installed Imager module by CPAN.
> 
> install Imager
> 
> then by
> 
> install Color

There is a module called 'Color' on the CPAN, but it has nothing to do
with Imager. If you meant Imager::Color, then that is part of the Imager
distribution and should have been installed along with Imager.

> And when I ran the test.pl by perl test.pl, the following error appears. 
> What else should I do?
> 
> Can't locate Imager/Color.pm in @INC (@INC contains: 

This makes no sense. Somehow you seem to have installed Imager.pm
without Imager/Color.pm, which should be impossible. I would suggest you
try reinstalling Imager.

Ben



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

Date: Sun, 17 Feb 2008 00:34:00 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: a newbie encounters difficulties in using module
Message-Id: <jlser3hdr361j9goob4sks4s7su2an6uak@4ax.com>

On Sat, 16 Feb 2008 16:15:15 +0000, Ben Morrow <ben@morrow.me.uk>
wrote:

>> Can't locate Imager/Color.pm in @INC (@INC contains: 
>
>This makes no sense. Somehow you seem to have installed Imager.pm
>without Imager/Color.pm, which should be impossible. I would suggest you
>try reinstalling Imager.

Unless she "installed" by copying Imager.pm into the appropriate
directory, which in "I'm testing the codes obtained from internet"
context may not be completely unreasonable as a possibility.


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: Sat, 16 Feb 2008 23:55:19 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: a newbie encounters difficulties in using module
Message-Id: <7o9k85-4o9.ln1@osiris.mauzo.dyndns.org>


Quoth Michele Dondi <bik.mido@tiscalinet.it>:
> On Sat, 16 Feb 2008 16:15:15 +0000, Ben Morrow <ben@morrow.me.uk>
> wrote:
> 
> >> Can't locate Imager/Color.pm in @INC (@INC contains: 
> >
> >This makes no sense. Somehow you seem to have installed Imager.pm
> >without Imager/Color.pm, which should be impossible. I would suggest you
> >try reinstalling Imager.
> 
> Unless she "installed" by copying Imager.pm into the appropriate
> directory, which in "I'm testing the codes obtained from internet"
> context may not be completely unreasonable as a possibility.

No, but she did say

> >> I already installed Imager by CPAN.
> >>
> >> install Imager

which ought to have done the right thing.

Ben



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

Date: Sat, 16 Feb 2008 12:58:18 -0800 (PST)
From: Paul Lalli <mritty@gmail.com>
Subject: Re: copying arrays
Message-Id: <ae9b6492-fb9d-43dd-a59c-63dbeab8b1e4@64g2000hsw.googlegroups.com>

On Feb 15, 10:02=A0pm, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth Paul Lalli <mri...@gmail.com>:
>
>
>
>
>
> > On Feb 15, 2:15=A0pm, Joost Diepenmaat <jo...@zeekat.nl> wrote:
> > > monkeys paw <u...@example.net> writes:
> > > > In the following code the array @drop is modified as well
> > > > as @drop2. How can I achieve modifying @drop2 without affecting
> > > > @drop?
>
> > > Actually, neither array is modified. You'd modifying the hashes
> > > referenced in both arrays. In other words, you want a deep copy of the=

> > > structure, not just a copy of the references in the array. In this
> > > specific case:
>
> > > my @drop2 =3D map { { %$_ } } @drop;
>
> > And in the more general case, when the first "inner" level of the
> > structure may also be references, use the Storable module, as
> > suggested by `perldoc -q copy`:
>
> Or Clone, which is faster for ordinary data structures like this.

but has the disadvantage of not being in the core Perl distrobution.


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

Date: Sun, 17 Feb 2008 00:12:55 +0800
From: "Rose" <rose@russ.org>
Subject: extraction of info from fixed position
Message-Id: <fp722a$npp$1@ijustice.itsc.cuhk.edu.hk>

Instead of specifying in detail (e.g. d+d+...) in a regular expression, is 
it possible to specify some fixed numbers for perl to extract information, 
in this example, S, 95 from line 1; 'space',42 from line2 and 'T',156 from 
line3 in the following 3 lines?

   46   51   V  S    S-     0   0   95     -2,-0.9    -7,-0.2    -6,-0.2 
2,-0.1  -0.899  75.7-167.1-103.3 112.1   10.3    5.4   11.8
   47   52   E    >   -     0   0   42     -9,-2.9     3,-1.9    -2,-0.6 
2,-0.2  -0.404  37.9 -78.0 -91.0 165.9    6.6    5.6   11.1
   48   53   K  T 3  S+     0   0  156      1,-0.3    -1,-0.1 
  2,-0.2   -10,-0.0  -0.457 122.1  14.4 -66.2 127.7    4.9    5.9    7.7
 




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

Date: Sat, 16 Feb 2008 16:24:39 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: extraction of info from fixed position
Message-Id: <7bfj85-6r5.ln1@osiris.mauzo.dyndns.org>


Quoth "Rose" <rose@russ.org>:
> Instead of specifying in detail (e.g. d+d+...) in a regular expression, is 
> it possible to specify some fixed numbers for perl to extract information, 
> in this example, S, 95 from line 1; 'space',42 from line2 and 'T',156 from 
> line3 in the following 3 lines?
> 
>    46   51   V  S    S-     0   0   95     -2,-0.9    -7,-0.2    -6,-0.2 
> 2,-0.1  -0.899  75.7-167.1-103.3 112.1   10.3    5.4   11.8

If I've understood you correctly, that's what substr is for.

Ben



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

Date: Sun, 17 Feb 2008 00:41:48 +0800
From: "Rose" <rose@russ.org>
Subject: Re: extraction of info from fixed position
Message-Id: <fp73of$ogf$1@ijustice.itsc.cuhk.edu.hk>

>>
>>    46   51   V  S    S-     0   0   95     -2,-0.9    -7,-0.2    -6,-0.2
>> 2,-0.1  -0.899  75.7-167.1-103.3 112.1   10.3    5.4   11.8
>
> If I've understood you correctly, that's what substr is for.
>
> Ben
>

Yes, Ben. You're right. Thanks. Now I have to think about how to solve the 
problem of recognizing space in the first element (so it remains a space) 
and removing spaces in the 2nd element (so the latter one will be a number 
but not a string). 




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

Date: Sat, 16 Feb 2008 18:02:09 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: extraction of info from fixed position
Message-Id: <12lj85-t17.ln1@osiris.mauzo.dyndns.org>


Quoth "Rose" <rose@russ.org>:
> >>
> >>    46   51   V  S    S-     0   0   95     -2,-0.9    -7,-0.2    -6,-0.2
> >> 2,-0.1  -0.899  75.7-167.1-103.3 112.1   10.3    5.4   11.8
> >
> > If I've understood you correctly, that's what substr is for.
> 
> Yes, Ben. You're right. Thanks. Now I have to think about how to solve the 
> problem of recognizing space in the first element (so it remains a space) 
> and removing spaces in the 2nd element (so the latter one will be a number 
> but not a string). 

Don't worry about it. Perl will strip leading and trailing spaces when
auto-converting a string to a number:

    ~% perl -wle'print "  -100.45  " + 1'
    -99.45

Ben



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

Date: Sun, 17 Feb 2008 10:21:52 +0800
From: "Rose" <rose@russ.org>
Subject: module installation
Message-Id: <fp85o3$1od$1@ijustice.itsc.cuhk.edu.hk>

Thanks to Ben's and Michele's advice, I'm reconfirming the modeule 
installation.

cpan[61]> install Imager

Imager is up to date (0.62).

Indeed the problem may arise because intially I did by:

install Bundle:Imager

following some web "instructions".

and later I also tried:

install GD
install PGPLOT

and so.

When I tried to uninstall them, I went to perl directory but could not find 
the modules and therefore could not "delete" them. Now I guess maybe the 
installation was not clean and makes the problem happen.


the author's codes are:

use Imager;
  use Imager::Plot;

  $plot = Imager::Plot->new(Width  => 550,
                          Height => 350,
                          GlobalFont => 'ImUgly.ttf');

  my @X = 0..100;
  my @Y = map { sin($_/10) } @X;
  my @Z = map { 1+cos($_/10) } @X;

  $plot->AddDataSet(X  => \@X, Y => \@Z);
  $plot->AddDataSet(X  => \@X, Y => \@Y,
                  style=>{marker=>{size   => 2,
                                   symbol => 'circle',
                                   color  => Imager::Color->new('red'),
                               },
                      });

  $img = Imager->new(xsize=>600, ysize => 400);
  $img->box(filled=>1, color=>'white');

  $plot->{'Ylabel'} = 'angst';
  $plot->{'Xlabel'} = 'time';
  $plot->{'Title'} = 'Quality time';

  $plot->Render(Image => $img, Xoff => 40, Yoff => 370);
  $img->write(file => "testout.png");



cpan[63]> install Imager:Plot

Running install for module 'Imager::Plot'
Running make for A/AD/ADDI/Imager-Plot-0.09.tar.gz
  Has already been unwrapped into directory 
/root/.cpan/build/Imager-Plot-0.09-IXL2Mr
  '/usr/bin/perl Makefile.PL' returned status 65280, won't make
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install






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

Date: Sat, 16 Feb 2008 21:02:41 -0800 (PST)
From: nopohack <dubito.ergo.sum@gmail.com>
Subject: Net::Ping - problems with syn proto
Message-Id: <7c0bc60a-27da-4894-8612-ce1561efdcff@d21g2000prf.googlegroups.com>

Hello,

I am attempting to use Net::Ping as part of a script to validate
entries in our automount maps. To speed the process of checking the
mount points, I am using Net::Ping to contact the nfs server to make
sure it is up. I know there are a few entries that reference NFS
servers that have been decommissioned, which is causing me problems.

When I try to do a $p->ack($host) and the hostname isn't registered in
DNS Net::Ping dies. Is there a trick to get the ack method to not kill
my script when the hostname lookup fails?

Currently I am thinking that I need to DNS lookups on each hostname to
verify that it resolves, but one would think that attempting to ping a
non-existant host would return undef.

TIA!



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

Date: Sat, 16 Feb 2008 21:15:29 GMT
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: TRAC - Trac, Project Leads, Python, and Mr. Noah Kantrowitz    (sanitizer)
Message-Id: <slrnfrebee.cfu.tadmc@tadmc30.sbcglobal.net>


["Followup-To:" header set to comp.lang.perl.misc.]


Jeff Schwab <jeff@schwabcenter.com> wrote:
> Robert Klemme wrote:
>> On 16.02.2008 13:16, Ilias Lazaridis wrote:
>> 
>> <snip/>
>> 
>> Oh, it's him again.  Please do not respond.
>> 
>> http://dev.eclipse.org/newslists/news.eclipse.foundation/msg00167.html
>> http://www.encyclopediadramatica.com/index.php/Ilias
>
> Thank you.  I didn't recognize his name at first.


I had the post already pegged as bait simply by counting
the number of commas in the Newsgroups header. :-)


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


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

Date: Sat, 16 Feb 2008 09:13:32 -0800
From: Jeff Schwab <jeff@schwabcenter.com>
Subject: Re: TRAC - Trac, Project Leads, Python, and Mr. Noah Kantrowitz  (sanitizer)
Message-Id: <OfSdnYDWkMoFhCranZ2dnUVZ_gOdnZ2d@comcast.com>

Robert Klemme wrote:
> On 16.02.2008 13:16, Ilias Lazaridis wrote:
> 
> <snip/>
> 
> Oh, it's him again.  Please do not respond.
> 
> http://dev.eclipse.org/newslists/news.eclipse.foundation/msg00167.html
> http://www.encyclopediadramatica.com/index.php/Ilias

Thank you.  I didn't recognize his name at first.



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

Date: Sat, 16 Feb 2008 17:13:55 -0800 (PST)
From: Ilias Lazaridis <ilias@lazaridis.com>
Subject: Re: TRAC - Trac, Project Leads, Python, and Mr. Noah Kantrowitz  (sanitizer)
Message-Id: <ebb8c192-b772-49a0-96c3-fea1c6070e81@u72g2000hsf.googlegroups.com>

On 16 =D6=E5=E2, 15:45, Robert Klemme <shortcut...@googlemail.com> wrote:
> On 16.02.2008 13:16, Ilias Lazaridis wrote:
>
> <snip/>
>
> Oh, it's him again.  Please do not respond.
>
> http://dev.eclipse.org/newslists/news.eclipse.foundation/msg00167.html

Thanks, nice message, I've added it to the section:

http://case.lazaridis.com/wiki/CoreLiveEval#WhatPeopleThink

> http://www.encyclopediadramatica.com/index.php/Ilias

It's really funny how easily people fall into the
"encyclopediadramatica-trap"... really funny.

"
While the articles themselves are mostly satirical jabs at Internet
users (both individually and in groups) and phenomena, bear in mind
that the Encyclopedia Dramatica itself is a parody of a much less
funny online encyclopedia. As such, ED articles tend to make fun of
the supposed objectivity and accuracy, elitism, and stupid edit wars
of such sites. In other words, expect blatant, biased lies, and expect
boring truths to get deleted quickly."
http://www.encyclopediadramatica.com/Encyclopedia_Dramatica:About

> Cheers
>
>         robert




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

Date: Sun, 17 Feb 2008 00:33:59 +0800
From: "Rose" <rose@russ.org>
Subject: use strings for xticklabels
Message-Id: <fp739r$o8p$1@ijustice.itsc.cuhk.edu.hk>

my string containing a number of alphabets is loaded by:

 ss= fscanf(ssfid,'%s',[1 inf]);

the xy coordinates are read by:

 xy = fscanf(fid,'%d %g ',[2 inf]);

when I try to plot by:

plot ( xy(1,:), xy(2,:) );
set(gca, 'XTick',ss, 'XTickLabel',ss );

all the data clump together but

     for ii = 1:size(xy(1,:))
         text(xy(1,ii)+0.2,xy(2,ii),ss);
     end

does not have the problem. How to solve that? I want to put the ss alphabets 
as X tick labels. 




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

Date: Sun, 17 Feb 2008 00:34:40 +0800
From: "Rose" <rose@russ.org>
Subject: Re: use strings for xticklabels
Message-Id: <fp73b3$odf$1@ijustice.itsc.cuhk.edu.hk>

Sorry wrong post here. sorry again 




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

Date: Sat, 16 Feb 2008 07:30:57 -0800 (PST)
From: Todd <xueweizhong@gmail.com>
Subject: Why `for local $var (LIST) ...' not allowed?
Message-Id: <6fe53179-f956-4f42-8ef4-8676e3ad16c7@s12g2000prg.googlegroups.com>

Why can't we explicit using local loop variable in the code snippet
below?

    #! /bin/perl

    for local $a (1..2) {
        print $a;
    }

    __END__
    syntax error at - line 3, near "for local"
    Execution of - aborted due to compilation errors.

You see here `my'/`our' are allowed in the code snippet below, why not
`local'?

    #! /bin/perl

    for my $a (1..2) {
        print $a;
    }

    __END__

    12

    #! /bin/perl

    for our $a (1..2) {
        print $a;
    }

    __END__
    12


-Todd


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

Date: Sat, 16 Feb 2008 16:54:56 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Why `for local $var (LIST) ...' not allowed?
Message-Id: <AzEtj.27224$w57.20466@edtnps90>

Todd wrote:
> Why can't we explicit using local loop variable in the code snippet
> below?

Because it is a syntax error.

>     #! /bin/perl
> 
>     for local $a (1..2) {
>         print $a;
>     }
> 
>     __END__
>     syntax error at - line 3, near "for local"
>     Execution of - aborted due to compilation errors.
> 
> You see here `my'/`our' are allowed in the code snippet below, why not
> `local'?

Because that is the way perl works.



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: Sun, 17 Feb 2008 00:23:57 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Writers Block
Message-Id: <f3ser35cv5q4cjvbeih4hrkagu0nq33ap1@4ax.com>

On Fri, 15 Feb 2008 12:58:00 -0800 (PST), dale
<dalestubblefield@gmail.com> wrote:

>> http://perl.plover.com/FAQs/Buffering.html
[snip]
>I skimmed over the page you referenced, but I do not understand how it
>applies in this situation.

I skimmed the rest of this thread, but try $|++;


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: 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 1283
***************************************


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