RE: pointers - references ??

2005-04-11 Thread Ankur Gupta
> If anyone has the time and / or the will to help me understand. > > I know how to create / use references for perl. But would why would you > use it. > And I think more importantly when. > > Im busy reading / learning the Oreilly Advanced Perl Programming book. > B

pointers - references ??

2005-04-11 Thread Brent Clark
Hi all If anyone has the time and / or the will to help me understand. I know how to create / use references for perl. But would why would you use it. And I think more importantly when. Im busy reading / learning the Oreilly Advanced Perl Programming book. But for the likes of me I cant undertand

Re: Circular References, Self Referenced memory ang Garbage Collection

2005-01-04 Thread Randy W. Sims
Marcos Rebelo wrote: Some time ago I read one article about this Consider that you have: { # make $a point to itself my $a; $a = \$a; } Or { # make $a and $b point to each other my ($a, $b); $a = \$b; $b = \$a; } This memory will be free just at the

Circular References, Self Referenced memory ang Garbage Collection

2005-01-04 Thread Marcos Rebelo
Some time ago I read one article about this Consider that you have: { # make $a point to itself my $a; $a = \$a; } Or { # make $a and $b point to each other my ($a, $b); $a = \$b; $b = \$a; } This memory will be free just at the end of the proce

RE: array of references

2004-10-26 Thread Bob Showalter
Scott Pham wrote: > I've been thinking about this and not sure how to approach this > problem. Say I want to create an array of 4 array references, thats > easy since I know that there will be 4 array references, how would I > do this dynamically? Say if one I only needed

Re: array of references

2004-10-25 Thread Zeus Odin
push @array, [] while @array < 10; also works. "Ed Christian" <[EMAIL PROTECTED]> wrote... push (@array,[]) for (1..$num_child_arrays); For more info: perldoc -f push -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: array of references

2004-10-25 Thread Ed Christian
Scott Pham wrote: > I've been thinking about this and not sure how to approach this > problem. Say I want to create an array of 4 array references, thats > easy since I know that there will be 4 array references, how would I > do this dynamically? Say if one I only needed

array of references

2004-10-25 Thread Scott Pham
I've been thinking about this and not sure how to approach this problem. Say I want to create an array of 4 array references, thats easy since I know that there will be 4 array references, how would I do this dynamically? Say if one I only needed 2 references and another I need 10 array refer

Re: Variable name substitution (probably a question on references)

2004-10-10 Thread Gunnar Hjalmarsson
Peter Rabbitson wrote: Since you 1) are not very convincing in explaining why it would be necessary to use soft references, and 2) argue against enabling strictures, and with that make Perl help you get your code right, you'll find that few people here are inclined to help you. (You can a

Re: Variable name substitution (probably a question on references)

2004-10-10 Thread Peter Rabbitson
> Since you > > 1) are not very convincing in explaining why it would be necessary to > use soft references, and > > 2) argue against enabling strictures, and with that make Perl help you > get your code right, > > you'll find that few people here are inclined t

Re: Variable name substitution (probably a question on references)

2004-10-10 Thread Peter Rabbitson
> It would still IMHO be much better to do something like: > > %cards = ( > 4 => {name => 'Visa'}, > 5 => {name => 'MasterCard'}, > 6 => {name => 'Discover'}, > 3 => {name => 'AmEx'}, > ); > > foreach my $cardid (keys %cards) { > foreach my $property (@props) { > $

Re: Variable name substitution (probably a question on references)

2004-10-10 Thread Jenda Krynicky
); foreach my $cardid (keys %cards) { foreach my $property (@props) { $data{$cardid}{$property} = $form->param($cardid."_".$property); } } This way you have just one variable holding all the data, not several separate variables. So you can pass the whole data between func

Re: Variable name substitution (probably a question on references)

2004-10-10 Thread Gunnar Hjalmarsson
ll the elegance that coding in perl calls for. Since you 1) are not very convincing in explaining why it would be necessary to use soft references, and 2) argue against enabling strictures, and with that make Perl help you get your code right, you'll find that few people here are inclined to help

Re: Variable name substitution (probably a question on references)

2004-10-10 Thread Peter Rabbitson
s I am missing something > > really really minor... > > There are two things you are missing. > 1) What does $$var{key} mean? Is it the same as ${$var}{key} or > ${$var{key}}? That is should I first dereference and then look for a > key or the other way around? To tell the

Re: References to anon array

2004-10-05 Thread John W. Krahn
Adam wrote: I am expecting in both examples the same result: Example1: the same references Example2: the same references However, I get: Example1: different references Example2: the same references What am I missing? #Example1 my $r1 = [1, 3]; Store a reference to an anonymous array in a scalar

References to anon array

2004-10-05 Thread Adam
I am expecting in both examples the same result: Example1: the same references Example2: the same references However, I get: Example1: different references Example2: the same references What am I missing? thanks adam Here is the code: #Example1 my $r1 = [1, 3]; my $r2 = [1, 3]; if ($r1 eq $r2

RE: symbolic references in perl module help

2004-07-16 Thread Charles K. Clarkson
having the Hash of symbolic : references in the main namespace so it works. You are not using a hash of symbolic references in A.pm. You are using a reference to a hash of code references. : I just need to know if PERL Perl or perl -- never PERL! : allows symbolic reference variab

Re: symbolic references in perl module help

2004-07-16 Thread James Edward Gray II
ter but I kept getting subruotine undefined...at times in the main:: and in the perl modules... I went around this by having the Hash of symbolic references in the main namespace so it works...I just need to know if PERL allows symbolic reference variables or hashs with symbolic references to

Re: symbolic references in perl module help

2004-07-16 Thread Gunnar Hjalmarsson
es => \&foo2, open => \&foo3 }; sub foo1 { print "apples\n" } sub foo2 { print "oranges\n" } sub foo3 { my ($item) = @_; print $item."\n" } 1; ## End Module MAIN : !#/bin/perl lib "$ENV/"; use MOD::A; $MOD::A::b{foo1}->(); $MOD::A::b{foo2}

symbolic references in perl module help

2004-07-16 Thread Luis Pachas
.at times in the main:: and in the perl modules... I went around this by having the Hash of symbolic references in the main namespace so it works...I just need to know if PERL allows symbolic reference variables or hashs with symbolic references to be access in

RE: references and freeing memory

2004-06-04 Thread Wiggins d Anconia
> >> The perlref docs state "Hard references are smart--they keep track of > >> reference counts for you, automatically freeing the thing referred to > >> when its reference count goes to zero." My interpretation of this is > >> that when a reference

RE: references and freeing memory

2004-06-04 Thread Freimuth,Robert
>> The perlref docs state "Hard references are smart--they keep track of >> reference counts for you, automatically freeing the thing referred to >> when its reference count goes to zero." My interpretation of this is >> that when a reference goes out of scope t

RE: references and freeing memory

2004-06-04 Thread Tim Johnson
Yes and no. From what I understand (and someone please correct me if I'm wrong), the memory is freed in the sense that it is returned to Perl, but it is not returned to your system. Once there are no references to a variable, the memory can be overwritten by future variables used in

references and freeing memory

2004-06-04 Thread Freimuth,Robert
Hi all, The perlref docs state "Hard references are smart--they keep track of reference counts for you, automatically freeing the thing referred to when its reference count goes to zero." My interpretation of this is that when a reference goes out of scope the memory used by the r

Re: Symbolic references

2004-05-12 Thread Rob Dixon
quot; etc., but the dereferencing never works. An > empty string is printed. The string "1_antwort_1" as the name of an input > field is generated correctly, of course. $antwort doesn't need to be a global variable, but $antwort_text_1 .. 5 do, as symbolic references don't

RE: shift, push, hash references, array references

2004-04-30 Thread Charles K. Clarkson
efore:\n", Dumper( [EMAIL PROTECTED] ), "\n"; push @fields, ( '' ) x ( 4 - @fields ); print "After:\n", Dumper( [EMAIL PROTECTED] ), "\n\n" } __END__ Now go back and change 4 to some other value. Try 10. See what it is doing? [snipped

shift, push, hash references, array references

2004-04-30 Thread William Martell
Hello All. I have a question about this procedure. I am trying to extract these 12 values of text from a text file. I am trying to get my first two hash values and this is the procedure that handles that. Thanks Charles for all your help and mentoring. I appreciate your time and consideration.

Re: cleaning up references properly

2004-04-13 Thread JupiterHost.Net
plish that by passing references to those things to a kill function: killanything(\$foo,[EMAIL PROTECTED],\%bah,\*FH); of course if one was wise enough to figure you'd need to undef somethign right then, they might as well just undef $whatever; or close or whatever they need, instead (I be

Re: cleaning up references properly

2004-04-13 Thread david
Wiggins D Anconia wrote: >> Jupiterhost.Net wrote: >> >> > >> >> Ok, well you think that might have helped to state in the first place, >> >> especially when posting to a beginners list? >> > >> > Sorry I didn't mean to offend anyone, I felt it was irrelevant to the >> > question. (IE - How do I

Re: cleaning up references properly

2004-04-13 Thread david
Jupiterhost.Net wrote: > > #!/usr/bin/perl > > use strict; > use warnings; > > my $howdy = 'hello'; > push(@ref_to_destroy, \$howdy); > for(@refs_to_destroy) { >my $r = ref($_); > if(defined $r) { >close $_ if $r eq 'IO'; >undef $_ if $r eq 'SCALAR'; > } > } > print

Re: cleaning up references properly

2004-04-13 Thread Wiggins d Anconia
> Jupiterhost.Net wrote: > > > > >> Ok, well you think that might have helped to state in the first place, > >> especially when posting to a beginners list? > > > > Sorry I didn't mean to offend anyone, I felt it was irrelevant to the > > question. (IE - How do I vacuum my car instead of How woul

Re: cleaning up references properly

2004-04-13 Thread JupiterHost.Net
david wrote: Jupiterhost.Net wrote: Ok, well you think that might have helped to state in the first place, especially when posting to a beginners list? Sorry I didn't mean to offend anyone, I felt it was irrelevant to the question. (IE - How do I vacuum my car instead of How would I vacuum a blu

Re: cleaning up references properly

2004-04-13 Thread david
Jupiterhost.Net wrote: > >> Ok, well you think that might have helped to state in the first place, >> especially when posting to a beginners list? > > Sorry I didn't mean to offend anyone, I felt it was irrelevant to the > question. (IE - How do I vacuum my car instead of How would I vacuum a > b

Re: cleaning up references properly

2004-04-13 Thread JupiterHost.Net
Very cool! Ok, well you think that might have helped to state in the first place, especially when posting to a beginners list? Sorry I didn't mean to offend anyone, I felt it was irrelevant to the question. (IE - How do I vacuum my car instead of How would I vacuum a blue car?) I simply was t

Re: cleaning up references properly

2004-04-12 Thread Wiggins d'Anconia
JupiterHost.Net wrote: Wiggins d Anconia wrote: Still not convinced you need any such idiom... I'm not either, but they are not, believe it or not, "multiple executions of a non-persistent script" they are multiple executions of a persistent script that remains persistent between executi

Re: cleaning up references properly

2004-04-12 Thread JupiterHost.Net
Wiggins d Anconia wrote: Still not convinced you need any such idiom... I'm not either, but they are not, believe it or not, "multiple executions of a non-persistent script" they are multiple executions of a persistent script that remains persistent between executions. Its hard to image b

Re: cleaning up references properly

2004-04-12 Thread Wiggins d Anconia
> > Still not convinced you need any such idiom... > > > > I'm not either, but they are not, believe it or not, "multiple > executions of a non-persistent script" they are multiple executions > of a persistent script that remains persistent between executions. > > Its hard to image but tak

Re: cleaning up references properly

2004-04-12 Thread JupiterHost.Net
Still not convinced you need any such idiom... I'm not either, but they are not, believe it or not, "multiple executions of a non-persistent script" they are multiple executions of a persistent script that remains persistent between executions. Its hard to image but take a look at this (and

Re: cleaning up references properly

2004-04-12 Thread Wiggins d Anconia
> > > Wiggins d Anconia wrote: > > >>Hello, > >> > >>I have an array that contains one reference per item. > >>I need to clean up the things referenced by those references > >>So.. > >>1) Am I doing this correctly? > >

Re: cleaning up references properly

2004-04-12 Thread JupiterHost.Net
Wiggins d Anconia wrote: Hello, I have an array that contains one reference per item. I need to clean up the things referenced by those references So.. 1) Am I doing this correctly? 2) am I doing the CODE,IO correct 3) any other refs I'm overlooking? for(@references_to_kill) { undef ${$

Re: cleaning up references properly

2004-04-12 Thread Wiggins d Anconia
> Hello, > > I have an array that contains one reference per item. > I need to clean up the things referenced by those references > So.. > 1) Am I doing this correctly? > 2) am I doing the CODE,IO correct > 3) any other refs I'm overlooking? > > for(@reference

cleaning up references properly

2004-04-12 Thread JupiterHost.Net
Hello, I have an array that contains one reference per item. I need to clean up the things referenced by those references So.. 1) Am I doing this correctly? 2) am I doing the CODE,IO correct 3) any other refs I'm overlooking? for(@references_to_kill) { undef ${$_} if ref($_) eq &#

Re: references

2004-03-25 Thread Joe Mecklin
> > sub's output to a web page. this works fine as is but i want to learn > > how to restructure this so i don't have to use "no strict" and "use > > strict" around the call. all suggestions welcome *s* > > > > One way, I won't guar

Re: references

2004-03-24 Thread Wiggins d Anconia
n't have to use "no strict" and "use > strict" around the call. all suggestions welcome *s* > One way, I won't guarantee the best, would be to store a mapping of subroutine references into a hash, where the hash key replaces the subroutine name, then you would i

RE: references

2004-03-24 Thread Guay Jean-Sébastien
Hello Joe, > i have the following code: > > $sth = $mysql_dbh->prepare("select subroutine_pointer from > $database.equipment_manufacturer where > manufacturer=\"$remedy_eqpt_mfgr\""); > $sth->execute(); > $subroutine_pointer = $sth->fetchrow_array(); > no strict "refs"; >

references

2004-03-24 Thread Joe Mecklin
i know this should be a simple step or two that i'm missing, and i haven't been able to figure it out from reading yet... i have the following code: $sth = $mysql_dbh->prepare("select subroutine_pointer from $database.equipment_manufacturer where manufacturer=\"$remedy_eqpt_mfgr\"");

Re: Passing array references around

2004-03-16 Thread Robin Sheat
On Tue, Mar 16, 2004 at 08:36:39PM -0500, Wiggins d'Anconia wrote: > Because you are passing in references you want to catch them into > scalars, then to update the values of the references you dereference > them in your push, so... > my ($potUp, $potDn) = @_; Had tried this..

Re: Passing array references around

2004-03-16 Thread Wiggins d'Anconia
Robin Sheat wrote: Hey, I have a problem that I know is possible, because I have solved it before. However, the computer died and I lost my solution, and can't work it out again :) What I want to do is pass a couple of array references into a function and have it modify the contents o

Passing array references around

2004-03-16 Thread Robin Sheat
Hey, I have a problem that I know is possible, because I have solved it before. However, the computer died and I lost my solution, and can't work it out again :) What I want to do is pass a couple of array references into a function and have it modify the contents of the reference. What I

RE: iterating through hash of hash references

2004-03-03 Thread Charles K. Clarkson
Andrew Gaffney <[EMAIL PROTECTED]> wrote: : : It looks like not all of the fields have something in : them. Perl is taking blanks for undefined for some : reason. : : > :$tabledesc = {}; : > :$sth = $dbh->prepare("DESCRIBE $_"); : > :$sth->execute; : > :while($ref = $sth->fetchrow

RE: iterating through hash of hash references

2004-03-03 Thread Guay Jean-Sébastien
Hello, > It looks like not all of the fields have something in them. Perl is taking blanks for > undefined for some reason. An empty field in a database is not a "blank", as you say, but a NULL. Meaning it's not just blank, but effectively inexistant - there is no value, not even the empty strin

Re: iterating through hash of hash references

2004-03-03 Thread Andrew Gaffney
Charles K. Clarkson wrote: Andrew Gaffney <[EMAIL PROTECTED]> wrote: : Now I've got another issue. : How can I dynamically assign new keys to a hash without : getting warnings when using 'use warnings'? I get the warning : about an undefined value on the line with the '->'. You can either te

RE: iterating through hash of hash references

2004-03-03 Thread NYIMI Jose (BMB)
%$tabledesc->{$_} is confused ... Try writing it like : %{ $tabledesc->{$_} } HTH, José. -Original Message- From: Andrew Gaffney [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 03, 2004 2:50 PM To: beginners Subject: iterating through hash of hash references I have a script

RE: iterating through hash of hash references

2004-03-03 Thread Charles K. Clarkson
Andrew Gaffney <[EMAIL PROTECTED]> wrote: : Now I've got another issue. : How can I dynamically assign new keys to a hash without : getting warnings when using 'use warnings'? I get the warning : about an undefined value on the line with the '->'. You can either temporarily turn those warni

Re: iterating through hash of hash references

2004-03-03 Thread Andrew Gaffney
Charles K. Clarkson wrote: Andrew Gaffney <[EMAIL PROTECTED]> wrtoe: :foreach (keys %$tabledesc) { : foreach (keys %$tabledesc->{$_}) { Shouldn't that be: foreach ( keys %{ $tabledesc->{$_} } ) { :print "$_ = $tabledesc->{$_}, "; : } : print "\n"; :} BTW, i

RE: iterating through hash of hash references

2004-03-03 Thread Charles K. Clarkson
Andrew Gaffney <[EMAIL PROTECTED]> wrtoe: :foreach (keys %$tabledesc) { : foreach (keys %$tabledesc->{$_}) { Shouldn't that be: foreach ( keys %{ $tabledesc->{$_} } ) { :print "$_ = $tabledesc->{$_}, "; : } : print "\n"; :} BTW, it's confusing to use ne

iterating through hash of hash references

2004-03-03 Thread Andrew Gaffney
I have a script which creates a hash where all the values are hash references. I'm trying to iterate through the original hash and down into the anonymous hashes to make sure my code is doing what I think it's doing. My problem comes in at those nested foreach loops before the DB dis

Re: symbolic references

2004-02-05 Thread david
David Byrne wrote: > Okay, sorry to be somewhat unclear with my question. > HereÂs some sample input data that may help to clear > things up: > > ### > node_id = 0 > parent_node_id = N/A > child_node_ids = 1, 2 > > node_id = 1 > parent_node_id = 0 > child_node_ids = 3, 4 > >

Re: symbolic references

2004-02-04 Thread James Edward Gray II
On Feb 4, 2004, at 4:19 PM, David Byrne wrote: Okay, sorry to be somewhat unclear with my question. Here’s some sample input data that may help to clear things up: See if this gets you going. It's one possible answer. James #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $tree

Re: symbolic references

2004-02-04 Thread David Byrne
either. > My processor > usage spikes through the roof, but it doesn't seem > to get anywhere. > Does this run for you? > > > Perhaps you could suggest a better solution. > > Perhaps. I know you're building some sort of hash > tree, but I have no >

Re: symbolic references

2004-02-04 Thread James Edward Gray II
hrough the roof, but it doesn't seem to get anywhere. Does this run for you? Perhaps you could suggest a better solution. Perhaps. I know you're building some sort of hash tree, but I have no idea why. Can you tell us what you're aiming for? Currently I'm trying to use sy

symbolic references

2004-02-04 Thread David Byrne
Greetings, I’m trying to generate a tree of nested hashes [of an arbitrary size]. Perhaps you could suggest a better solution. Currently I'm trying to use symbolic references according to the literature… but without much luck. Best regards, David My script is as follows (for now, I’ve tri

Re: symbolic references and hashes

2004-01-07 Thread Gary Stainburn
Hi Rob, On Wednesday 07 January 2004 1:48 pm, Rob Dixon wrote: > "Gary Stainburn" <[EMAIL PROTECTED]> wrote in message [snip] > You're trying to dereference $_BLOCKS as a hash reference. Use > > return sort keys %{"_$key"}; > > and it should work. But note that it won't return the keys from > th

Re: symbolic references and hashes

2004-01-07 Thread Rob Dixon
list { > my $self=shift; > my $key=uc(shift); > print "using '_$key' as hash name\n"; > return sort keys %${"_$key"}; > } > > which according to the section of symbolic references in perldoc perlrefs > should work. However, while Trainset-&

symbolic references and hashes

2004-01-07 Thread Gary Stainburn
st of signalboxes sort keys %_BOXS; } I wanted to eliminate the duplicated code so I wrote: sub list { my $self=shift; my $key=uc(shift); print "using '_$key' as hash name\n"; return sort keys %${"_$key"}; } which according to the section of symbolic referenc

Re: Pointers and References

2003-11-30 Thread drieux
ode, put it in the Debugger, See what Happens. So the 'slick trick' is that we pass not the 'thing in itself' but the Reference to the Thing, and we return the references. my ($fat_list, $thin_list) = sort_lists([EMAIL PROTECTED], [EMAIL PROTECTED]); The problem of course is that

Re: Pointers and References

2003-11-30 Thread R. Joseph Newton
imes when speaking of references, though. > How are they different? You really have three things here: The C/C++ pointer, the C++ reference, and the Perl reference. > If > I read a book on C++ pointers and references, will it say the exact > same things as a book on Perl refere

Pointers and References

2003-11-30 Thread Jason Dusek
Hi Kids, What is a pointer and what is a reference? How are they different? If I read a book on C++ pointers and references, will it say the exact same things as a book on Perl references? - Jason When Banzan was walking through the Union Square greenmarket he overheard a conversation

Re: references and objects

2003-11-16 Thread R. Joseph Newton
Perl is to return a hash as the container for all instance data. Until you have sufficient mastery of the language to know why you are diverging from the standard, you should not do so. I would advise aginst doing any kind of object-oriented work until you feel very comfortable with references.

Re: references and objects

2003-11-16 Thread Steve Grazzini
On Sun, Nov 16, 2003 at 11:42:48AM -0500, Hacksaw wrote: >> Pettiness says that you mean the package is a /class/ :) > > That's pedantism. ;-) It's "pedantry". :-) -- Steve -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: references and objects

2003-11-16 Thread Hacksaw
>Pettiness says that you mean the package is a /class/ :) That's pedantism. ;-) BTW, mail to [EMAIL PROTECTED] bounced. -- Establish the principle. http://www.hacksaw.org -- http://www.privatecircus.com -- KB1FVD -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [

Re: references and objects

2003-11-16 Thread Rob Dixon
Angie Ahl wrote: > > Sorry I forgot to mention that the package IS an object ;) Pettiness says that you mean the package is a /class/ :) Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: references and objects [Solved]

2003-11-15 Thread drieux
On Friday, Nov 14, 2003, at 07:19 US/Pacific, angie ahl wrote: [..] I changed my code so the variables aren't references; sub EventList { my ($class, %arg) = @_; # load of code here return ([EMAIL PROTECTED], $startdate, $enddate); } And then called it like so: my @tempres = $

Re: references and objects

2003-11-14 Thread Jeff 'japhy' Pinyan
On Nov 14, angie ahl said: >I want to return an array and 2 scalars. Well, you're returning an array reference and two scalar references. I don't think the scalars need to be referenced, but I would probably keep the array reference. >sub EventList { >my ($class, %arg) =

Re: references and objects

2003-11-14 Thread Steve Grazzini
You're actually returning references to the array and scalars, which might not be what you wanted. > but I don't seem to be able to access it. I've tried all sorts: > > my $event = Event->new; > my @tempres = $event->EventList(skip=>0, max=>10); > m

Re: references and objects [Solved]

2003-11-14 Thread angie ahl
I changed my code so the variables aren't references; sub EventList { my ($class, %arg) = @_; # load of code here return ([EMAIL PROTECTED], $startdate, $enddate); } And then called it like so: my @tempres = $event->EventList(skip=>0, max=>10); my $EventLis

Re: references and objects

2003-11-14 Thread angie ahl
Sorry I forgot to mention that the package IS an object ;) on 14/11/03 angie ahl said: >Hi everyone > >I'm failing to find something in the manuals (or at least the bit I'm >missing ;) > >I have an package called "Event" > >in it I have a subroutine called EventList > >I want to return an array a

Re: Classes, hashes, objects and references

2003-11-11 Thread Jenda Krynicky
From: Rob Richardson <[EMAIL PROTECTED]> > The line of code that is supposed to add the new User object to the > 'users' hash of the UserList object is: > > $self->{'users'}->{$loginName} = $user; #<== This is line 47 > > The error message is: > "Can't use string ("interrobang") as a HASH ref wh

Re: Classes, hashes, objects and references

2003-11-11 Thread drieux
On Tuesday, Nov 11, 2003, at 10:23 US/Pacific, Rob Richardson wrote: [..] The error message is: "Can't use string ("interrobang") as a HASH ref while "strict refs" in use at UserList.pm line 47, line 1." "Interrobang" is the login name of the only user in the data file I am testing this script aga

Re: Classes, hashes, objects and references

2003-11-11 Thread Jeff 'japhy' Pinyan
On Nov 11, Rob Richardson said: >$self->{'users'}->{$loginName} = $user; #<== This is line 47 > >"Can't use string ("interrobang") as a HASH ref while "strict refs" in >use at UserList.pm line 47, line 1." >"Interrobang" is the login name of the only user in the data file I am >testing this scr

Classes, hashes, objects and references

2003-11-11 Thread Rob Richardson
ut I don't understand why it works and this doesn't. While I understand the concept behind references, the mechanics of referencing and dereferencing in Perl are still a mystery to me. Could someone explain why Perl thinks my string is a hash reference instead of a key? The complete script

RE: FQN from references

2003-10-28 Thread Gupta, Sharad
it somehow, why to make it mandatory in the interface. -Sharad > -Original Message- > From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 22, 2003 8:53 PM > To: Gupta, Sharad > Cc: [EMAIL PROTECTED] > Subject: Re: FQN from references &

Re: FQN from references

2003-10-22 Thread Wiggins d'Anconia
Gupta, Sharad wrote: H!!. I am spinning ;) I'll look at B. The problem was i wanted to know the name of the coderef to generate an error message. Ahh... again depending on your use you may want to have a look at: perldoc -f caller If you haven't, it is very affective for creating traces

Re: FQN from references

2003-10-22 Thread Wiggins d'Anconia
sday, October 22, 2003 6:23 PM To: Gupta, Sharad Cc: [EMAIL PROTECTED] Subject: Re: FQN from references Gupta, Sharad wrote: Hi All, How do i know the full name of a variable from its reference??. Say i have a routine defined like this: package Bar; sub foo {}; And then i say: my $x = \&foo;

RE: FQN from references

2003-10-22 Thread Gupta, Sharad
ns d'Anconia > Cc: Gupta, Sharad; [EMAIL PROTECTED] > Subject: Re: FQN from references > > > On Wed, Oct 22, 2003 at 08:22:47PM -0500, Wiggins d'Anconia wrote: > > Gupta, Sharad wrote: > >> Now from this coderef ($x) i want to know its fully qualified name &

RE: FQN from references

2003-10-22 Thread Gupta, Sharad
6:23 PM > To: Gupta, Sharad > Cc: [EMAIL PROTECTED] > Subject: Re: FQN from references > > > Gupta, Sharad wrote: > > Hi All, > > > > How do i know the full name of a variable from its reference??. > > > > Say i have a routine defined like this: >

Re: FQN from references

2003-10-22 Thread Steve Grazzini
On Wed, Oct 22, 2003 at 08:22:47PM -0500, Wiggins d'Anconia wrote: > Gupta, Sharad wrote: >> Now from this coderef ($x) i want to know its fully qualified name >> which would be somthing like Bar::Foo. Is there a way to do that.??. > > Where do you want to know it? Presumably if you have set it th

Re: FQN from references

2003-10-22 Thread Wiggins d'Anconia
Gupta, Sharad wrote: Hi All, How do i know the full name of a variable from its reference??. Say i have a routine defined like this: package Bar; sub foo {}; And then i say: my $x = \&foo; Now from this coderef ($x) i want to know its fully qualified name which would be somthing like Bar::Foo.

FQN from references

2003-10-22 Thread Gupta, Sharad
Hi All, How do i know the full name of a variable from its reference??. Say i have a routine defined like this: package Bar; sub foo {}; And then i say: my $x = \&foo; Now from this coderef ($x) i want to know its fully qualified name which would be somthing like Bar::Foo. Is there a way to

Re: Beginning beginner needing references help

2003-10-21 Thread Rob Dixon
ghout the rest of the file, > > both within and outside subroutines. You're simply accessing > > the common '@states' variable in 'displayLoginScreen'. > > '@states' and '$states' are totally unrealted: they just > > happen to have

Re: Beginning beginner needing references help

2003-10-21 Thread Jonathan Mangin
- Original Message - From: "Rob Dixon" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, October 21, 2003 4:31 AM Subject: Re: Beginning beginner needing references help > Jonathan Mangin wrote: > > > > Jeez, this is a beginner's list?

Re: Beginning beginner needing references help

2003-10-21 Thread Rob Dixon
le which is as good a set of layout rules as any. > Please repost with more context, particularly showing the > declarations of te variables used. The problem seems to be a misunderstanding of both references and declarations. Feedback from Jonathan will hopefully tell us! Cheers, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Beginning beginner needing references help

2003-10-21 Thread R. Joseph Newton
Jonathan Mangin wrote: > Jeez, this is a beginner's list? Y'all are defining my ignorance of this here purrl > stuff. > I hope someone with patience can help me out. In a simple login/registration program > using 5.6.1... > > #!/usr/bin/perl -wT > use strict; Something is screwy here ... > [CGI

Re: Beginning beginner needing references help

2003-10-21 Thread Rob Dixon
syntax '@$states' is an attempt to dereference the value in the '$states' scalar as an array. This will fail unless '$states' holds an array reference. I don't understand what you mean by "more persistent" or by 'Verify' knows the county stuff o

Re: Beginning beginner needing references help

2003-10-21 Thread Darin McBride
subroutines that may need them. Is this > possible and what might the referencing/dereferencing look like? You can put your data into a hash, as an example, and pass around the hash ref. With CGI::Application (hereafter "C::A"), you would put the data into your C::A object, and thus

Beginning beginner needing references help

2003-10-20 Thread Jonathan Mangin
rror. Instead of making subsequent db fetches I want to send(?) any/all of these to any/all subsequent (inner?) subroutines that may need them. Is this possible and what might the referencing/dereferencing look like? Verify calls other subroutines and then another HTML page. That page calls Register

Re: Another reference question (hash of hash references)

2003-08-14 Thread Tim Musson
Thanks Rob, My MUA believes you used Internet Mail Service (5.5.2653.19) to write the following on Friday, August 8, 2003 at 8:43:43 AM. HR> # store access the internal hash by following the reference "->" $hash{four}->>{uid} = "uid4"; $hash{four}->>{cn} = "cn4"; $hash{four}->>{group} = "Group4";

RE: Another reference question (hash of hash references)

2003-08-14 Thread Bob Showalter
Tim Musson wrote: > beginners, > > I am trying to build a hash of hash references. My problem is that I > need to be able to add a key/value pair to the internal hashes... > > ,- [ Here is my test code (yes, I am working with LDAP) ] #!perl > use strict; > use

RE: Another reference question (hash of hash references)

2003-08-14 Thread Bob Showalter
Hanson, Rob wrote: > > Any suggestions on how I can do this? > > Yes. > > # init the hash key > $hash{four} = {} unless exists $hash{four}; Due to autovivication, this is not necessary. > > # store access the internal hash by following the reference "->" > $hash{four}->{uid} = "uid4"; $hash{fo

Another reference question (hash of hash references)

2003-08-10 Thread Tim Musson
beginners, I am trying to build a hash of hash references. My problem is that I need to be able to add a key/value pair to the internal hashes... ,- [ Here is my test code (yes, I am working with LDAP) ] #!perl use strict; use warnings; my %hash = ( one => { uid => &quo

<    1   2   3   4   5   >