Page 1 of 1 1
Topic Options
#119436 - 2004-05-12 08:30 PM using a central udf file
tr6boy Offline
Starting to like KiXtart

Registered: 2001-10-24
Posts: 131
I think I've read here that it makes sense to bundle the various UDFs that you use into a single file, and then call it from your script. But is there a practical limit as to how large I should let it become?

It's probably unrelated, but running IsInSubnet with the function code in the same script is working fine, but calling it from another script is causing an error. It's not just that it can't find the file, it's saying "expected expression" in a line that is part of the function code.

I can't find anything wrong with it.

Exact Error is:

expected expression: $h=''+$h+iif($/8,'255',$f[$ mod 8])+iif($g<4,'.',''

which appears in this part of the UDF:
Code:

;Begin build mask array (Howard Bullock)
$f=0,128,192,224,240,248,252,254,255
for $e=0 to 32
Dim $h
$=$e
for $g=1 to 4
$h=''+$h+iif($/8,'255',$f[$ mod 8])+iif($g<4,'.','')
$=iif($>8,$-8,0)
next
$m[$e]=$h
next


Top
#119437 - 2004-05-13 09:54 AM Re: using a central udf file
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hehe.
looks like GolfTime!

at a quick check didn't find anything specific wrong there...
so, I might quess the lines before have missing quote in your lib.
or similar.
_________________________
!

download KiXnet

Top
#119438 - 2004-05-13 03:32 PM Re: using a central udf file
tr6boy Offline
Starting to like KiXtart

Registered: 2001-10-24
Posts: 131
Yep, I think this came out of the golf tourney...it's fun to read those past posts
Top
#119439 - 2004-05-13 04:35 PM Re: using a central udf file
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

But is there a practical limit as to how large I should let it become?




Yup, when it becomes impractical to maintain, you've exceeded the practical limit.

There are a couple of consideration that would make you break down the file into smaller libraries.

The first is simply maintenance. It is unhandy having to edit a file with hundreds of functions in it, or to search through for a function who's name you've forgotten.

More important though, is that every file that you load is parsed. This happens when you "CALL" the file, and the entire file is parsed - not just the functions that you want to use.

Often the longest part of running a script is reading it from the network share and parsing it.

For this reason it makes sense to categorise you UDFs and store them in discrete libraries. You only need to call in the libraries that contain the functions you are going to use, saving memory and cpu.

For instance, I have seperate libraries for
  • Logging UDFs
  • Internationalisation UDFs
  • String handling UDFs
  • Email UDFs
  • Network calculation UDFs
  • Time and date UDFs
  • Specific application UDFs


And so-on.

There are no more than 6 small functions in each of these, so they are quite quick to load and parse.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.107 seconds in which 0.081 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org