Currently the only way to scan a barcode from the perspective app is to call the ScanBarcode action on a component. A script like system.perspective.scanBarcode should be added to call this action from scripting.