Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Perlscript
➜ Debugging
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Rynok
USA (25 posts) Bio
|
Date
| Mon 29 Mar 2010 11:15 PM (UTC) |
Message
| I have my system setup to where it loads my main script, and I have an alias that sends all commands to the script and a trigger that sends all triggers to my script.
Both are set to: "Send to: World" but then I give them a Script name to actually call and I store %1 in the Clipboard to reference inside the function.
Triggers send to OnWorldReceive().
My problem that I've noticed is when my code has any issues at all (like syntax), the entire thing freaks out and says:
Unable to invoke script subroutine "OnWorldReceive" when processing trigger ""
Code wise, it says "Error context in script" and shows me the first 5 lines of my main script page.
(In the above example, I simulated an error by changing a function name from "info" to "Info" so it wouldn't recognize it when it tried to call it later on.)
So my question is if there is a way to have better debugging than that generic phrase? If I didn't know it was a simple typo like that, I could easily spend a ton of time looking for the real error.
Thanks! | Top |
|
Posted by
| Rynok
USA (25 posts) Bio
|
Date
| Reply #1 on Mon 29 Mar 2010 11:19 PM (UTC) |
Message
| Another issue I see a lot:
There was a problem in script file "<main script>":
The trigger subroutine named "OnWorldReceive" could not be found. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #2 on Tue 30 Mar 2010 12:32 AM (UTC) |
Message
| This may be a limitation of the Perl script engine. It tries to show 5 lines around the error, which it does with Lua and some other languages.
You shouldn't have to put %1 on the clipboard, the script function gets the matching line and wildcards as arguments. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Rynok
USA (25 posts) Bio
|
Date
| Reply #3 on Tue 30 Mar 2010 12:43 AM (UTC) |
Message
| Yeah, I'm coming from Lua where you'd get 5 lines that were generally spot-on for debugging.
Switched to Perl this time though because I have a multicore processor now and wanted to be able to take advantage of that with multithreaded Perl code. (That and using perl to pull HTTP data from websites on demand) | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #4 on Tue 30 Mar 2010 12:49 AM (UTC) |
Message
| I'm not a Perl expert, maybe someone else can help.
You can pull stuff from websites with luasocket. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Rynok
USA (25 posts) Bio
|
Date
| Reply #5 on Tue 30 Mar 2010 04:25 AM (UTC) |
Message
| Well, looks like you can't do multithreading using Perlscript anyways. Guess that's a good thing to know ahead of time before I start developing too much.
I'll look into some alternate options, like having Perl process running that Perlscript connects to as a sort of Proxy. I've done that before with Lua/C and it worked pretty well. Just adds a huge layer of complexity to the process. | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
20,818 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top