[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Perlscript
. . -> [Subject]  Debugging
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Debugging

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Rynok   USA  (25 posts)  [Biography] 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!
[Go to top] top

Posted by Rynok   USA  (25 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] 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
[Go to top] top

Posted by Rynok   USA  (25 posts)  [Biography] 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)
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] 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
[Go to top] top

Posted by Rynok   USA  (25 posts)  [Biography] 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.
[Go to top] 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.


4,959 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]