Changeset 66


Ignore:
Timestamp:
11/12/04 15:17:59 (20 years ago)
Author:
Kris Deugau
Message:

/trunk

Shell of allocateBlock() function added
mailNotify function added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r16 r66  
    11# ipdb/cgi-bin/IPDB.pm
    2 # Contains DB-related functions for IPDB
     2# Contains functions for IPDB - database access, subnet mangling, block allocation, etc
    33###
    44# SVN revision info
     
    77# Last update by $Author$
    88###
    9 
    10 # Split from CommonWeb.pm 08/13/2004 kdeugau@vianet
     9# Copyright (C) 2004 - Kris Deugau
    1110
    1211package IPDB;
     
    1514use warnings;
    1615use Exporter;
     16use Net::SMTP;
    1717use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
    1818
    1919$VERSION        = 1.0;
    2020@ISA            = qw(Exporter);
    21 @EXPORT_OK      = qw(&connectDB &checkDBSanity);
     21@EXPORT_OK      = qw(&connectDB &checkDBSanity &allocateBlock);
    2222
    2323@EXPORT         = (); # Export nothing by default.
    24 %EXPORT_TAGS    = ( ALL => [qw( &connectDB &checkDBSanity )]
     24%EXPORT_TAGS    = ( ALL => [qw( &connectDB &checkDBSanity &allocateBlock )]
    2525                  );
     26
    2627
    2728# Creates connection to IPDB.
     
    6667} # end checkDBSanity
    6768
     69
     70# allocateBlock()
     71# Does all of the magic of actually allocating a netblock
     72sub allocateBlock($) {
     73}
     74
     75
     76# mailNotify()
     77# Sends notification mail to recipients regarding an IPDB operation
     78sub mailNotify ($$$) {
     79  my ($recip,$subj,$message) = @_;
     80  my $mailer = new Net::SMTP "smtp.example.com";
     81
     82  $mailer->mail('ipdb@example.com');
     83  $mailer->to($recip);
     84  $mailer->data("X-Mailer: IPDB Notify v$IPDB::Version\n",
     85                "Date: ".strftime("%a, %d %b %Y %H:%M:%S %z\n", localtime)."\n",
     86                "Organization: Example Corp.",
     87                "From: \"IP Database\" <ipdb\@example.com>\n",
     88                "Subject: $subj\n",
     89                "\n",
     90                "$message\n");
     91  $mailer->quit;
     92}
     93
    6894# Indicates module loaded OK.  Required by Perl.
    69951;
Note: See TracChangeset for help on using the changeset viewer.