Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: problem with strict in perl 5.6 and asp

by Sidhekin (Priest)
on Nov 05, 2007 at 00:36 UTC ( #648925=note: print w/ replies, xml ) Need Help??


in reply to Re^2: problem with strict in perl 5.6 and asp
in thread problem with strict in perl 5.6 and asp

Can't you just declare the (not quite) "built-in" variables with our?

use strict; # with impunity our( $Response, $Session, $Request );

(our should be usable with 5.6 and later; otherwise the vars pragma could be an alternative.)

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!


Comment on Re^3: problem with strict in perl 5.6 and asp
Select or Download Code
Re^4: problem with strict in perl 5.6 and asp
by grashoper (Monk) on Nov 05, 2007 at 00:52 UTC
    Thanks sid, unfortunately I have some vars that are not standard giving me grief and I am not sure how to fix them. here is the file (I realize this may be too much to include, but not sure whats important and whats not so posting the whole file for this module.. here is the error I am getting Bareword "Remove" not allowed while "strict subs" in use at (eval 2) line 2695. Bareword "Remove" not allowed while "strict subs" in use at (eval 2) line 2973. Bareword "Cancel" not allowed while "strict subs" in use at (eval 2) line 3618. Bareword "Remove" not allowed while "strict subs" in use at (eval 2) line 3454. (in cleanup) BEGIN not safe after errors--compilation aborted
    <script @Language="PerlScript" RunAt="Server"> ########################################## #### THIS IS THE BANE OF MY EXISTANCE #### ########################################## sub mAdmin { use OLE; my $str = ""; if ($Session->{'adminRights'} || $Session->{'uCLass'} == 10) { $str .= mLeftIndex(); } my $boxWidth = ($g_docWidth/5*4-(2*$g_docSpace)); if (!$str) { $boxWidth = $g_docWidth -(2*$g_docSpace); } my $Conn = CreateObject OLE "ADODB.Connection"; $Conn->Open("PROVIDER=SQLOLEDB;DATA SOURCE=$Session->{'sqlServer'} +;UID=$Session->{'sqlUser'};PWD=$Session->{'sqlPass'};DATABASE=$Sessio +n->{'dbName'}"); my $RS = $Server->CreateObject("ADODB.Recordset"); if ($Request->item("View")->item() eq "EditAlerts") { SWITCH: { ############# Action RemoveConfirm ################### if ($Request->item("Action")->item() eq "RemoveConfirm") { $title = "Remove Alert Confirmation"; $content = "<![CDATA[<table width=\"100%\" border=\"0\" cellpadding=\" +0\" cellspacing=\"0\"> <tr> <td>Are you sure you want to Remove this Alert?</td> <td><a href=\"".$Session->{'this'}."?Tab=".$Request->item("Tab")->item +()."&View=".$Request->item("View")->item()."&Action=".Remove."&AlertI +D=".$Request->item("AlertID")->item()."\">Yes</a></td> <td><a href=\"".$Session->{'this'}."?Tab=".$Request->item("Tab")->item +()."&View=".$Request->item("View")->item()."\">No</a></td> </tr> </table>]]>"; last SWITCH; } #end if ($Request->item("Action")->item()eq "RemoveConfirm") ################### Action Remove ################### if ($Request->item("Action")->item() eq "Remove") { my $sql = "UPDATE Alerts SET Active = '0', Modifier = '".$Session->{'usrID'}."', LastModified = { fn NOW() } WHERE (Active = '1') AND (idAlert = '".$Request->item("AlertID")->item()."') AND (System = '".$Session->{'usrSystem'}."') AND (Account = '".$Session->{'usrAccount'}."';"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS = $Conn->Execute($sql); } #end if ($Request->item("Action")->item() eq "Remove") ################### Action Add ################### if ($Request->item("Action")->item() eq "Add") { my $sql = "INSERT INTO Alerts (Submitter, Modifier, LastModified +, Active, System, Account, startDate, endDate, title, body, idOrder, +Viewable) VALUES ('".$Session->{'usrID'}."', '".$Session->{'usrID'}."', { fn NOW() }, 1, '".$Session->{'usrSystem'}."', '".$Session->{'usrAccount'}."', '".$Request->item("txtstartDate")- +>item()."', '".$Request->item("txtendDate")->i +tem()."', '".$Request->item("txttitle")->ite +m()."', '".$Request->item("txtbody")->item +()."', '".$Request->item("txtidOrder")->i +tem()."', 1);"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS = $Conn->Execute($sql); } #end if ($Request->item("Action")->item() eq "Ad +d") ################### Action Update ################### if ($Request->item("Action")->item() eq "Update") { my $sql = "UPDATE Alerts SET Modifier = '".$Session->{'usrI +D'}."', LastModified = { fn NOW() }, title ='".$Request->item("txttitle +")->item()."', startDate ='".$Request->item("txts +tartDate")->item()."', endDate ='".$Request->item("txtend +Date")->item()."', body ='".$Request->item("txtbody") +->item()."', idOrder ='".$Request->item("txtidO +rder")->item()."' WHERE (Active = '1') AND (idAlert = '".$Request->item("Aler +tID")->item()."') AND (System = '".$Session->{'usrSystem +'}."') AND (Account = '".$Session->{'usrAccou +nt'}."');"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS = $Conn->Execute($sql); } #if ($Request->item("Action")->item() eq "Update +") ################### INITIAL ALERT SCREEN ############# +###### my $sql = "SELECT idAlert, Submitter, Modifier, LastModified, Active, System, Account, startDate, endDate, title, body, idOrder FROM Alerts WHERE (Active = '1') AND (System = '".$Session->{'usrSystem'}." +') AND (Account = '".$Session->{'usrAccount'} +."');"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS->Open($sql, $Conn); $title = "Account Alerts"; $content = "<alerts>"; if ($RS) { while(!$RS->EOF()) { my $account = $RS->Fields('Account')->{Val +ue}; if (!$account){$account = "All";} $content .= "<alert id=\"".$RS->Fields('id +Alert')->{Value}."\" submitter=\"".$RS->Fields('Submitter') +->{Value}."\" modifier=\"".$RS->Fields('Modifier')-> +{Value}."\" lastModified=\"".$RS->Fields('LastModi +fied')->{Value}."\" active=\"".$RS->Fields('Active')->{Val +ue}."\" system=\"".$RS->Fields('System')->{Val +ue}."\" account=\"".$account."\" startDate=\"".$RS->Fields('startDate') +->{Value}."\" endDate=\"".$RS->Fields('endDate')->{V +alue}."\" title=\"".$RS->Fields('title')->{Value +}."\" idOrder=\"".$RS->Fields('idOrder')->{V +alue}."\"> <![CDATA[".$RS->Fields('body')->{Value +}."]]> </alert>"; $RS->MoveNext(); } #end while(!$RS->EOF()) $RS->Close(); } #end if ($RS) $content .= "</alerts>"; use XML::Writer; use XML::Writer::String; my $string = XML::Writer::String->new(); my $doc = new XML::Writer(OUTPUT => $string, DATA_ +MODE =>1, DATA_INDENT =>2); my $writeSQL = 0; my $fileacct = $Session->{'usrSystem'}.$Session->{ +'usrAccount'}.".xml"; my $XMLval = "<accountAlerts>"; my $sql = "SELECT idAlert, startDate, endDate, title, body FROM Alerts WHERE Active = '1' AND System = '".$Session->{'usrSystem' +}."' AND Account = '".$Session->{'usrAccoun +t'}."';"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS->Open($sql, $Conn); if ($RS) { while(!$RS->EOF()) { my $idAlert = $RS->Fields('idAlert')->{Val +ue}; my $startDate = $RS->Fields('startDate')-> +{Value}; my $endDate = $RS->Fields('endDate')->{Val +ue}; my $title = $RS->Fields('title')->{Value}; my $body = $RS->Fields('body')->{Value}; $doc->startTag("alert", id => "$idAlert", +startDate => "$startDate", endDate => "$endDate"); $doc->dataElement(title => "$title"); $doc->dataElement(body => "$body"); $doc->endTag(); # close alert $doc->end(); # final checks $RS->MoveNext(); } #end while(!$RS->EOF()) $XMLval .= $string->value()."</accountAlerts>" +; $RS->Close(); my $sql = "UPDATE XMLFileData SET Active='0' WHERE Path='Alerts' AND FileName='$fileacct';"; $RS = $Conn->Execute($sql); $writeSQL++; } #end if ($RS) if ($writeSQL) { my $sql = "INSERT INTO XMLFileData (Active, LastModify, Path, FileName, B +ody) VALUES ('1', {fn NOW()}, 'Alerts', '$fileacct +', '$XMLval')"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS = $Conn->Execute($sql); } #end if ($writeSQL) } #end switch 2 $str .= shadowBox($title, $content, $boxWidth); last SWITCH; } #end if ($Request->item("View")->item() eq "EditAlerts") } #end if ($Session->{'usrClass'} == 3) #### If usrClass = 6 #### if ($Session->{'usrClass'} == 6) { #### Edit Alerts #### if ($Request->item("View")->item() eq "EditAlerts") { my $content = ""; my $title = ""; SWITCH: { ################### Action View ################### if ($Request->item("Action")->item() eq "View") { my $sql = "SELECT idAlert, Submitter, Modifier, LastModified, Active, System, Account, startDate, endDate, title, body, idOrder FROM Alerts WHERE System = '".$Session->{'usrS +ystem'}."' AND Account = '".$Session->{'usrSy +stem'}."' AND Active = '1' AND idAlert='".$Request->item("Ale +rtID")->item()."';"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS->Open($sql, $Conn); if ($RS) { $title = $RS->Fields('title')->{Value}; while(!$RS->EOF()) { my $account = $RS->Fields('Account')-> +{Value}; if (!$account){$account = "All";} $content = "<alert id=\"".$RS->Fields( +'idAlert')->{Value}."\" submitter=\"".$RS->Fields('Submitter') +->{Value}."\" modifier=\"".$RS->Fields('Modifier')-> +{Value}."\" lastModified=\"".$RS->Fields('LastModi +fied')->{Value}."\" active=\"".$RS->Fields('Active')->{Val +ue}."\" system=\"".$RS->Fields('System')->{Val +ue}."\" account=\"".$account."\" startDate=\"".$RS->Fields('startDate') +->{Value}."\" endDate=\"".$RS->Fields('endDate')->{V +alue}."\" title=\"".$RS->Fields('title')->{Value +}."\" idOrder=\"".$RS->Fields('idOrder')->{V +alue}."\"> <![CDATA[".$RS->Fields('body')->{Value +}."]]> </alert>"; $RS->MoveNext(); } #end while(!$RS->EOF()) $RS->Close(); $content .= "<acts>".getSystemAccounts("SEF"). +"</acts>"; } #end if ($RS) last SWITCH; } #end if ($Request->item("Action")->item() eq "Vi +ew") ################### Action Copy ################### if ($Request->item("Action")->item() eq "Copy") { my $sql = "SELECT idAlert, Submitter, Modifier, LastModified, Active, System, Account, startDate, endDate, title, body, idOrder FROM Alerts WHERE System = '".$Session->{' +usrSystem'}."' AND Account = '".$Session->{'u +srSystem'}."' AND Active = '1' AND idAlert='".$Request->item( +"AlertID")->item()."';"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS->Open($sql, $Conn); if ($RS) { $title = "Create New Alert"; while(!$RS->EOF()) { my $account = $RS->Fields('Account')-> +{Value}; if (!$account){$account = "All";} $content = "<AlertForm method=\"POST\" + action=\"$Session->{'this'}\" id=\"AlertForm\" submit=\"Add\">"; $content .= "<inputH name=\"Tab\" valu +e=\"Admin\"/>"; $content .= "<inputH name=\"View\" val +ue=\"EditAlerts\"/>"; $content .= "<inputH name=\"Action\" v +alue=\"Add\"/>"; $content .= "<txtSystem label=\"System +:\">".$RS->Fields('System')->{Value}."</txtSystem>"; $content .= "<txtAccount label=\"Accou +nt:\">".$RS->Fields('Account')->{Value}."</txtAccount>"; $content .= "<txtstartDate label=\"Sta +rt Date:\">".$RS->Fields('startDate')->{Value}."</txtstartDate>"; $content .= "<txtendDate label=\"End D +ate:\">".$RS->Fields('endDate')->{Value}."</txtendDate>"; $content .= "<txttitle label=\"Title:\ +">".$RS->Fields('title')->{Value}."</txttitle>"; $content .= "<txtbody label=\"Body:\"> +<![CDATA[".$RS->Fields('body')->{Value}."]]></txtbody>"; $content .= "<txtidOrder label=\"Order +:\">".$RS->Fields('idOrder')->{Value}."</txtidOrder>"; $content .= "</AlertForm>"; $RS->MoveNext(); } #end while(!$RS->EOF()) $RS->Close(); } #end if ($RS) last SWITCH; } #end if ($Request->item("Action")->item() eq "Co +py") ################### Action New ################### if ($Request->item("Action")->item() eq "New") { $title = "Create New Alert"; $content = "<AlertForm method=\"POST\" action= +\"$Session->{'this'}\" id=\"AlertForm\" submit=\"Add\">"; $content .= "<inputH name=\"Tab\" value=\"Admi +n\"/>"; $content .= "<inputH name=\"View\" value=\"Edi +tAlerts\"/>"; $content .= "<inputH name=\"Action\" value=\"A +dd\"/>"; $content .= "<txtSystem label=\"System:\"></tx +tSystem>"; $content .= "<txtAccount label=\"Account:\"></ +txtAccount>"; $content .= "<txtstartDate label=\"Start Date: +\"></txtstartDate>"; $content .= "<txtendDate label=\"End Date:\">< +/txtendDate>"; $content .= "<txttitle label=\"Title:\"></txtt +itle>"; $content .= "<txtbody label=\"Body:\"></txtbod +y>"; $content .= "<txtidOrder label=\"Order:\"></tx +tidOrder>"; $content .= "</AlertForm>"; last SWITCH; } #end if ($Request->item("Action")->item() eq "Ne +w") ################### Action Modify ################### if ($Request->item("Action")->item() eq "Modify") { my $sql = "SELECT idAlert, Submitter, Modifier, LastModified, Active, System, Account, startDate, endDate, title, body, idOrder FROM Alerts WHERE System = '".$Session->{'usrS +ystem'}."' AND Account = '".$Session->{'usrSy +stem'}."' AND Active = '1' AND idAlert='".$Request->item("Ale +rtID")->item()."';"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS->Open($sql, $Conn); if ($RS) { $title = "Modify Alert \#".$Request->item( +"AlertID")->item()." (".$RS->Fields('title')->{Value}.")"; my $account = $RS->Fields('Account')->{Val +ue}; if (!$account){$account = "All";} $content = "<AlertForm method=\"POST\" act +ion=\"$Session->{'this'}\" id=\"AlertForm\" submit=\"Modify\">"; $content .= "<inputH name=\"Tab\" value=\" +Admin\"/>"; $content .= "<inputH name=\"View\" value=\ +"EditAlerts\"/>"; $content .= "<inputH name=\"Action\" value +=\"Update\"/>"; $content .= "<inputH name=\"AlertID\" valu +e=\"".$RS->Fields('idAlert')->{Value}."\"/>"; $content .= "<txtSystem label=\"System:\"> +".$RS->Fields('System')->{Value}."</txtSystem>"; $content .= "<txtAccount label=\"Account:\ +">".$RS->Fields('Account')->{Value}."</txtAccount>"; $content .= "<txtstartDate label=\"Start D +ate:\">".$RS->Fields('startDate')->{Value}."</txtstartDate>"; $content .= "<txtendDate label=\"End Date: +\">".$RS->Fields('endDate')->{Value}."</txtendDate>"; $content .= "<txttitle label=\"Title:\">". +$RS->Fields('title')->{Value}."</txttitle>"; $content .= "<txtbody label=\"Body:\"><![C +DATA[".$RS->Fields('body')->{Value}."]]></txtbody>"; $content .= "<txtidOrder label=\"Order:\"> +".$RS->Fields('idOrder')->{Value}."</txtidOrder>"; $content .= "</AlertForm>"; $RS->Close(); } #end if ($RS) last SWITCH; } #end if ($Request->item("Action")->item() eq "Mo +dify") ################### Action RemoveConfirm ############# +###### if ($Request->item("Action")->item() eq "RemoveCon +firm") { $title = "Remove Alert Confirmation"; $content = "<![CDATA[<table width=\"100%\" bor +der=\"0\" cellpadding=\"0\" cellspacing=\"0\"> <tr> <td>Are you sure you want to +Remove this Alert?</td> <td><a href=\"".$Session->{'t +his'}."?Tab=".$Request->item("Tab")->item()."&View=".$Request->item(" +View")->item()."&Action=".Remove."&AlertID=".$Request->item("AlertID" +)->item()."\">Yes</a></td> <td><a href=\"".$Session->{'t +his'}."?Tab=".$Request->item("Tab")->item()."&View=".$Request->item(" +View")->item()."\">No</a></td> </tr> </table>]]>"; last SWITCH; } #end if ($Request->item("Action")->item() eq "Re +moveConfirm") ################### Action Remove ################### if ($Request->item("Action")->item() eq "Remove") { my $sql = "UPDATE Alerts SET Active = '0', Modifier = '".$Session->{'usrID'}. +"', LastModified = { fn NOW() } WHERE (Active = '1') AND (idAlert = '".$Request->item("Aler +tID")->item()."') AND (System = '".$Session->{'usrSystem +'}."') AND (Account = '".$Session->{'usrSyste +m'}."';"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS = $Conn->Execute($sql); } #end if ($Request->item("Action")->item() eq "Re +move") ################### Action Add ################### if ($Request->item("Action")->item() eq "Add") { my $sql = "INSERT INTO Alerts (Submitter, Modifier, LastModified +, Active, System, Account, startDate, endDate, title, body, idOrder, +Viewable) VALUES ('".$Session->{'usrID'}."', '".$Session->{'usrID'}."', { fn NOW() }, 1, '".$Session->{'usrSystem'}."', '".$Session->{'usrSystem'}."', '".$Request->item("txtstartDate")- +>item()."', '".$Request->item("txtendDate")->i +tem()."', '".$Request->item("txttitle")->ite +m()."', '".$Request->item("txtbody")->item +()."', '".$Request->item("txtidOrder")->i +tem()."', 1);"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS = $Conn->Execute($sql); } #end if ($Request->item("Action")->item() eq "Ad +d") ################### Action Update ################### if ($Request->item("Action")->item() eq "Update") { my $sql = "UPDATE Alerts SET Modifier = '".$Session->{'usrI +D'}."', LastModified = { fn NOW() }, title ='".$Request->item("txttitle +")->item()."', startDate ='".$Request->item("txts +tartDate")->item()."', endDate ='".$Request->item("txtend +Date")->item()."', body ='".$Request->item("txtbody") +->item()."', idOrder ='".$Request->item("txtidO +rder")->item()."' WHERE (Active = '1') AND (idAlert = '".$Request->item("Aler +tID")->item()."') AND (System = '".$Session->{'usrSystem +'}."') AND (Account = '".$Session->{'usrSyste +m'}."');"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS = $Conn->Execute($sql); } #if ($Request->item("Action")->item() eq "Update +") ################### INITIAL ALERT SCREEN ############# +###### my $sql = "SELECT idAlert, Submitter, Modifier, LastModified, Active, System, Account, startDate, endDate, title, body, idOrder FROM Alerts WHERE (Active = '1') AND (System = '".$Session->{'usrSystem'}." +') AND (Account = '".$Session->{'usrSystem'}. +"');"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS->Open($sql, $Conn); $title = "System Alerts"; $content = "<alerts>"; if ($RS) { while(!$RS->EOF()) { my $account = $RS->Fields('Account')->{Val +ue}; if (!$account){$account = "All";} $content .= "<alert id=\"".$RS->Fields('id +Alert')->{Value}."\" submitter=\"".$RS->Fields('Submitter') +->{Value}."\" modifier=\"".$RS->Fields('Modifier')-> +{Value}."\" lastModified=\"".$RS->Fields('LastModi +fied')->{Value}."\" active=\"".$RS->Fields('Active')->{Val +ue}."\" system=\"".$RS->Fields('System')->{Val +ue}."\" account=\"".$account."\" startDate=\"".$RS->Fields('startDate') +->{Value}."\" endDate=\"".$RS->Fields('endDate')->{V +alue}."\" title=\"".$RS->Fields('title')->{Value +}."\" idOrder=\"".$RS->Fields('idOrder')->{V +alue}."\"> <![CDATA[".$RS->Fields('body')->{Value +}."]]> </alert>"; $RS->MoveNext(); } #end while(!$RS->EOF()) $RS->Close(); } #end if ($RS) $content .= "</alerts>"; use XML::Writer; use XML::Writer::String; my $string = XML::Writer::String->new(); my $doc = new XML::Writer(OUTPUT => $string, DATA_ +MODE =>1, DATA_INDENT =>2); my $writeSQL = 0; my $filesys = $Session->{'usrSystem'}.".xml"; my $XMLval = "<systemAlerts>"; my $sql = "SELECT idAlert, startDate, endDate, title, body FROM Alerts WHERE Active = '1' AND System = '".$Session->{'usrSys +tem'}."' AND Account = '".$Session->{'usrSy +stem'}."';"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS->Open($sql, $Conn); if ($RS) { while(!$RS->EOF()) { my $idAlert = $RS->Fields('idAlert')->{Val +ue}; my $startDate = $RS->Fields('startDate')-> +{Value}; my $endDate = $RS->Fields('endDate')->{Val +ue}; my $title = $RS->Fields('title')->{Value}; my $body = $RS->Fields('body')->{Value}; $doc->startTag("alert", id => "$idAlert", +startDate => "$startDate", endDate => "$endDate"); $doc->dataElement(title => "$title"); $doc->dataElement(body => "$body"); $doc->endTag(); # close alert $doc->end(); # final checks $RS->MoveNext(); } #end while(!$RS->EOF()) $XMLval .= $string->value()."</systemAlerts>"; $RS->Close(); my $sql = "UPDATE XMLFileData SET Active='0' WHERE Path='Alerts' AND FileName='$filesys';"; $RS = $Conn->Execute($sql); $writeSQL++; } #end if ($RS) if ($writeSQL) { my $sql = "INSERT INTO XMLFileData (Active, LastModify, Path, FileName, B +ody) VALUES ('1', {fn NOW()}, 'Alerts', '$filesys' +, '$XMLval')"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS = $Conn->Execute($sql); } #end if ($writeSQL) } #end switch 2 $str .= shadowBox($title, $content, $boxWidth); last SWITCH; } #end if ($Request->item("View")->item() eq "EditAlerts") } #end if ($Session->{'usrClass'} == 6) #### if usrClass = 10 #### if ($Session->{'usrClass'} == 10) { #### Edit Alerts #### if ($Request->item("View")->item() eq "EditAlerts") { my $content = ""; my $title = ""; SWITCH: { ################### Action View ################### if ($Request->item("Action")->item() eq "View") { my $sql = "SELECT idAlert, Submitter, Modifier, LastModified, Active, System, Account, startDate, endDate, title, body, idOrder, Viewable FROM Alerts WHERE System = 'ALL' AND Account = 'ALL' AND Active = '1' AND idAlert='".$Request->item("Ale +rtID")->item()."';"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS->Open($sql, $Conn); if ($RS) { $title = $RS->Fields('title')->{Value}; while(!$RS->EOF()) { my $account = "ALL"; my $system = "ALL"; $content = "<alert id=\"".$RS->Fields( +'idAlert')->{Value}."\" submitter=\"".$RS->Fields('Submitter') +->{Value}."\" modifier=\"".$RS->Fields('Modifier')-> +{Value}."\" lastModified=\"".$RS->Fields('LastModi +fied')->{Value}."\" active=\"".$RS->Fields('Active')->{Val +ue}."\" system=\"".$RS->Fields('System')->{Val +ue}."\" account=\"".$account."\" startDate=\"".$RS->Fields('startDate') +->{Value}."\" endDate=\"".$RS->Fields('endDate')->{V +alue}."\" title=\"".$RS->Fields('title')->{Value +}."\" idOrder=\"".$RS->Fields('idOrder')->{V +alue}."\" viewable=\"".$RS->Fields('Viewable')-> +{Value}."\"> <![CDATA[".$RS->Fields('body')->{Value +}."]]> </alert>"; $RS->MoveNext(); } #end while(!$RS->EOF()) $RS->Close(); $content .= "<acts>".getSystemAccounts("SEF"). +"</acts>"; } #end if ($RS) last SWITCH; } #end if ($Request->item("Action")->item() eq "Vi +ew") ################### Action Copy ################### if ($Request->item("Action")->item() eq "Copy") { my $sql = "SELECT idAlert, Submitter, Modifier, LastModified, Active, System, Account, startDate, endDate, title, body, idOrder, Viewable FROM Alerts WHERE System = 'ALL' AND Account = 'ALL' AND Active = '1' AND idAlert='".$Request->item( +"AlertID")->item()."';"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS->Open($sql, $Conn); if ($RS) { $title = "Create New Alert"; while(!$RS->EOF()) { my $account = "ALL"; my $system = "ALL"; $content = "<AlertForm method=\"POST\" + action=\"$Session->{'this'}\" id=\"AlertForm\" submit=\"Add\">"; $content .= "<inputH name=\"Tab\" valu +e=\"Admin\"/>"; $content .= "<inputH name=\"View\" val +ue=\"EditAlerts\"/>"; $content .= "<inputH name=\"Action\" v +alue=\"Add\"/>"; $content .= "<txtSystem label=\"System +:\">".$RS->Fields('System')->{Value}."</txtSystem>"; $content .= "<txtAccount label=\"Accou +nt:\">".$RS->Fields('Account')->{Value}."</txtAccount>"; $content .= "<txtstartDate label=\"Sta +rt Date:\">".$RS->Fields('startDate')->{Value}."</txtstartDate>"; $content .= "<txtendDate label=\"End D +ate:\">".$RS->Fields('endDate')->{Value}."</txtendDate>"; $content .= "<txttitle label=\"Title:\ +"><![CDATA[".$RS->Fields('title')->{Value}."]]></txttitle>"; $content .= "<txtbody label=\"Body:\"> +<![CDATA[".$RS->Fields('body')->{Value}."]]></txtbody>"; $content .= "<txtViewable label=\"View +able:\">".$RS->Fields('Viewable')->{Value}."</txtViewable>"; $content .= "<txtidOrder label=\"Order +:\">".$RS->Fields('idOrder')->{Value}."</txtidOrder>"; $content .= "</AlertForm>"; $RS->MoveNext(); } #end while(!$RS->EOF()) $RS->Close(); } #end if ($RS) last SWITCH; } #end if ($Request->item("Action")->item() eq "Co +py") ################### Action New ################### if ($Request->item("Action")->item() eq "New") { $title = "Create New Alert"; $content = "<AlertForm method=\"POST\" action= +\"$Session->{'this'}\" id=\"AlertForm\" submit=\"Add\">"; $content .= "<inputH name=\"Tab\" value=\"Admi +n\"/>"; $content .= "<inputH name=\"View\" value=\"Edi +tAlerts\"/>"; $content .= "<inputH name=\"Action\" value=\"A +dd\"/>"; $content .= "<txtSystem label=\"System:\"></tx +tSystem>"; $content .= "<txtAccount label=\"Account:\"></ +txtAccount>"; $content .= "<txtstartDate label=\"Start Date: +\"></txtstartDate>"; $content .= "<txtendDate label=\"End Date:\">< +/txtendDate>"; $content .= "<txttitle label=\"Title:\"></txtt +itle>"; $content .= "<txtbody label=\"Body:\"></txtbod +y>"; $content .= "<txtViewable label=\"Viewable:\"> +</txtViewable>"; $content .= "<txtidOrder label=\"Order:\"></tx +tidOrder>"; $content .= "</AlertForm>"; last SWITCH; } #end if ($Request->item("Action")->item() eq "Ne +w") ################### Action Modify ################### if ($Request->item("Action")->item() eq "Modify") { my $sql = "SELECT idAlert, Submitter, Modifier, LastModified, Active, System, Account, startDate, endDate, title, body, idOrder, Viewable FROM Alerts WHERE System = 'ALL' AND Account = 'ALL' AND Active = '1' AND idAlert='".$Request->item("Ale +rtID")->item()."';"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS->Open($sql, $Conn); if ($RS) { $title = "Modify Alert \#".$Request->item( +"AlertID")->item()." (".$RS->Fields('title')->{Value}.")"; my $account = "ALL"; my $system = "ALL"; $content = "<AlertForm method=\"POST\" act +ion=\"$Session->{'this'}\" id=\"AlertForm\" submit=\"Modify\">"; $content .= "<inputH name=\"Tab\" value=\" +Admin\"/>"; $content .= "<inputH name=\"View\" value=\ +"EditAlerts\"/>"; $content .= "<inputH name=\"Action\" value +=\"Update\"/>"; $content .= "<inputH name=\"AlertID\" valu +e=\"".$RS->Fields('idAlert')->{Value}."\"/>"; $content .= "<txtSystem label=\"System:\"> +".$RS->Fields('System')->{Value}."</txtSystem>"; $content .= "<txtAccount label=\"Account:\ +">".$RS->Fields('Account')->{Value}."</txtAccount>"; $content .= "<txtstartDate label=\"Start D +ate:\">".$RS->Fields('startDate')->{Value}."</txtstartDate>"; $content .= "<txtendDate label=\"End Date: +\">".$RS->Fields('endDate')->{Value}."</txtendDate>"; $content .= "<txttitle label=\"Title:\"><! +[CDATA[".$RS->Fields('title')->{Value}."]]></txttitle>"; $content .= "<txtbody label=\"Body:\"><![C +DATA[".$RS->Fields('body')->{Value}."]]></txtbody>"; $content .= "<txtViewable label=\"Viewable +:\">".$RS->Fields('Viewable')->{Value}."</txtViewable>"; $content .= "<txtidOrder label=\"Order:\"> +".$RS->Fields('idOrder')->{Value}."</txtidOrder>"; $content .= "</AlertForm>"; $RS->Close(); } #end if ($RS) last SWITCH; } #end if ($Request->item("Action")->item() eq "Mo +dify") ################### Action RemoveConfirm ############# +###### if ($Request->item("Action")->item() eq "RemoveCon +firm") { $title = "Remove Alert Confirmation"; $content = "<![CDATA[<table width=\"100%\" bor +der=\"0\" cellpadding=\"0\" cellspacing=\"0\"> <tr> <td>Are you sure you want to +Remove this Alert?</td> <td><a href=\"".$Session->{'t +his'}."?Tab=".$Request->item("Tab")->item()."&View=".$Request->item(" +View")->item()."&Action=".Remove."&AlertID=".$Request->item("AlertID" +)->item()."\">Yes</a></td> <td><a href=\"".$Session->{'t +his'}."?Tab=".$Request->item("Tab")->item()."&View=".$Request->item(" +View")->item()."\">No</a></td> </tr> </table>]]>"; last SWITCH; } #end if ($Request->item("Action")->item() eq "Re +moveConfirm") ################### Action Remove ################### if ($Request->item("Action")->item() eq "Remove") { my $sql = "UPDATE Alerts SET Active = '0', Modifier = '".$Session->{'usrID'}. +"', LastModified = { fn NOW() } WHERE (Active = '1') AND (idAlert = '".$Request->item("Aler +tID")->item()."') AND (System = 'ALL') AND (Account = 'ALL';"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS = $Conn->Execute($sql); } #end if ($Request->item("Action")->item() eq "Re +move") ################### Action Add ################### if ($Request->item("Action")->item() eq "Add") { my $sql = "INSERT INTO Alerts (Submitter, Modifier, LastModified +, Active, System, Account, startDate, endDate, title, body, idOrder, +Viewable) VALUES ('".$Session->{'usrID'}."', '".$Session->{'usrID'}."', { fn NOW() }, 1, 'ALL', 'ALL', '".$Request->item("txtstartDate")- +>item()."', '".$Request->item("txtendDate")->i +tem()."', '".$Request->item("txttitle")->ite +m()."', '".$Request->item("txtbody")->item +()."', '".$Request->item("txtidOrder")->i +tem()."', 1);"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS = $Conn->Execute($sql); } #end if ($Request->item("Action")->item() eq "Ad +d") ################### Action Update ################### if ($Request->item("Action")->item() eq "Update") { my $sql = "UPDATE Alerts SET Modifier = '".$Session->{'usrI +D'}."', LastModified = { fn NOW() }, title ='".$Request->item("txttitle +")->item()."', startDate ='".$Request->item("txts +tartDate")->item()."', endDate ='".$Request->item("txtend +Date")->item()."', body ='".$Request->item("txtbody") +->item()."', idOrder ='".$Request->item("txtidO +rder")->item()."', Viewable ='".$Request->item("txtVi +ewable")->item()."' WHERE (Active = '1') AND (idAlert = '".$Request->item("Aler +tID")->item()."') AND (System = 'ALL') AND (Account = 'ALL');"; + if ($Session->{'trackDB'}){lg("DB","$sql");} $RS = $Conn->Execute($sql); } #if ($Request->item("Action")->item() eq "Update +") ################### INITIAL ALERT SCREEN ############# +###### my $Conn = CreateObject OLE "ADODB.Connection"; $Conn->Open("PROVIDER=SQLOLEDB;DATA SOURCE=$Sessio +n->{'sqlServer'};UID=$Session->{'sqlUser'};PWD=$Session->{'sqlPass'}; +DATABASE=$Session->{'dbName'}"); my $RS = $Server->CreateObject("ADODB.Recordset"); + my $sql = "SELECT idAlert, Submitter, Modifier, LastModified, Active, System, Account, startDate, endDate, title, body, idOrder, Viewable FROM Alerts WHERE (Active = '1') AND (System = 'ALL') AND (Account = 'ALL');"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS->Open($sql, $Conn); $title = "Global Alerts"; $content = "<alerts>"; if ($RS) { while(!$RS->EOF()) { my $account = "ALL"; my $system = "ALL"; $content .= "<alert id=\"".$RS->Fields('id +Alert')->{Value}."\" submitter=\"".$RS->Fields('Submitter') +->{Value}."\" modifier=\"".$RS->Fields('Modifier')-> +{Value}."\" lastModified=\"".$RS->Fields('LastModi +fied')->{Value}."\" active=\"".$RS->Fields('Active')->{Val +ue}."\" system=\"".$system."\" account=\"".$account."\" startDate=\"".$RS->Fields('startDate') +->{Value}."\" endDate=\"".$RS->Fields('endDate')->{V +alue}."\" title=\"".$RS->Fields('title')->{Value +}."\" idOrder=\"".$RS->Fields('idOrder')->{V +alue}."\" viewable=\"".$RS->Fields('Viewable')-> +{Value}."\"> <![CDATA[".$RS->Fields('body')->{Value +}."]]> </alert>"; $RS->MoveNext(); } #end while(!$RS->EOF()) $RS->Close(); } #end if ($RS) $content .= "</alerts>"; use XML::Writer; use XML::Writer::String; my $string = XML::Writer::String->new(); my $doc = new XML::Writer(OUTPUT => $string, DATA_ +MODE =>1, DATA_INDENT =>2); my $writeSQL = 0; my $fileglob = "all.xml"; my $XMLval = "<globalAlerts>"; my $sql = "SELECT idAlert, startDate, endDate, title, body, Viewable FROM Alerts WHERE Active = '1' AND System = 'ALL' AND Account = 'ALL';"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS->Open($sql, $Conn); if ($RS) { while(!$RS->EOF()) { my $idAlert = $RS->Fields('idAlert')->{Val +ue}; my $startDate = $RS->Fields('startDate')-> +{Value}; my $endDate = $RS->Fields('endDate')->{Val +ue}; my $title = $RS->Fields('title')->{Value}; my $body = $RS->Fields('body')->{Value}; my $Viewable = $RS->Fields('Viewable')->{V +alue}; $doc->startTag("alert", id => "$idAlert", +startDate => "$startDate", endDate => "$endDate", viewable => "$Viewa +ble"); $doc->dataElement(title => "$title"); $doc->dataElement(body => "$body"); $doc->endTag(); # close alert $doc->end(); # final checks $RS->MoveNext(); } #end while(!$RS->EOF()) $XMLval .= $string->value()."</globalAlerts>"; $RS->Close(); my $sql = "UPDATE XMLFileData SET Active='0' WHERE Path='Alerts' AND FileName='$fileglob';"; $RS = $Conn->Execute($sql); $writeSQL++; } #end if ($RS) if ($writeSQL) { my $sql = "INSERT INTO XMLFileData (Active, LastModify, Path, FileName, B +ody) VALUES ('1', {fn NOW()}, 'Alerts', '$fileglob +', '$XMLval')"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS = $Conn->Execute($sql); } #end if ($writeSQL) } #end switch 2 $str .= shadowBox($title, $content, $boxWidth); last SWITCH; } #end if ($Request->item("View")->item() eq "EditAlerts") + } #end if ($Session->{'usrClass'} == 10) } #end switch 1 } $Conn->Close; $str .= ""; return $str; } #end sub mAdmin </script>

      Bareword "Cancel" not allowed while "strict subs" in use at (eval 2) line 3618.

      I see no "Cancel" anywhere in that code. Nor, for that matter, any "strict".

      Seems to me that's not the code giving you trouble. Look again?

      print "Just another Perl ${\(trickster and hacker)},"
      The Sidhekin proves Sidhe did it!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://648925]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2014-08-30 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (291 votes), past polls