I've added comments to the code for a learning purpose. See the package's original README for more details.
When installed on a machine, the main dpkg
scripts (e.g, dpkg-buildpackage
) are installed by the package dpkg
(in /usr/bin
), but the Dpkg
module is installed by libdpkg-perl
(in /usr/share/perl5/Dpkg
).
If you haven't looked at the source code for a wile, you will likely have forgotten what you had learned earlier. Here is the list to help you quickly pick up what you learned about dpkg
before:
- Start with
scripts/dpkg-buildpackage.pl
because this file has many notes about basic syntax and usage of Perl. Find the comments withNOTE(ywen)
and read through them from top to bottom. .pl
files are Perl scripts;.pm
files are Perl modules. If you want to find some code, e.g., a subroutine, do find in both kinds of files.- The module
Dpkg::ErrorHandling
defines the subroutineerror
(seesub error($;@)
) that prints a message and exits. You can use this function to test the behavior of the code. - Perl uses
print
to print a message. For example:print "SOURCE_DATE_EPOCH = $ENV{SOURCE_DATE_EPOCH}\n";
. See this doc and this tutorial for more details. - Perl requires
;
to end a statement. Make sure you write it.