File: generate.pl

package info (click to toggle)
libdime-tools-perl 0.05-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 160 kB
  • sloc: perl: 763; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 609 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/perl

use IO::File;
use DIME::Message;
use DIME::Payload;
use DIME::Parser;

sub generate
{
# Generate a DIME message

my $payload = new DIME::Payload;
$payload->attach(Path => "./test.txt",
		 MIMEType => 'text/plain',
		 Dynamic => 1);

my $payload2 = new DIME::Payload;
my $data = "Hello World!!!";
$payload2->attach(Data => \$data,
		 MIMEType => 'text/plain');

my $message = new DIME::Message;
$message->add_payload($payload);
$message->add_payload($payload2);

my $out = new IO::File("dime.message","w");

$message->print($out);
$out->close();
}

generate();