Hello mason-users,

I am new to mason and sorta  mostly new to perl as well. I wrote a  
perl script to get and return some things from a CLI program and that  
works. I am now having problems getting it to work with mason. I am  
sure the code could be WAY better, but I would appreciate some help  
nonetheless.  The problem is in the code below. I have also included  
the error messages that get returned.


<%ARGS>
$macAddr
</%ARGS>
<TD><B>MACADDR:<% $macAddr %></B></TD>
%my %nops=('server' => '64.184.141.92','user' => 'username',  
'password' => 'thePassword');
%my @ip_Info;
%# Get the MAC Address from RT#
%#my $macAddr="00:15:A2:78:9F:9B"; #to be pulled from RT

%# remove ":" from MAC address so that we can use it in the Incognito  
CLI. There is probably a faster way to do this, but
%# this works.
%while($macAddr =~ m/:/){
         $macAddr =~ s/://;
         $macAddr =~ tr/[A-Z]/[a-z]/;
%}

%# Get the Basic Modem information from Incognito #
%my @ipInfo = `/opt/rt3/share/html/NoAuth/finger/ipcli -S xxx.xxx.xxx. 
92 -N username -P thePassword list search lease remoteid $macAddr`;


%# Print out the modem information from Incognito as a table
%<table border=1><tr>
%foreach my $ipdata (@ipInfo){
         @splitIP=split(':',$ipdata);
         foreach my $splitdata (@splitIP){
                 if ($splitdata =~ "172" || $splitdata =~ "66" ||  
$splitdata =~ "24" ||$splitdata =~ "10"){
                         <TD><A HREF=/finger/><% $splitdata %></A></TD>
                 }
                 else{
                        <TD><% $splitdata %></TD>
                 }
         }
         </tr><tr>
%}
</table>

%# Get the Internal IP of the Cable modem and return only the IP so we  
can use it in our next Incognito action
%my $my_ip=$ipInfo[1];
%#my $length_my_ip = length ($my_ip);
%$my_ip=substr($my_ip,12,15);

%# Get SNMP information from the Cable Modem based on the Internal IP  
address
%my @snmpInfo = `/opt/rt3/share/html/NoAuth/finger/ipcli -S  
64.184.141.92 -N gevans -P 199xt53b show lease $my_ip`;

%# Print a Table of all of the information that the SNMP query returns
<TABLE border=1><tr>
%foreach my $snmpdata (@snmpInfo){
%#      #split the returned results so that we can create a table. We are  
splitting on ":"
         @splitInfo= split(':',$snmpdata,2);
                 foreach my $snmpsplitdata (@splitInfo){
%#                              # Certain information should be on the  
right side of the table and not the left.
%#                              # Check to see if it is this  
information and move it one cell to the right.
                                 if ($snmpsplitdata =~ "Record Added"){
                                 <TD></TD><TD><% $snmpsplitdata %></TD>
                                 }
%#                              #
%#                              # Some sections that are returned  
contain up to 4 items and we have to define each one and plan for it
%#                              # separately. There is probably an  
easier way to do this, but we will create an elseif for each case
%#                              # for now. If we learn how to do it  
better later we will fix it.
%#                              #
%#                              #
%#                              #Put the in the correct column
                                 else{
                                        <TD><% $snmpsplitdata %></TD>
                                 }
                }
         </tr><tr>
%}
</table>
--end mason file

Error:

error:  Error during compilation of /opt/rt3/share/html/NoAuth/finger/ 
m_incognito:
String found where operator expected at /opt/rt3/share/html/NoAuth/ 
finger/m_incognito line 36, near "$m->print( $m->interp- 
 >apply_escapes( (join '', ( $splitdata )), '"
(Missing operator before ', ( $splitdata )), '?)
Bad name after h' at /opt/rt3/share/html/NoAuth/finger/m_incognito  
line 36.

Stack:
[/opt/rt3/share/html/NoAuth/finger/m_incognito:36]
[/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Interp.pm:811]
[/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Interp.pm:441]
[/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm:245]
[/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm:210]
[/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ApacheHandler.pm:97]
[/usr/lib/perl5/site_perl/5.8.8/Class/Container.pm:275]
[/usr/lib/perl5/site_perl/5.8.8/Class/Container.pm:353]
[/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Interp.pm:348]
[/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ApacheHandler.pm:868]
[/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ApacheHandler.pm:822]
[/opt/rt3/bin/webmux.pl:125]
[/opt/rt3/share/html/NoAuth/finger/m_incognito:36]

context:        
...     
32:      foreach my $splitdata (@splitIP){
33:      if ($splitdata =~ "172" || $splitdata =~ "66" || $splitdata =~  
"24" ||$splitdata =~ "10"){
34:      <TD><A HREF=/finger/><% $splitdata %></A></TD>
35:      }
36:      else{
37:      <TD><% $splitdata %></TD>
38:      }
39:      }
40:      </tr><tr>
...     
code stack:      /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Interp.pm:445
/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm:245
/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm:210
/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ApacheHandler.pm:97
/usr/lib/perl5/site_perl/5.8.8/Class/Container.pm:275
/usr/lib/perl5/site_perl/5.8.8/Class/Container.pm:353
/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Interp.pm:348
/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ApacheHandler.pm:868
/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ApacheHandler.pm:822
/opt/rt3/bin/webmux.pl:125
-e:0


---RAW Error---
Trace begun at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Interp.pm  
line 845
HTML 
::Mason 
::Interp::_compilation_error('HTML::Mason::Interp=HASH(0x90e9bf0)', '/ 
opt/rt3/share/html/NoAuth/finger/m_incognito', 'Error during  
compilation of :^JString found where operator expected at /opt/rt3/ 
share/html/NoAuth/finger/m_incognito line 36, near "$m->print( $m- 
 >interp->apply_escapes( (join \'\', ( $splitdata )), \'"^J^I(Missing  
operator before \', ( $splitdata )), \'?)^JBad name after h\' at /opt/ 
rt3/share/html/NoAuth/finger/m_incognito line 36.^J^JStack:^J  [/opt/ 
rt3/share/html/NoAuth/finger/m_incognito:36]^J  [/usr/lib/perl5/ 
site_perl/5.8.8/HTML/Mason/Interp.pm:811]^J  [/usr/lib/perl5/site_perl/ 
5.8.8/HTML/Mason/Interp.pm:441]^J  [/usr/lib/perl5/site_perl/5.8.8/ 
HTML/Mason/Request.pm:245]^J  [/usr/lib/perl5/site_perl/5.8.8/HTML/ 
Mason/Request.pm:210]^J  [/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ 
ApacheHandler.pm:97]^J  [/usr/lib/perl5/site_perl/5.8.8/Class/ 
Container.pm:275]^J  [/usr/lib/perl5/site_perl/5.8.8/Class/ 
Container.pm:353]^J  [/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ 
Interp.pm:348]^J  [/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ 
ApacheHandler.pm:868]^J  [/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ 
ApacheHandler.pm:822]^J  [/opt/rt3/bin/webmux.pl:125]^J  [/opt/rt3/ 
share/html/NoAuth/finger/m_incognito:36]^J^J^JStack:^J  [/usr/lib/ 
perl5/site_perl/5.8.8/HTML/Mason/Interp.pm:441]^J  [/usr/lib/perl5/ 
site_perl/5.8.8/HTML/Mason/Request.pm:245]^J  [/usr/lib/perl5/ 
site_perl/5.8.8/HTML/Mason/Request.pm:210]^J  [/usr/lib/perl5/ 
site_perl/5.8.8/HTML/Mason/ApacheHandler.pm:97]^J  [/usr/lib/perl5/ 
site_perl/5.8.8/Class/Container.pm:275]^J  [/usr/lib/perl5/site_perl/ 
5.8.8/Class/Container.pm:353]^J  [/usr/lib/perl5/site_perl/5.8.8/HTML/ 
Mason/Interp.pm:348]^J  [/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ 
ApacheHandler.pm:868]^J  [/usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ 
ApacheHandler.pm:822]^J  [/opt/rt3/bin/webmux.pl:125]^J  [-e:0]^J')  
called at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Interp.pm line 445
HTML::Mason::Interp::load('HTML::Mason::Interp=HASH(0x90e9bf0)', '/ 
NoAuth/finger/m_incognito') called at /usr/lib/perl5/site_perl/5.8.8/ 
HTML/Mason/Request.pm line 245
eval {...} at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm  
line 230
HTML 
::Mason 
::Request 
::_initialize('HTML::Mason::Request::ApacheHandler=HASH(0xa451f74)')  
called at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/Request.pm line 210
HTML::Mason::Request::new('HTML::Mason::Request::ApacheHandler',  
'error_mode', 'output', 'autoflush', 0, 'error_format', 'html',  
'interp', 'HTML::Mason::Interp=HASH(0x90e9bf0)', 'comp', '/NoAuth/ 
finger/m_incognito', 'args', 'ARRAY(0xa44e594)', 'ah',  
'HTML::Mason::ApacheHandler=HASH(0x968961c)', 'apache_req',  
'Apache2::RequestRec=SCALAR(0xa480e3c)', 'container',  
'HASH(0xa458bec)') called at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ 
ApacheHandler.pm line 97
HTML 
::Mason 
::Request::ApacheHandler::new('HTML::Mason::Request::ApacheHandler',  
'error_mode', 'output', 'autoflush', 0, 'error_format', 'html',  
'interp', 'HTML::Mason::Interp=HASH(0x90e9bf0)', 'comp', '/NoAuth/ 
finger/m_incognito', 'args', 'ARRAY(0xa44e594)', 'ah',  
'HTML::Mason::ApacheHandler=HASH(0x968961c)', 'apache_req',  
'Apache2::RequestRec=SCALAR(0xa480e3c)', 'container',  
'HASH(0xa458bec)') called at /usr/lib/perl5/site_perl/5.8.8/Class/ 
Container.pm line 275
Class::Container::call_method('HTML::Mason::Interp=HASH(0x90e9bf0)',  
'request', 'new', 'interp', 'HTML::Mason::Interp=HASH(0x90e9bf0)',  
'comp', '/NoAuth/finger/m_incognito', 'args', 'ARRAY(0xa44e594)',  
'ah', 'HTML::Mason::ApacheHandler=HASH(0x968961c)', 'apache_req',  
'Apache2::RequestRec=SCALAR(0xa480e3c)', 'container',  
'HASH(0xa458bec)') called at /usr/lib/perl5/site_perl/5.8.8/Class/ 
Container.pm line 353
Class::Container::create_delayed_object('interp',  
'HTML::Mason::Interp=HASH(0x90e9bf0)', 'comp', '/NoAuth/finger/ 
m_incognito', 'args', 'ARRAY(0xa44e594)', 'ah',  
'HTML::Mason::ApacheHandler=HASH(0x968961c)', 'apache_req',  
'Apache2::RequestRec=SCALAR(0xa480e3c)', 'container',  
'HASH(0xa458bec)') called at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ 
Interp.pm line 348
HTML 
::Mason::Interp::make_request('HTML::Mason::Interp=HASH(0x90e9bf0)',  
'comp', '/NoAuth/finger/m_incognito', 'args', 'ARRAY(0xa44e594)',  
'ah', 'HTML::Mason::ApacheHandler=HASH(0x968961c)', 'apache_req',  
'Apache2::RequestRec=SCALAR(0xa480e3c)') called at /usr/lib/perl5/ 
site_perl/5.8.8/HTML/Mason/ApacheHandler.pm line 868
eval {...} at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ 
ApacheHandler.pm line 867
HTML 
::Mason 
::ApacheHandler 
::prepare_request('HTML::Mason::ApacheHandler=HASH(0x968961c)',  
'Apache2::RequestRec=SCALAR(0xa480e3c)') called at /usr/lib/perl5/ 
site_perl/5.8.8/HTML/Mason/ApacheHandler.pm line 822
HTML 
::Mason 
::ApacheHandler 
::handle_request('HTML::Mason::ApacheHandler=HASH(0x968961c)',  
'Apache2::RequestRec=SCALAR(0xa480e3c)') called at /opt/rt3/bin/ 
webmux.pl line 125
eval {...} at /opt/rt3/bin/webmux.pl line 125
RT::Mason::handler('Apache2::RequestRec=SCALAR(0xa480e3c)') called at - 
e line 0
eval {...} at -e line 0



Thanks in advance for any help :)
Regards,

Greg Evans
Hood Canal Communications
(360) 898-2481 ext.212


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to