Hello Wilko,
I dumped the command, and spotted the problem.
The perl wrapper is supposed to return the parameters in the order
given by its C wrapper counterpart, which is:
bool XrdStat(const char *fname, long *id, long long *size, long *flags,
long *modtime)
There is no reason for swig to swap the parameters.
But I see that you get the result with a syntax which is different
from the one coming from the examples, which is:
$par = "/tmp/myfile.zip";
@ans = XrdClientAdmin::XrdStat($par);
print "\nThe answer of XrdClientAdmin::Stat($par) is:
\"$ans[1]\"-\"$ans[2]\"-\"$ans[3]\"-\"$ans[4]\" \n\n\n";
It seems to me that to get the answer we have to skip the first
element of the array. This could be a swig or perl induced strangeness.
Using your syntax, and writing:
my ($swigpad,$id,$sizeXrd,$flags,$modtime) =
XrdClientAdmin::XrdStat($par);
print "\n\nThe answer of XrdClientAdmin::Stat($par) is: id:$id,
size:$sizeXrd, flags:$flags, modtime:$modtime \n\n\n";
should do the job. Please confirm that it's working for you too.
The only uglyness I see from the results I get is that the "id" field
got from xrootd puts a long into overflow. Right now, I don't where it
comes from.
Fabrizio
Wilko Kroeger wrote:
>
> Hello
>
> Within perl, using the XrdClientAdmin perl lib, the stat of a file is
> obtained with:
>
> my ($id,$modtime,$sizeXrd,$flags) = XrdClientAdmin::XrdStat($testFile);
> print "stat: id= $id mtime= $modtime size= $sizeXrd flags= $flags
> $testFile\n";
>
> The output is:
> stat: id= 1 mtime= 2147483647 size= 80871 flags= 0
> /prod/WRTest/testOut2/B0DKNeut.01.root
>
> The mtime is 2147483647, which is not only far in the future, but I get
> this number for every file that is stat'ed. 2147483647 corresponds
> to 0x7fffffff in HEX.
>
>
> In the xrootd protocol documentation (3.22 kXR_stat Request) it says that
> the stat command returns for each file:
> info: id size flags modtime\0
> but the perl stat command returns: id mtime size flags
> Does the perl command changes the order? Is the xrootd documentation
> correct?
>
>
>
> Cheers,
> Wilko
>
|