in reply to Moose: Can't call method "insertcount" on an undefined value

You forgot to pass in $self in your calls :)

Change these lines:

committoDB;

to:

$self->commitoDB;