calling osascript from perl script

I want a perl script to check if a particular server volume is mounted on my machine (I’ll get more complicated once this is cracked!). I am using perl as it is fundamentally a web application and I’d like to access a database down the line. I’m trying to set a variable as follows:

@my_disks = osascript -e 'list disks';

but the variable ends up empty and my system.log shows the follwing error:

WindowServer[169]: _CGXGetDisplayShmem: Unauthorized user
osascript: kCGErrorIllegalArgument : initCGDisplayState: cannot map display interlocks.
WindowServer[169]: _CGXNewConnectionPort : Unauthorized user
osascript: kCGErrorIllegalArgument : CGSNewConnection cannot get connection port

Running a similar command in Terminal works perfectly. Anyone got any idea what these errors mean and how to work around it?

Thanks in advance.