Re: Can't call method "Convolve" on unblessed reference at gifaninmation.pl line 47.

2022-02-04 Thread David Mertens
ttf', >> pointsize=>40,fill=>'green',text=>$text); >> >> # Perhaps you want to extract all the pixel intensities from an image and >> write them to STDOUT >> @pixels = $image->GetPixels(map=>'I', >> height=>$height,width=>$w

Re: Can't call method "Convolve" on unblessed reference at gifaninmation.pl line 47.

2022-02-04 Thread William Torrez Corea
m to STDOUT > @pixels = $image->GetPixels(map=>'I', > height=>$height,width=>$width,normalize=>true); > binmode STDOUT; > print pack('B*',join('',@pixels)); > > # Other clever things you can do with a PerlMagick objects include > $i = &

Re: Can't call method "Convolve" on unblessed reference at gifaninmation.pl line 47.

2022-02-04 Thread David Mertens
The issue isn't having the method, the issue is calling it on an unblessed reference. Can you show the code that gives this problem? Btw, my bet is that it's not a matter of having PDL's method. You would use PDL for number crunching, not gif animation. :-) David On Fri, Feb 4,

Re: Can't call method "Convolve" on unblessed reference at gifaninmation.pl line 47.

2022-02-04 Thread William Torrez Corea
result is wrong. Can't call method "Convolve" on unblessed reference at gifaninmation.pl > line 47. > I don't know in what part I am confused. On Fri, Feb 4, 2022 at 8:34 AM Andrew Solomon wrote: > Is this what you're looking for? > > https://metacpan.or

Re: Can't call method "Convolve" on unblessed reference at gifaninmation.pl line 47.

2022-02-04 Thread Andrew Solomon
Is this what you're looking for? https://metacpan.org/pod/PDL::ImageND On Fri, Feb 4, 2022 at 2:30 PM William Torrez Corea wrote: > I'm using cpanm trying to find a method that contains the function > convolve but I only found the method Imager. > > https://metacpan.org/pod/Imager > > When I t

Can't call method "Convolve" on unblessed reference at gifaninmation.pl line 47.

2022-02-04 Thread William Torrez Corea
I'm using cpanm trying to find a method that contains the function convolve but I only found the method Imager. https://metacpan.org/pod/Imager When I try to declare the method and use it in the code, the result is always wrong. I am using the following libraries: > > > > *#!/usr/local/bin/perl

if(defined(undef)) gives can't use undefined value as a SCALAR reference.

2014-08-30 Thread Dave Horner
Artifactory-Client: zero length file uploads https://rt.cpan.org/Public/Bug/Display.html?id=97772 'expect' => '100-continue' undefined value as a SCALAR reference #63 https://github.com/libwww-perl/libwww-perl/issues/63 if(defined($wbits)) is giving me can't use and

Re: how to do a reference to a func in Math::Trig

2012-06-24 Thread Charles Smith
Thank you. The useful note about CORE, in particular, is new to me. cts --- On Sun, 6/24/12, Rob Dixon wrote: > From: Rob Dixon > Subject: Re: how to do a reference to a func in Math::Trig > To: "Perl Beginners" > Cc: "Charles Smith" > Date: Sunday, June

Re: how to do a reference to a func in Math::Trig

2012-06-24 Thread Rob Dixon
On 24/06/2012 19:51, Rob Dixon wrote: or by aliasing the current package's 'sin' and 'cos' subroutines with the CORE functions: use strict; use warnings; use Math::Trig; BEGIN { no warnings 'once'; *sin = \&CORE::sin; *cos = \&CORE::cos; } f

Re: how to do a reference to a func in Math::Trig

2012-06-24 Thread Rob Dixon
so I can use this, my "siggen" pgm with gnuplot: plot "<(./siggen -f cos -p 2 -n66 )" lc 1 to get a nice curve. Unfortunately, though, I was only able to get it to work as symbolic reference. First I tried: $f = \&Math::Complex::$func; Scalar found where

Re: how to do a reference to a func in Math::Trig

2012-06-23 Thread Charles Smith
h gnuplot: plot "<(./siggen -f cos -p 2 -n66 )" lc 1 to get a nice curve. Unfortunately, though, I was only able to get it to work as symbolic reference. First I tried: $f = \&Math::Complex::$func; Scalar found where operator expected at ./siggen line 194, near &

Re: how to do a reference to a func in Math::Trig

2012-06-23 Thread Ron Bergin
Charles Smith wrote: [snip] > > But this pgm fails: > > #!/usr/bin/env perl > use Math::Trig; > my $a = \&Math::Trig::cos; > &$a(0); > > Undefined subroutine &Math::Trig::cos called at modfunctor line 7. > The cos sub is defined in Math::Complex, which Math::Trig loads. Try this: use strict; us

Re: how to do a reference to a func in Math::Trig

2012-06-23 Thread Charles Smith
Hello Shawn, thank you for answering. I'm sorry, I was a bit sloppy with my example and so maybe unclear about my question ... It's not about the precise syntax of getting a reference to a subroutine, but rather a subroutine in a module. For example, this pgm is clear: #!/usr/bi

Re: how to do a reference to a func in Math::Trig

2012-06-23 Thread Shawn H Corey
On 12-06-23 10:12 AM, Charles Smith wrote: I'm experimenting with Math::Trig and would like to be able to pass the function in as a parameter: $f = $opts{f} || &sin; $f = $opts{f} || \&sin; See `perldoc perlreftut` and `perldoc perlref`. -- Just my 0.0002 million dollars worth,

how to do a reference to a func in Math::Trig

2012-06-23 Thread Charles Smith
&Math::Trig::sin; Undefined subroutine &Math::Trig::sin called at (eval 10)... $f = \&sin;# just delays the problem etc. Can anyone tell me how to take a reference to func in a module? TIA cts -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org Fo

Re: Unblessed reference problem

2012-05-21 Thread sono-io
On May 20, 2012, at 8:28 AM, Shlomi Fish wrote: > The problem is that «$self->animals» returns an (unblessed) array reference > and > not the list of individual animals, so you should do something like: > > for my $animal (@{ $self->animals }) { Thanks, Shlomi. T

Re: Unblessed reference problem

2012-05-20 Thread Chris Nehren
On Sun, May 20, 2012 at 21:44:29 -0400 , John SJ Anderson wrote: > On Sunday, May 20, 2012 at 9:28 PM, Peter Scott wrote: > > On Sun, 20 May 2012 18:28:10 +0300, Shlomi Fish wrote: > > > Note that I think I saw a way to return the flattened array in Moose, > > > but I don't remember the specifics.

Re: Unblessed reference problem

2012-05-20 Thread John SJ Anderson
On Sunday, May 20, 2012 at 9:28 PM, Peter Scott wrote: > On Sun, 20 May 2012 18:28:10 +0300, Shlomi Fish wrote: > > Note that I think I saw a way to return the flattened array in Moose, > > but I don't remember the specifics. > > > > > auto_deref => 1 > … which is semi-deprecated/recommende

Re: Unblessed reference problem

2012-05-20 Thread Peter Scott
On Sun, 20 May 2012 18:28:10 +0300, Shlomi Fish wrote: > Note that I think I saw a way to return the flattened array in Moose, > but I don't remember the specifics. auto_deref => 1 -- Peter Scott http://www.perlmedic.com/ http://www.perldebugged.com/ http://www.informit.com/store/product.asp

Re: Unblessed reference problem

2012-05-20 Thread Shlomi Fish
Hi Marc, On Sat, 19 May 2012 20:09:00 -0700 sono...@fannullone.us wrote: > I'm trying the following code from Programming Perl, but I'm get the > error "Can't call method "type" on unblessed reference at untitled text 10 > line 23". I

Unblessed reference problem

2012-05-19 Thread sono-io
I'm trying the following code from Programming Perl, but I'm get the error "Can't call method "type" on unblessed reference at untitled text 10 line 23". I've checked the errata page, but there's nothing listed for it. Searching on the

Re: Inserting a new data structure in a bless reference

2012-01-15 Thread David Christensen
On 01/13/2012 07:25 PM, Parag Kalra wrote: my $obj = FooBar->new; $obj->{'new_key'} = 'some_value' Now I am not sure if that is the correct way of inserting a new data structure into an already bless reference 1. FooBar may or may not be implemented as a hashref.

Re: Inserting a new data structure in a bless reference

2012-01-14 Thread Shawn H Corey
w I am not sure if that is the correct way of inserting a new data structure into an already bless reference My aim to use this data structure across the script and FooBar through the object -$obj once added. This could cause problems if a new version of FooBar starts using new_key. Instead, creat

Re: Inserting a new data structure in a bless reference

2012-01-13 Thread Jeff Peng
于 2012-1-14 11:25, Parag Kalra 写道: use FooBar; my $obj = FooBar->new; Do something ... $obj->{'new_key'} = 'some_value' Now I am not sure if that is the correct way of inserting a new data structure into an already bless reference I don't thin

Inserting a new data structure in a bless reference

2012-01-13 Thread Parag Kalra
ay of inserting a new data structure into an already bless reference My aim to use this data structure across the script and FooBar through the object -$obj once added.

Re: Manipulating reference to array of array references

2011-11-21 Thread Mohan L
>> Unless you really want to change your data, use map(). >> > > Ruud didn't say that you shouldn't change the data, only that you should > use map unless that was what you wanted. Who knows what the OP wants. > > Rob Sorry for the delay. What Shlomi Fish mentioned was I wanted. Thanks for all

Re: Manipulating reference to array of array references

2011-11-21 Thread Rob Dixon
On 20/11/2011 04:14, Chris Charley wrote: Well, if Dr Ruud is right, and you shouldn't replace the undefs in the original arrays, then the following program wouldn't be correct. It changes the original array (data). On 20/11/2011 00:23, Dr.Ruud wrote: Unless you really want to change your da

Re: Manipulating reference to array of array references

2011-11-20 Thread Chris Charley
"Mohan L" wrote in message news:cadihtmt4rqntknjlgsimpgqv9xuc89dryhtx00ctwbknxwd...@mail.gmail.com... Dear all, #!/usr/bin/env perl #dummy.pl use strict; use warnings; use Data::Dumper; my $ref_to_AoA = [ [ "fred", "barney",undef,"pebbles", "bambam", "dino", ], [ "homer",und

Re: Manipulating reference to array of array references

2011-11-20 Thread Rob Dixon
On 19/11/2011 18:21, Mohan L wrote: Dear all, #!/usr/bin/env perl #dummy.pl use strict; use warnings; use Data::Dumper; my $ref_to_AoA = [ [ "fred", "barney",undef,"pebbles", "bambam", "dino", ], [ "homer",undef,"bart",undef, "marge", "maggie", ], [ "george", "jane",u

Re: Manipulating reference to array of array references

2011-11-19 Thread Dr.Ruud
On 2011-11-19 19:21, Mohan L wrote: But What I want is, I want to replace all 'undef' to a string 'foo'. Unless you really want to change your data, use map(). -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://l

Re: Manipulating reference to array of array references

2011-11-19 Thread Shlomi Fish
Hi Mohan, On Sat, 19 Nov 2011 23:51:19 +0530 Mohan L wrote: > Dear all, > > #!/usr/bin/env perl > #dummy.pl > use strict; > use warnings; > use Data::Dumper; > > my $ref_to_AoA = [ > [ "fred", "barney",undef,"pebbles", "bambam", "dino", ], > [ "homer",undef,"bart",undef, "marge

Manipulating reference to array of array references

2011-11-19 Thread Mohan L
Dear all, #!/usr/bin/env perl #dummy.pl use strict; use warnings; use Data::Dumper; my $ref_to_AoA = [ [ "fred", "barney",undef,"pebbles", "bambam", "dino", ], [ "homer",undef,"bart",undef, "marge", "maggie", ], [ "george", "jane",undef, "elroy",undef,"judy", ], ];

Re: blessing a reference containing a digraph

2011-11-16 Thread Jim Gibson
what is happening here. The class name is returned but exactly how are the $value reference and $class related? Read the documentation for bless: 'perldoc -f bless' bless REF,CLASSNAME bless REF This function tells the thingy referenced by

blessing a reference containing a digraph

2011-11-16 Thread blawson
returned but exactly how are the $value reference and $class related? TYIA, blawson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Cannot bind a reference

2011-10-06 Thread Zachary Zebrowski
,'test'); } On Thu, Oct 6, 2011 at 1:03 PM, Jeffrey Joh wrote: > > Thank you for your help Rob. > > > > How can I write a code to go to next iteration of the foreach loop if there > is a "Cannot bind a reference" error? > > > Thanks, > > Je

RE: Cannot bind a reference

2011-10-06 Thread Jeffrey Joh
Thank you for your help Rob. How can I write a code to go to next iteration of the foreach loop if there is a "Cannot bind a reference" error? Thanks, Jeffrey > Date: Sun, 2 Oct 2011 01:54:38 +0100 > From: rob.di...@gmx.com

Re: Cannot bind a reference

2011-10-01 Thread Rob Dixon
On 01/10/2011 23:16, Jeffrey Joh wrote: > > I am trying to run an insert statement with DBI. > > $dbh->do(q{insert into zillow_table values > (?,?,?,?,?,?,?,?)},undef,($homeid,$code,$text,$pid,$street,$city,$state,$zlastupdated)); > > However, I get "Cannot bind

Cannot bind a reference

2011-10-01 Thread Jeffrey Joh
Hello, I am trying to run an insert statement with DBI. $dbh->do(q{insert into zillow_table values (?,?,?,?,?,?,?,?)},undef,($homeid,$code,$text,$pid,$street,$city,$state,$zlastupdated)); However, I get "Cannot bind a reference" error. Why does that occur? $dbh is part

Re: Using an undefined value as a hash reference

2011-08-07 Thread Octavian Rasnita
ust like in case it would have used %parameters instead of @parameters... it doesn't break. Octavian - Original Message - From: "Shlomi Fish" To: "Octavian Rasnita" Cc: Sent: Sunday, August 07, 2011 3:52 PM Subject: Re: Using an undefined value as a hash ref

Re: Using an undefined value as a hash reference

2011-08-07 Thread Shlomi Fish
Agent->new; > my $res = $ua->get( 'http://www.google.com/', %$fields ); > > This script runs with no errors, although the variable $fields is undefined > and it is used as a hash reference and I don't understand why. > > If I use it in the following line however,

Using an undefined value as a hash reference

2011-08-07 Thread Octavian Rasnita
undefined and it is used as a hash reference and I don't understand why. If I use it in the following line however, it gives the error "Can't use an undefined value as a HASH reference": my %params = %$fields; Does anyone have an explanation why in the first example it work

Re: perl reference

2011-07-31 Thread Rob Dixon
On 31/07/2011 00:55, Rob Dixon wrote: It may be helpful here to read and understand perldoc "What is the difference between a list and an array" That should be perldoc -q "What is the difference between a list and an array" Rob -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org F

Re: perl reference

2011-07-30 Thread Rob Dixon
passing a reference to it. A reference to anything is a scalar. If you're a C programmer you can think of a reference as a pointer (sort of). is that still true? date on website is 2003... I think this thread is getting a little confused. The page you refer to is very out of date, but in any

Re: perl reference

2011-07-30 Thread Emeka
rmalized by context rule. >> >> @voo = ("boon", 12, "man", 88); >> %coo = @voo; >> my $line = ""; >> while(my ($key, $val) = each %coo){ >> $line.="$key => $val\n"; >> } >> print $line; >> >> On Sat, Ju

Re: perl reference

2011-07-30 Thread timothy adigun
othy adigun <2teezp...@gmail.com>wrote: > >> Hi Rajeev, >> with the link you provided, the statement "In Perl, you can pass only one >> kind of argument to a subroutine: a scalar... a pointer (sort of)." was >> made >> Reference sub-topic. So, it

Re: perl reference

2011-07-30 Thread John W. Krahn
reference to it. A reference to anything is a scalar. If you're a C programmer you can think of a reference as a pointer (sort of). is that still true? date on website is 2003... On that web page it says: NOTE: Modern Perl versions (5.003 and newer) enable you to do function protot

Re: perl reference

2011-07-30 Thread Emeka
e > kind of argument to a subroutine: a scalar... a pointer (sort of)." was > made > Reference sub-topic. So, it will not be a total truth that one can pass > "only" one kind of argument to subroutine. > Generally in perl the subroutrine default argument is an array &

Re: perl reference

2011-07-29 Thread shawn wilson
g->{ 'one' } and $thing->{ 'two' } just like you would $ref outside your function. And modifying the reference shows up everywhere. That's it. On Jul 29, 2011 6:58 PM, "Rajeev Prasad" wrote: > Hello, > > from here: http://www.troubleshooters.com/codec

Re: perl reference

2011-07-29 Thread timothy adigun
Hi Rajeev, with the link you provided, the statement "In Perl, you can pass only one kind of argument to a subroutine: a scalar... a pointer (sort of)." was made Reference sub-topic. So, it will not be a total truth that one can pass "only" one kind of argument to subroutin

Re: perl reference

2011-07-29 Thread Jim Gibson
ther kind of argument, you need to convert it to a scalar. You > do that by passing a reference to it. A reference to anything is a > scalar. If you're a C programmer you can think of a reference as a pointer > (sort of). > > is that still true? date on website is 2003...

perl reference

2011-07-29 Thread Rajeev Prasad
Hello, from here: http://www.troubleshooters.com/codecorn/littperl/perlsub.htm i found: In Perl, you can pass only one kind of argument to a subroutine: a scalar. To pass any other kind of argument, you need to convert it to a scalar. You do that by passing a reference to it. A reference to

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-23 Thread Rob Dixon
rnings; use XML::XPath;" Trying to get value for: $ha = $xPath->findnodes('//job'); Error: Can't call method "findnodes" on unblessed reference at line . Output from Data::Dumper follows: $VAR1 = { 'object' => [ {

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Casey West
On Wed, May 18, 2011 at 7:55 PM, Rob Dixon wrote: > I allow myself to be wrong, but I have no wish to draw others along a > wrong line. > I agree with your sentiment. Lets end this thread now, thank you. -- Casey West

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Uri Guttman
> "RD" == Rob Dixon writes: RD> On 18/05/2011 23:33, Uri Guttman wrote: >> "KW" == Kenneth Wolcott writes: >>> Rob Dixon wrote: >>> >>> Please grow up and ask Perl questions. It looks to me as if you are as >>> silly as each other. I certainly wouldn't employ either of you. >>

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Rob Dixon
On 18/05/2011 23:33, Uri Guttman wrote: "KW" == Kenneth Wolcott writes: >> Rob Dixon wrote: Please grow up and ask Perl questions. It looks to me as if you are as silly as each other. I certainly wouldn't employ either of you. I also wonder if you 'Kenneth Wolcott' and your friend are the

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Uri Guttman
> "RD" == Rob Dixon writes: RD> I usually sign 'HTH' and I always hope I have helped. A few people have RD> disagreed with me tonight; and while that leaves me wondering whether I RD> have been right, I also wonder why comments here are either negative or RD> non-existent. RD> I al

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Uri Guttman
d off base. the OP posted the code INCLUDING the Ec use line. rob coops never guessed anything. he may have replied to a different post but he saw the code that the OP posted. look at this: --- From: Kenneth Wolcott Subject: Re: Can't call method "findnodes" on unbl

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Uri Guttman
> "RD" == Rob Dixon writes: RD> If that is the true situation then I am happy to apologize, but even so RD> the question is not a Perl one, as no one can debug what is inaccessible RD> to him. it doesn't MATTER his situation. he asked a perl question. maybe it wasn't worded well. mayb

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Rob Dixon
ings; use XML::XPath;" You don't trust your partner. We have no idea whether or not the programs have strict or warnings in force, or whether XML::XPath is available. Trying to get value for: $ha = $xPath->findnodes('//job'); Error: Can't call method "findnodes

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Rob Dixon
On 18/05/2011 22:58, Jim Gibson wrote: On 5/18/11 Wed May 18, 2011 2:25 PM, "Rob Dixon" scribbled: Holy smokes, Rob. That response is totally inappropriate for a beginners list. I saw nothing wrong with Kenneth's question, except we needed more information to help him. I think you owe Kenneth

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Kenneth Wolcott
Rob, buy a one-way express train ticket to hell. On Wed, May 18, 2011 at 15:53, Rob Dixon wrote: > On 18/05/2011 22:37, Kenneth Wolcott wrote: > >> On Wed, May 18, 2011 at 14:25, Rob Dixon wrote: >> >>> >>> That looks fine, except that all you have printed is a hash of data. It >>> isn't blesse

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Uri Guttman
> "RD" == Rob Dixon writes: RD> You are always welcome to any help that we are able to offer here, RD> but please look first at your character issues before you try to RD> write software. We are quite happy to accept innocent failure, but RD> as long as all we have is lies to work wi

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Rob Dixon
On 18/05/2011 22:37, Kenneth Wolcott wrote: On Wed, May 18, 2011 at 14:25, Rob Dixon wrote: That looks fine, except that all you have printed is a hash of data. It isn't blessed and so it isn't an object. Please grow up and ask Perl questions. It looks to me as if you are as silly as each oth

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Uri Guttman
> "RD" == Rob Dixon writes: RD> OK, so what happened here guys? you went way out of line. RD> Rob, why did you assume to 'use Ec' when it has never been RD> mentioned before on this thread? You also seem to have a lot of RD> insight into the problem before the mess of its declaratio

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Rob Dixon
nce otherwise, your colleague is telling the truth. Trying to get value for: $ha = $xPath->findnodes('//job'); You have shown no code for the derivation of $xPath, or the declaration of $ha. Error: Can't call method "findnodes" on unblessed reference at line . Wh

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Uri Guttman
> "KW" == Kenneth Wolcott writes: >> Please grow up and ask Perl questions. It looks to me as if you are as >> silly as each other. I certainly wouldn't employ either of you. >> >> I also wonder if you 'Kenneth Wolcott' and your friend are the same >> person. Since your name sounds

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Uri Guttman
> "KW" == Kenneth Wolcott writes: KW> my $ec = Ec->new or die "Can not create Ec object $!\n"; KW> my $xPath; KW> $xPath = $ec->findObjects('job'); KW> print Dumper($xPath); well it is pretty obvious from that. the dumper shows NO blessing so the call to findObjects didn't return a

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Uri Guttman
> "RC" == Rob Coops writes: RC> ps, you might want to besides the rules to always use strict and RC> warnings also implement a rule that before opening of a file one RC> always checks if it exists, and can be opened for the purposes you RC> need it for (read only will not do if you wa

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Jim Gibson
On 5/18/11 Wed May 18, 2011 2:25 PM, "Rob Dixon" scribbled: > That looks fine, except that all you have printed is a hash of data. It > isn't blessed and so it isn't an object. > > Please grow up and ask Perl questions. It looks to me as if you are as > silly as each other. I certainly wouldn

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Kenneth Wolcott
> :-) Guess it is getting late in England as well then :-) > > Anyway... > > use strict; > use warnings; > > use Ec; > use XML::XPath; > use Data::Dumper; > > my $ec = Ec->new or die "Can not create Ec object $!\n"; > my $xPath; > $xPath = $ec->findObjects('job'); > print Dumper($xPath); > #my $ha

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Kenneth Wolcott
7;t told him the relevant facts. > > >He claims this: "use strict; use warnings; use XML::XPath;" >> > > Until you have evidence otherwise, your colleague is telling the truth. > > > Trying to get value for: >> $ha = $xPath->findnodes('//job&

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Rob Coops
aven't told him the relevant facts. > > >He claims this: "use strict; use warnings; use XML::XPath;" >> > > Until you have evidence otherwise, your colleague is telling the truth. > > > Trying to get value for: >> $ha = $xPath->findnodes('/

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Rob Dixon
On 18/05/2011 22:21, Kenneth Wolcott wrote: Should he be using the XML::XPath in OO form and instead of direct assignment? There's no file I/O here; perhaps there was an error at the findObjects call? Here is a minimized version of the script which illustrates the problem. use strict; use war

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Rob Dixon
27;//job'); You have shown no code for the derivation of $xPath, or the declaration of $ha. Error: Can't call method "findnodes" on unblessed reference at line . Why are you hiding from us when we have no code? That also makes sense with the rest of your mail, whic

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Kenneth Wolcott
> Hi Kenneth, > > I think the error is clear on what is going wrong: *Error: Can't call > method "findnodes" on unblessed reference at line . > * > * > * > When you colleague calls: $xPath->findnodes('//job'); > > Perl tels him that $xPath

Re: Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Rob Coops
ation on Linux and Windows). > > He claims this: "use strict; use warnings; use XML::XPath;" > > Trying to get value for: > $ha = $xPath->findnodes('//job'); > > Error: > Can't call method "findnodes" on unblessed reference at line >

Can't call method "findnodes" on unblessed reference; not using OO Perl

2011-05-18 Thread Kenneth Wolcott
alue for: $ha = $xPath->findnodes('//job'); Error: Can't call method "findnodes" on unblessed reference at line . Output from Data::Dumper follows: $VAR1 = { 'object' => [ { 'objectId' =&

Re: assigning hash key to reference of array question

2011-02-28 Thread John Delacour
At 22:33 + 28/02/2011, Rob Dixon wrote: The complete program is below. HTH, Rob use strict; use warnings; my %HoA; while ( ) { my ($swit, $server, $ip_range) = split; my ($b_real_ip, $b_ip, $e_ip) = $ip_range =~ /(\d+\.\d+\.\d+\.)(\d+)-\1(\d+)/; for my $byte ($b_ip .. $e_ip)

Re: assigning hash key to reference of array question

2011-02-28 Thread charley
On Feb 28, 2:47 pm, rich.j...@gmail.com (steve park) wrote: > I have a below program and I am not doing it right. > Currently, only last ip pool is going in since I am putting them w/ key to > values(so only last one shows up when I print). Hello Steve, The reason you only get the last value for

Re: assigning hash key to reference of array question

2011-02-28 Thread Rob Dixon
On 28/02/2011 19:56, steve park wrote: > > I have a below program and I am not doing it right. Currently, only > last ip pool is going in since I am putting them w/ key to values(so > only last one shows up when I print). > > How can I aggregate and assign them to server_1 so that when I print > be

Re: assigning hash key to reference of array question

2011-02-28 Thread Jim Gibson
On 2/28/11 Mon Feb 28, 2011 11:47 AM, "steve park" scribbled: > I have a below program and I am not doing it right. > Currently, only last ip pool is going in since I am putting them w/ key to > values(so only last one shows up when I print). > > How can I aggregate and assign them to server_1

Re: assigning hash key to reference of array question

2011-02-28 Thread Shrivats
On Mon, Feb 28, 2011 at 02:47:30PM -0500, steve park wrote: Hello, A couple of things in addition to what Shlomi had already mentioned. First, you must check your regex. It doesn't really match what you have mentioned in the __DATA__ section. Next, doing join('', ...) is just a verbose way of u

Re: assigning hash key to reference of array question

2011-02-28 Thread Shlomi Fish
calised a variable to its innermost scope? > > How can I aggregate and assign them to server_1 so that when I print below > will show up? > > server_1 > 10.1.1.1 > 10.1.1.2 > 10.1.1.3 > 10.1.1.4 > 10.1.1.5 > 192.168.1.1 > 192.168.1.2 Use a hash or an array

Re: assigning hash key to reference of array question

2011-02-28 Thread steve park
I am not sure if I am still in mailing list. so cc'ing myself. On Mon, Feb 28, 2011 at 2:47 PM, steve park wrote: > > I have a below program and I am not doing it right. > Currently, only last ip pool is going in since I am putting them w/ key to > values(so only last one shows up when I print).

assigning hash key to reference of array question

2011-02-28 Thread steve park
I have a below program and I am not doing it right. Currently, only last ip pool is going in since I am putting them w/ key to values(so only last one shows up when I print). How can I aggregate and assign them to server_1 so that when I print below will show up? server_1 10.1.1.1 10.1.1.2 10.1.1

Re: reference noob

2011-02-03 Thread Uri Guttman
> "PK" == Parag Kalra writes: PK> print "$field\n" what would that supposedly do to help with the question? and please bottom post. this is a good example. your one line of code should be BELOW the code it replaces or purports to fix. thanx, uri -- Uri Guttman -- u...@stemsyst

Re: reference noob

2011-02-03 Thread Jim Gibson
On 2/3/11 Thu Feb 3, 2011 5:05 AM, "Téssio Fechine" scribbled: > The program: > -- > #use strict; > use warnings; > > my $field = shift @ARGV; > my $regex = '(\w+)\s*' x $field; > > while () { > if (/$regex/) { > print "$$field\n"; # refers to a match variable > } > } > -- > > Example Usage:

Re: reference noob

2011-02-03 Thread Parag Kalra
print "$field\n" ~Parag 2011/2/3 Téssio Fechine > The program: > -- > #use strict; > use warnings; > > my $field = shift @ARGV; > my $regex = '(\w+)\s*' x $field; > > while () { >if (/$regex/) { >print "$$field\n"; # refers to a match variable >} > } > --

Re: reference noob

2011-02-03 Thread Uri Guttman
> "TF" == Téssio Fechine writes: TF> The program: TF> -- TF> #use strict; TF> use warnings; TF> my $field = shift @ARGV; TF> my $regex = '(\w+)\s*' x $field; TF> while () { TF> if (/$regex/) { TF> print "$$field\n"; # refers to a match variable TF> }

Re: reference noob

2011-02-03 Thread Shawn H Corey
On 11-02-03 08:05 AM, Téssio Fechine wrote: The program: -- #use strict; use warnings; my $field = shift @ARGV; my $regex = '(\w+)\s*' x $field; while () { if (/$regex/) { print "$$field\n";# refers to a match variable } } -- Example Usage: -- $ echo 'Strang

reference noob

2011-02-03 Thread Téssio Fechine
The program: -- #use strict; use warnings; my $field = shift @ARGV; my $regex = '(\w+)\s*' x $field; while () { if (/$regex/) { print "$$field\n"; # refers to a match variable } } -- Example Usage: -- $ echo 'Strange New World!' | ./this_program 3 $ World --

Re: reference of an array into an array

2010-11-04 Thread Christian
the final loop values. > One solution: declare @mytemp within -- rather than outside -- > the loop. This allocates new memory for @mytemp during > each loop iteration to prevent overwriting. > > while(<$myfile>) >{ >($a, $b $c ) = getparameter(); >my @mytemp = (

Re: reference of an array into an array

2010-11-04 Thread Dr.Ruud
On 2010-11-04 10:16, Christian Stalp wrote: Hello together, I try to write some arrays into arrays using references. my ($a, $b, $c, @mytemp, $myref, @my_globael_array) while(<$myfile>) { ($a, $b $c ) = getparameter(); @mytemp = ($a, $b, $c); $myref = \...@mytemp; push(@my_glob

Re: reference of an array into an array

2010-11-04 Thread C.DeRykus
On Nov 4, 2:16 am, christian1...@gmx.net ("Christian Stalp") wrote: > Hello together, > I try to write some arrays into arrays using references. > > my ($a, $b, $c, @mytemp, $myref, @my_globael_array) > > while(<$myfile>) > { >    ($a, $b $c ) = getparameter(); >   �...@mytemp = ($a, $b, $c); >    

Re: reference of an array into an array

2010-11-04 Thread Robert Wohlfarth
On Thu, Nov 4, 2010 at 4:16 AM, Christian Stalp wrote: > Hello together, > I try to write some arrays into arrays using references. > > my ($a, $b, $c, @mytemp, $myref, @my_globael_array) > > while(<$myfile>) > { > ($a, $b $c ) = getparameter(); > @mytemp = ($a, $b, $c); > $myref = \...@myte

Re: reference of an array into an array

2010-11-04 Thread Shlomi Fish
Hi Christian. On Thursday 04 November 2010 11:16:46 Christian Stalp wrote: > Hello together, > I try to write some arrays into arrays using references. > > my ($a, $b, $c, @mytemp, $myref, @my_globael_array) Your code won't compile - you've mis-spelt "global" and you're missing a trailing semic

reference of an array into an array

2010-11-04 Thread Christian Stalp
Hello together, I try to write some arrays into arrays using references. my ($a, $b, $c, @mytemp, $myref, @my_globael_array) while(<$myfile>) { ($a, $b $c ) = getparameter(); @mytemp = ($a, $b, $c); $myref = \...@mytemp; push(@my_global_array, $myref); } But if I dismantle @my_globa

Re: anonymous hash reference

2010-10-31 Thread Thorsten Scherf
bject: Re: anonymous hash reference >>>>> "JP" == Jeff Pang writes: JP> print check_for_exists('name','foo'); JP> sub check_for_exists { JP>my $key = shift; JP>my $value = shift; JP> for my $item (@$foo)

Re: anonymous hash reference

2010-10-31 Thread Uri Guttman
> "JP" == Jeff Pang writes: JP> print check_for_exists('name','foo'); JP> sub check_for_exists { JP>my $key = shift; JP>my $value = shift; JP> for my $item (@$foo) { JP> if ($item->{$key} eq $value ) { JP>return 1; JP> } JP> }

Re: anonymous hash reference

2010-10-31 Thread Jeff Pang
于 2010-10-31 21:43, Thorsten Scherf 写道: Hi, I have an array with anonymous hash references like the following: $foo = [ { name = value, id = value, }, { name = value, id = value, } ]; Iterating through the hash references works with: foreach $item (@$foo) { do something with $item->name; }

  1   2   3   4   5   6   7   >