Future and plans for libnet? Why 'all the way with ejs'?
Henrik Nordstrom
hno at squid-cache.org
Sat Jul 9 11:28:08 GMT 2005
On Sat, 9 Jul 2005 tridge at samba.org wrote:
> Alan,
>
> > This is a problem with many, many open source projects. There's a
> > desperate need for a tiny, embedded, extensible, interpreted scripting
> > language.
>
> I think js is a perfect fit for Samba. To see what can be done with it
> when coupled with the auto-generated library code from pidl have a
> look at this:
>
> http://samba.org/ftp/unpacked/samba4/swat/scripting/samr.js
Neat.
But in terms of OO and ability to extend/modify the object structures it
can become better. Compared to what the equivalent perl construct would
look like:
For example:
/*
return information about a user
*/
function samrQueryUserInfo(conn, user_handle, level)
{
var r, io = irpcObj();
io.input.user_handle = user_handle;
io.input.level = level;
status = dcerpc_samr_QueryUserInfo(conn, io);
check_status_ok(status);
return io.output.info.info3;
}
Would in Perl look like
/*
return information about a user
*/
sub samrQueryUserInfo($$$)
{
my (conn, user_handle, level) = @_;
my io = $irpcObj->new(user_handle => $user_handle, level => $level);
status = dcerpc_samr_QueryUserInfo($conn, $io);
check_status_ok($status);
return $io->output->info->info3;
}
The last thee lines can also be improved significantly, but since I don't
know the object relationship too well I don't dare to make a suggestion.
Regards
Henrik
More information about the samba-technical
mailing list