What is the "1;" line at the bottom of vnc.conf?

I am configuring tigervnc on Ubuntu, and the bottom of the default config file has

1;

What is the function of this line?


In the Debian package of TigerVNC, the vnc.conf file is actually a Perl script that is loaded by vncserver (which is also a Perl script) using the do() function, equivalent to 'source' in bash or 'include' in PHP.

The do() function in Perl returns whatever value was returned by the last statement in the script. So if the script's author places 1; as the last statement, the call to do() will also have the result of 1. (Whereas if the script ended with $abc = "xyz"; then do() would also return the string "xyz".)

Doing this is usually required for Perl modules, i.e. .pm files that are loaded into the main Perl script via use or require – if a module ended with a "false" value, it would result in an error message, so all Perl module files have a 1; stuck at the end to guarantee the correct result.

It isn't required for things loaded via do(), as Perl does no automatic check for its result, but the author must have habitually added it anyway.