Changing -w to "use warnings"
Setting permissions
Added check for source not being set
Added logic to simulate a CGI environment when running from the command-line