Hi there,
The last couple of months I have developed a top secret system using GLinks. I have just found something interesting, regarding globals. It might help some-one some day.
Lets say I have a global which has another function in it. I'll call it "get_all_links":
sub {
#code here
my @cats = getSubCats();
sub getSubcats {
#code here
}
}
Now we need an additional similar function. I'll call it "get_back_links":
sub {
#code here
my @cats = getSubCats();
sub getSubcats {
#the code here is different from that of "get_all_links"
}
}
If I use the global "get_back_links" it will not work properly. It kept me going for two hours before it struck me.
The globals seem to be loaded alphabeticaly. It means that "get_all_links" will be loaded before "get_back_links".
Inside "get_all_links" the function "getSubcats" is already created. So when you call "getSubcats" inside "get_back_links", it won't execute the function "getSubcats" inside "get_back_links", but rather the one inside of "get_all_links".
Is this making sense to anyone?
PS: I fixed it by changing the name of "getSubcats" inside "get_back_links" to something else.
Sacrifice is not about what you lose,
it is about what you gain in the process.
The last couple of months I have developed a top secret system using GLinks. I have just found something interesting, regarding globals. It might help some-one some day.
Lets say I have a global which has another function in it. I'll call it "get_all_links":
Code:
sub {
#code here
my @cats = getSubCats();
sub getSubcats {
#code here
}
}
Now we need an additional similar function. I'll call it "get_back_links":
Code:
sub {
#code here
my @cats = getSubCats();
sub getSubcats {
#the code here is different from that of "get_all_links"
}
}
If I use the global "get_back_links" it will not work properly. It kept me going for two hours before it struck me.
The globals seem to be loaded alphabeticaly. It means that "get_all_links" will be loaded before "get_back_links".
Inside "get_all_links" the function "getSubcats" is already created. So when you call "getSubcats" inside "get_back_links", it won't execute the function "getSubcats" inside "get_back_links", but rather the one inside of "get_all_links".
Is this making sense to anyone?
PS: I fixed it by changing the name of "getSubcats" inside "get_back_links" to something else.
Sacrifice is not about what you lose,
it is about what you gain in the process.