Thanks Alex,

For my first web services I implementing the "start using" of library stacks 
method back in the day. Like you I moved to "start using" of script only 
library stacks. I'll just keep chugging along with "start using"s. I'll keep 
include/require on the back shelf for now...

Thanks again!

Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net


-----Original Message-----
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of 
Alex Tweedly via use-livecode
Sent: Friday, November 30, 2018 3:16 PM
To: use-livecode@lists.runrev.com
Cc: Alex Tweedly
Subject: Re: LiveCode Server

Hmmm I hesitated to reply earlier, just in case there are subtleties I might 
get wrong and mislead you - but here goes.

include / require are essentially ways to include the text of the included 
file. Include will do that - and do it every time you use it ....

so you could have a trivial nonsensical example like ...

mydebug.lc   - a file which will dump out a bunch of variable info ...

> <? rev
> put "Data is:" && gVar1 && gVar2 && gArray[temp]
>
and use it as

.....
doSomeHandler gVar1, 17
-- and check what the current status is now include "mydebug.lc"
doSomeOtherFunctions
-- and check again
include "mydebug.lc"


note that you can now change the file to do any other logging you might want, 
and each occurrence will be changed.

NB - I have never used 'include' except in a few places where I should have 
used require :-) And I've never wanted to use it as I just described :-) :-)

require is similar, but the file contents will only be inserted the
*first* time; so it's useful to include the source of library-like functions. 
And you don't need to worry if you do this in multiple places. I used to use 
this a lot.

Note that include and require are both specific to LC server. I basically no 
longer use them, now that we have script-only stacks. I now develop 99% of all 
LC server functionality as script-only stacks, testing in either the IDE or via 
LCServer as needed. And for this, you use "start using" just like in the IDE 
world.

-- Alex.

P.S. Note - there are (I think) strange subtleties in using globals and/or 
script locals in include'd / require'd files - very confusing, and I suspect 
it's a bug - but  couldn't quite come up with a reliable mental model or 
example; that was when I just converted to script-only library stacks.


On 30/11/2018 16:26, Ralph DiMola via use-livecode wrote:
> Ahh... I see that the revIgniter library is the way to go for my 
> number 2 question and I am immersed in the docs. But I'm still 
> wondering about my question # 1 (differences between "Include", 
> "Require" and "Start using")
>
> I've been using LiveCode Server for a few years now with great success 
> as various web services from LCS. I started this when I was a relative newbie.
> I access my library stacks via "Start using".
> 1) Can anyone shed some light on the subtle differences between 
> "Include", "Require" and "Start using"? The docs are not clear to me.
>
> I'm starting a new project using interactive web pages. I have an in 
> house web designer that I need to show how to call LC server scripts 
> to populate web pages. I would rather use LC Server and MySQL and my 
> on-staff html designer rather than sub it all out using vb.net and SQL server.
> 2) Are there any examples of how to do this?
>
> Thanks in advance.
>
> Ralph DiMola
> IT Director
> Evergreen Information Services
> rdim...@evergreeninfo.net     
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to