From: Jan T. <de...@us...> - 2003-05-31 22:39:36
|
Update of /cvsroot/net-script/netscript2/src/perl/NetScript In directory sc8-pr-cvs1:/tmp/cvs-serv4485/NetScript Modified Files: Interpreter.pm Log Message: * finished XSLT implementation Index: Interpreter.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/perl/NetScript/Interpreter.pm,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Interpreter.pm 29 May 2003 16:02:27 -0000 1.16 --- Interpreter.pm 31 May 2003 22:39:32 -0000 1.17 *************** *** 5,9 **** # NetScript and all related materials, such as documentation, # are protected under the terms and conditions of the Artistic License. ! # (C) 2000-2002 by Jan Thomä, insOMnia # mailto: ko...@in... #-------------------------------------------------------- --- 5,9 ---- # NetScript and all related materials, such as documentation, # are protected under the terms and conditions of the Artistic License. ! # (C) 2000-2002 by Jan Thomae, insOMnia # mailto: ko...@in... #-------------------------------------------------------- *************** *** 49,53 **** # The current Version of NetScript #*/ ! $VERSION = '2.01 beta'; #/** --- 49,53 ---- # The current Version of NetScript #*/ ! $VERSION = '2.1'; #/** *************** *** 223,226 **** --- 223,227 ---- $systemWrapper -> setMember( '^scriptURL$', undef, "getScriptURL" ); $systemWrapper -> setMember( '^nextID$', undef, "getUID" ); + $systemWrapper -> setMember( '^userAgent$', undef, "getUserAgent" ); # register the SYS-object *************** *** 232,235 **** --- 233,237 ---- # basic init is done - save the global state by putting a new state over it $this -> newStateTree(); + $this -> setContentType( "text/html" ); return $this; # return Object } *************** *** 279,282 **** --- 281,292 ---- #/** + # Returns the User Agent Identification String. + #*/ + sub getUserAgent { + my ( $this ) = @_; + $this -> getCGI() -> user_agent(); + } + + #/** # Takes the given relative URL and makes it absolute. #*/ *************** *** 371,375 **** } else { ! $script = "file:" . $script; } --- 381,392 ---- } else { ! if ( $script =~ /^\// ) { ! # is absolute ! $script = "file:".$script; ! } ! else { ! # is relative ! $script = "file:./" . $script; ! } } *************** *** 416,432 **** my $resultDOM = $domwalker -> walkOver( $dom ); ! my $domwriter = XML::DOM2::DOMWriter -> new(); ! my $domstyle = XML::DOM2::XMLDOMWriterStyle -> new(); ! my $string = $domwriter -> writeDOMToString( $resultDOM, $domstyle ); - my $cookiesRef = $this -> { m_Cookies }; # check for mod_perl if ( $this -> { m_Request } ) { $this -> { m_Request } -> send_cgi_header( ! $this -> getCGI() -> header( -cookie=>$cookiesRef ) ); } else { ! print $this -> getCGI() -> header( -cookie=>$cookiesRef ); } print $string; --- 433,450 ---- my $resultDOM = $domwalker -> walkOver( $dom ); ! # my $domwriter = XML::DOM2::DOMWriter -> new(); ! # my $domstyle = XML::DOM2::XMLDOMWriterStyle -> new(); ! # my $string = $domwriter -> writeDOMToString( $resultDOM, $domstyle ); ! my $domWriter = $this -> getDAL(); ! my $string = $domWriter -> domToString( $resultDOM ); # check for mod_perl if ( $this -> { m_Request } ) { $this -> { m_Request } -> send_cgi_header( ! $this -> getHeader() ); } else { ! print $this -> getHeader(); } print $string; *************** *** 442,445 **** --- 460,494 ---- #/** + # Allows libraries to set the content type which is reported to the + # browser. + #*/ + sub setContentType { + my ( $this, $type ) = @_; + $this -> { m_contentType } = $type; + } + + #/** + # Returns the content type which is reported to the browser. + #*/ + sub getContentType { + my ( $this ) = @_; + $this -> { m_contentType }; + } + + + #/** + # Returns the header for the result page. + #*/ + sub getHeader { + my ( $this ) = @_; + my $cookiesRef = $this -> { m_Cookies }; + my $header = $this -> getCGI() -> header( -cookie=>$cookiesRef, + -type => $this -> getContentType() ); + + $header =~ s/; charset[^\n]+//g; #remove charset stuff + $header; + } + + #/** # Returns the http-Parameter from the CGI-Object. # @param a string containing the name of the parameter *************** *** 566,570 **** if ( $this -> getDOMWalker() ) { ! my $line = $this -> getDOMWalker() -> currentSource() -> getLine(); &handle_errors( $event -> eventMessage(). "\n\nError occured in or around line $line in:\n".$this -> getScriptURL()."\n" ); --- 615,619 ---- if ( $this -> getDOMWalker() ) { ! my $line = 0; #$this -> getDOMWalker() -> currentSource() -> getLine(); &handle_errors( $event -> eventMessage(). "\n\nError occured in or around line $line in:\n".$this -> getScriptURL()."\n" ); |