The error message is as follows
In string, @63 now must be written as \@63 at -e line 1, near "#foo-bar
Target[789]:
1.3.6.1.2.1.10.32.2.1.7.57.789&1.3.6.1.2.1.10.32.2.1.9.57.789:SNMPSTRING@IP"
Execution of -e aborted due to compilation errors.

The code is as follows, but well, the @ is escaped so I've nfc, I've tried
double escaping it which did not work. Any help would be appreciated. even a
better way to accomplish the same thing. Im new to this so please exscuse my
unwieldy code.
#!/usr/bin/perl
############################################################################
#
#This program is part of a 3 file team that consists of:
#
#A web based form that takes information on a DSL Account using that info.
#
#An expect script that maps the person into our DSL router.
#
#This file that takes the same info and adds them to our MRTG Graphs.
#
############################################################################
#

#Get The variables from the web and then split them into name value pairs.
#Then split THOSE pairs and assign them to a hash called "bar"

@foo = split (/&/, $ENV{'QUERY_STRING'});
foreach $i (@foo)
{
    ($name, $value) = split(/=/,$i);
    $bar{$name} = $value;
}

#Prepare the information to be written to file.
$profile = "#$bar{cust_name}\n" .
   "Target[$bar{dlci}]:
1.3.6.1.2.1.10.32.2.1.7.57.$bar{dlci}&1.3.6.1.2.1.10.32.2.1.9.57.$bar{dlci}:
SNMPSTRING\@IP.OF.HOST\n" .
   "MaxBytes[$bar{dlci}]: 192000\n" .
   "AbsMax[$bar{dlci}]: 192000\n" .
   "Title[$bar{dlci}]: $bar{title}\n" .
   "PageTop[$bar{dlci}]: <h1>$bar{cust_name} (DLCI $bar{dlci})</h1>\n" .
   "<table>\n" .
   "<tr><td>Service:</td> <td>Level 3</td></tr>\n" .
   "<tr><td>Bandwidth:</td> <td>$bar{rate_limit}/$bar{police}</td></tr>\n" .
   "<tr><td>Binding:</td><td>bridged</td></tr>\n" .
   "</table>\n\n";

#Check to see wether or not we are placing the new info into the Business Or
Consumer Section.

system "perl -p -i -e 's!############ END DSL BUSINESS ACCOUNTS
#############!$profile\n############ END DSL BUSINESS ACCOUNTS
#############!gi' /usr/local/apache/htdocs/mrtg/fooness.cfg";
open(STUFF, "</usr/local/apache/htdocs/mrtg/fooness.cfg");
print "Content-Type: text/html \n\n <HTML><HEAD></HEAD><BODY>";
print "$profile";
print <STUFF>;
print "</BODY></HTML>";
close(STUFF);


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to