#!/usr/bin/perl -n

=head1 NAME

rmgodpassword

=head1 SYNOPSIS

Removes God's password from a database in case you forget it.

=head1 USAGE

 perl rmgodpassword < outdb > newdb

or, if you keep your databases compressed with gzip:

 gunzip -c outdb.gz | perl rmgodpassword | gzip > newdb.gz

Rather than just overwriting the existing db, it writes out
to a new copy Just In Case. Always make backups!

=head1 BUGS

Works by removing the first password attribute in the database.
If God is not the first player, it won't work properly.

=head1 AUTHOR

Raevnos <shawnw@penguinpowered.com>

=cut

BEGIN {
 $first = 1;
}

if ($first == 1 && /^\]XYXXY\^/o) {#Look for the first password attr in the db.
  $first = 0;
  my $line = <>; # Skip the line with the actual password.
} else {
  print; # Print the line
}

