+sub submit_bug {
+ state $spec =
+ {subject => {type => SCALAR,
+ default => 'Submitting a bug',
+ },
+ body => {type => SCALAR,
+ default => 'This is a silly bug',
+ },
+ submitter => {type => SCALAR,
+ default => 'foo@bugs.something',
+ },
+ pseudoheaders => {type => HASHREF,
+ default => sub {{}},
+ },
+ package => {type => SCALAR,
+ default => 'foo',
+ },
+ run_processall => {type => SCALAR,
+ default => 0,
+ },
+ };
+ my %param =
+ validate_with(params => \@_,
+ spec => $spec);
+ my $body = 'Package: '.$param{package}."\n";
+ foreach my $key (keys %{$param{pseudoheaders}}) {
+ for my $val (ref($param{pseudoheaders}{$key}) ?
+ @{$param{pseudoheaders}{$key}} :
+ $param{pseudoheaders}{$key}) {
+ $body .= $key. ': '.$val."\n";
+ }
+ }
+ $body .="\n".$param{body};
+ send_message(to => 'submit@bugs.something',
+ headers => [To => 'submit@bugs.something',
+ From => $param{submitter},
+ Subject => $param{subject},
+ ],
+ run_processall => $param{run_processall},
+ body => $body
+ );
+}
+