|
|
|
|
|
|
| Author |
Message |
Spin *nix forums beginner
Joined: 05 May 2005
Posts: 19
|
Posted: Tue May 09, 2006 8:04 pm Post subject:
subroutine doesn't seem to run after calling it.
|
|
|
I am using PerlTray by ActiveState on Perl 5.8 on WinXP.
I have two subs, the one calling the other:
my @anim = qw(idexx idexx1 idexx2 idexx3);
sub Animate {
SetAnimation(20000, 50, @anim);
}
sub Checkport {
if (($loc ne "") && ($loc ne chr(03))) {
SWITCH: {
... couple other switches in here ...
($inbound_message_type eq "T") && do {
Animate();
... and some other stuff ...
}
}
}
}
If I just add the phrase: Animate(); right after the sub it runs fine.
However in the Checkport sub it will not run. I have other code
immediately following the Animate() call that conclusively verifies I
have reached that part of the subroutine and switch.
Checkport() is called from PerlTray's SetTimer() subroutine.
TIA
Spin |
|
| Back to top |
|
 |
Paul Lalli *nix forums Guru
Joined: 10 Jun 2005
Posts: 1089
|
Posted: Tue May 09, 2006 8:19 pm Post subject:
Re: subroutine doesn't seem to run after calling it.
|
|
|
Spin wrote:
| Quote: | I am using PerlTray by ActiveState on Perl 5.8 on WinXP.
I have two subs, the one calling the other:
my @anim = qw(idexx idexx1 idexx2 idexx3);
sub Animate {
SetAnimation(20000, 50, @anim);
}
sub Checkport {
if (($loc ne "") && ($loc ne chr(03))) {
SWITCH: {
... couple other switches in here ...
($inbound_message_type eq "T") && do {
Animate();
... and some other stuff ...
}
|
Yuck. Why not just use the standard if() mechanism? the short-circuit
nature of the logical comparison operators is good for one-statement
expressions (open or die, for example), but looks ugly when used with a
block.
if ($inbound_message_type eq 'T') {
Animate();
#... and some other stuff...
}
| Quote: | }
}
}
If I just add the phrase: Animate(); right after the sub it runs fine.
However in the Checkport sub it will not run.
|
What is your evidence for concluding it "will not run"?
| Quote: | I have other code
immediately following the Animate() call that conclusively verifies I
have reached that part of the subroutine and switch.
|
But you have no such code that conclusively verifies anything about
whether or not Animate() was called. I suggest that it was and that
your assumption that it has not is due to a failure of yours to explain
whatever results you've seen but not told us about.
Put another way, please read the posting guidelines for this group, and
then post a short but COMPLETE script that demonstrates your problem.
Paul Lalli |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Wed Dec 03, 2008 1:47 am | All times are GMT
|
|
Credit Cards | Mortgage Calculator | Credit Cards | Online Advertising | Loans
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|