##
# Copyright (c) 2008 Health Market Science, Inc
##
package _TMP;
use strict;
use warnings;
our $CVS_ID = '$Id: emacs-utils.el,v 1.82 2008/07/11 13:35:40 kburton Exp $'; #'
our $VERSION = ( qw$Revision: 1.82 $ )[1];

sub run {
  my($self) = @_;

  my $dispatch = {
                  map { $_ => $_ } qw( makeFile )
                 };
  my $cmd = shift @ARGV;
  unless ($cmd && exists $dispatch->{$cmd}) {
    die "Error: invalid cmd: $cmd, try one of: (" . join(', ', sort keys %$dispatch). ")\n";
  }

  $self->$cmd(@ARGV);
}

sub openFile {
  my($self,$fname,$mode) = @_;
  $mode ||= '<';
  my $fh;
  unless (open $fh, $mode, $fname) {
    die "Error opening file:$fname mode:$mode : $!\n";
  }
  return $fh;
}

sub makeFile {
  my($self,$file) = @_;
  #my @alpha = ('a' .. 'z', 'A' .. 'Z');
  my @alpha = ('a' .. 'z', 'A' .. 'Z');

  my $fh = $self->openFile($file,">");

  for (1 .. 2**14) {
    print $fh $alpha[rand(@alpha)];
  }

#  for (1 .. 1000) {
#    print $fh chr(rand(255));
#  }
  close $fh;
}

1;

_TMP->run;
