Skip to content

Instantly share code, notes, and snippets.

@cpCharlesBoyd
Last active January 14, 2016 19:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpCharlesBoyd/5196811 to your computer and use it in GitHub Desktop.
Save cpCharlesBoyd/5196811 to your computer and use it in GitHub Desktop.
An example of using cPanel standardized hooks that executes when an addon domain is created.
#!/usr/bin/env perl
package YourAddonModule;
use warnings;
use strict;
sub describe {
my $create_addon_hook =
{
'category' => 'Cpanel',
'event' => 'Api2::AddonDomain::addaddondomain',
'stage' => 'pre', # or post
'hook' => 'YourAddonModule::your_hook_subroutine',
'exectype' => 'module',
};
return [$create_addon_hook];
}
sub your_addon_hook {
my ( $context, $data ) = @_;
my $args = $data->{'args'};
my ( $dir, $newdomain, $subdomain ) = ( $args->{'dir'}, $args->{'newdomain'}, $args->{'subdomain'} );
print "HOOK TEST : Created $newdomain with dir = $dir and subdomain = $subdomain","\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment