File: encode64.pl

package info (click to toggle)
dotlrn 2.5.0+dfsg-6+wheezy4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 108,272 kB
  • sloc: tcl: 219,601; sql: 202,152; xml: 127,658; java: 7,268; php: 4,780; sh: 2,486; perl: 1,207; makefile: 137
file content (20 lines) | stat: -rw-r--r-- 333 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/local/bin/perl
#
# Encode a file from stdin as base64
#
# hqm@ai.mit.edu
#
# This script does the following:
#

use MIME::Base64 ();

binmode(STDIN);
binmode(STDOUT);
# Make sure to read in multiples of 6 chars, to
# keep the encoded blocks contiguous.
while (read(STDIN, $_, 60*1024)) {
  print MIME::Base64::encode($_);
}