Constants at Server vs. IDE

Are you using LiveCode to create server scripts or CGIs?

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
i2Internet
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6
Joined: Wed Jun 01, 2011 10:35 am

Constants at Server vs. IDE

Post by i2Internet » Tue Jul 26, 2011 3:25 am

Why is it that at Server the following code:

Code: Select all

constant kTest="Constant TEST"
put kTest
... outputs:

kTest


... whereas at the LiveCode IDE the same code outputs what I'd expect:

Constant TEST


I'm manually porting over (re-creating) a framework I've developed in PHP to LiveCode (Server, and perhaps more) and having the ability to make use of constants will make all the difference (now having to rely on global variables, etc. instead).

Both tests are being done in LiveCode 4.6.3 at the IDE for Mac OS X (Lion) and on LiveCode 4.6.3 Server (at On-Rev and locally at the Mac).

Any assistance or further info will be greatly appreciated.

Thanks in advance,
- Kevin of Zaz Corp. USA

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Re: Constants at Server vs. IDE

Post by BvG » Tue Jul 26, 2011 3:00 pm

Possibly constants are not supported on the server engine? Otherwise it'd look like a bug.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5084
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Constants at Server vs. IDE

Post by jacque » Tue Jul 26, 2011 4:42 pm

Where in the script do you declare the constant?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

i2Internet
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6
Joined: Wed Jun 01, 2011 10:35 am

Simple Script, and Live URL to Sample -shows put constant re

Post by i2Internet » Tue Jul 26, 2011 11:30 pm

Hi Jacque,

You asked:
jacque wrote:Where in the script do you declare the constant?
This is actually happening at a script where the only code that's there is as described:

Code: Select all

<?lc
	constant kTest="Constant TEST"
	put kTest
?>
See the code in action here using your web browser (remove space between the "." and "com"):
i.on-rev. com/test/constant.lc

Unless a fix is put in place at on-rev, I expect you'll see the folowing as described at top:

kTest


Thanks for the reply, Jacque - and thanks to BvG as well!

All the best,
- Kevin of Zaz Corp. USA

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1682
Joined: Sat Feb 28, 2009 11:49 pm

Re: Constants at Server vs. IDE

Post by sturgis » Wed Jul 27, 2011 2:16 am

Interestingly, if you do the following it sets the constant, but then its local to the handler not the script.

command checkConstant
constant ktest = "this is my constant"
put ktest
end checkConstant

checkConstant

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5084
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Constants at Server vs. IDE

Post by jacque » Wed Jul 27, 2011 11:24 pm

Interesting. I never tried using a constant in an irev script. They typically are placed outside of any handler, and it looks like if there is no declared handler then they don't work. I wonder if this is a bug or not. I can see it both ways.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

i2Internet
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6
Joined: Wed Jun 01, 2011 10:35 am

Re: Constants at Server vs. IDE

Post by i2Internet » Thu Aug 04, 2011 3:27 am

Thank you for the followups sturgis and jacque.

I do see that the constant declaration does work within a handler, as sturgis has pointed out.

My primary interest is in having constants that can be declared at a preceding (include) script and then used throughout subsequent code. This capability is rather important and integral to various projects I have in the works.

I very much hope that on upcoming revision to LiveCode Server will support this. Thanks to the RunRev team in advance for anything that can be done to expedite things along these lines.

Regards,
- Kevin of Zaz Corp USA

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Re: Constants at Server vs. IDE

Post by BvG » Thu Aug 04, 2011 5:23 pm

did you file it as a bug report? I'd like to vote on it, but can't find it.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Martin Koob
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 237
Joined: Sun May 27, 2007 8:19 pm

Re: Constants at Server vs. IDE

Post by Martin Koob » Sat Aug 06, 2011 7:06 pm

I have a couple of bugs regarding Livecode Server and On-rev Editor that I would like to post but I am not sure what component to post them under. It seems there is not an existing one that matches. I posted a bug about about that for the QCC. THe bug number is 9653.
Regarding Livecode Server I asked:

I am not sure where to put bugs for Livecode Server. It would seem it
should be in

Engine > Build > Server

and/or

Engine > Platform > Mac OS X > Server
Engine > Platform > Windows > Server
Engine > Platform > Linux > Server

Does anyone have suggestions under which component to post livecode Server bugs?

Martin

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Re: Constants at Server vs. IDE

Post by BvG » Sat Aug 06, 2011 8:33 pm

don't worry too much, if someone at RunRev decides that it's the wrong one, they'll change it for you. Any of those should be sufficient, but probably the OS-specific ones should be reserved for OS specific problems, no?
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Post Reply

Return to “CGIs and the Server”