#!/bin/bash
mod=$1
file=$(perl -MV=$mod | grep -Em1 '^\s' | grep -vi 'not found' | perl -pe 's/(?:^\s+|: .+?$)//g')
if [[ -z "$file" ]]; then
    echo -n Not found locally.
    if [[ -n `which cpandoc` ]]; then
        echo "  Trying remote... "
        file=`cpandoc -ml $1`
    else
        echo Install cpandoc for remote source.
        exit 1
    fi

    if [[ -n $file ]]; then
        echo found.
    else
        echo not found.
        exit 1
    fi
fi
vi "+setf perl" "$file"
