Here is an example of getting the SB filedesc.sb script file info by calling a Perl function.
DECLARE SUB pl_Init ALIAS "pl_Init" LIB "sbperl"
DECLARE SUB pl_Eval ALIAS "pl_Eval" LIB "sbperl"
DECLARE SUB pl_GetInt ALIAS "pl_GetInt" LIB "sbperl"
DECLARE SUB pl_GetDbl ALIAS "pl_GetDbl" LIB "sbperl"
DECLARE SUB pl_GetStr ALIAS "pl_GetStr" LIB "sbperl"
DECLARE SUB pl_Destroy ALIAS "pl_Destroy" LIB "sbperl"
pl_Init
pl_code = """
my $file = "filedesc.sb";
my (@description, $size);
if (-e $file)
{
push @description, 'binary' if (-B _);
push @description, 'a socket' if (-S _);
push @description, 'a text file' if (-T _);
push @description, 'a block special file' if (-b _);
push @description, 'a character special file' if (-c _);
push @description, 'a directory' if (-d _);
push @description, 'executable' if (-x _);
push @description, (($size = -s _)) ? "$size bytes" : 'empty';
print "$file is ", join(', ',@description),"\n";
}
"""
pl_Eval pl_code
pl_Destroy
jrs@laptop:~/sb/sb22/test$ scriba filedesc.sb
filedesc.sb is a text file, 898 bytes
jrs@laptop:~/sb/sb22/test$ ls -l filedesc.sb
-rw-rw-r-- 1 jrs jrs 898 Apr 8 00:15 filedesc.sb
jrs@laptop:~/sb/sb22/test$