Loading ...
Sorry, an error occurred while loading the content.

Trouble with the arrow operator("->") in custom tags

Expand Messages
  • Christopher Brown
    Hi, This could be really simple or really easy. I want to write a custom tag that renders the content of the tag only if the test argument evaluates to be
    Message 1 of 4 , Apr 18, 2004
    • 0 Attachment
      Hi,
       
      This could be really simple or really easy.
       
      I want to write a custom tag that renders the content of the tag only if the 'test' argument evaluates to be true.  I want it to work something like this:
       
      <asp:Test test="$Session->{User}">
          The Session User Object Exists
      </asp:Test>
       
       
      Where the Perl code is:
       
      sub asp::Test {
       
          my ($args, $content) = @_;
       
           if ( eval( $args->{test} ) != 0  ) {
               $Response->Write("$content"); 
           }
       
      }
       
      The problem here is that the parser recognizes the ">" of the arrow operator "->" as the tag closure.  Has anyone experienced similar troubles?  Is there a good (easy) solution?
       
      Thanks In Advance,
       
      Chris
       
       
    • Peter Galbavy
      ... perhaps ? Ugly, but hey. Peter ... To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org For additional commands,
      Message 2 of 4 , Apr 19, 2004
      • 0 Attachment
        Christopher Brown wrote:
        > The problem here is that the parser recognizes the ">" of the arrow
        > operator "->" as the tag closure. Has anyone experienced similar
        > troubles? Is there a good (easy) solution?
        >

        <asp:Test test="$Session->{User}">

        perhaps ? Ugly, but hey.

        Peter

        ---------------------------------------------------------------------
        To unsubscribe, e-mail: asp-unsubscribe@...
        For additional commands, e-mail: asp-help@...
      • Helmut Zeilinger
        Maybe ${$Session}{ User } helps? Helmut --On Sunday, April 18, 2004 22:33:36 -0700 Christopher Brown ... To unsubscribe, e-mail:
        Message 3 of 4 , Apr 19, 2004
        • 0 Attachment
          Maybe

          ${$Session}{'User'}

          helps?

          Helmut


          --On Sunday, April 18, 2004 22:33:36 -0700 Christopher Brown
          <chris.brown@...> wrote:

          > Hi,
          >
          > This could be really simple or really easy.
          >
          > I want to write a custom tag that renders the content of the tag only if
          > the 'test' argument evaluates to be true. I want it to work something
          > like this:
          >
          > <asp:Test test="$Session->{User}">
          > The Session User Object Exists
          > </asp:Test>
          >
          >
          > Where the Perl code is:
          >
          > sub asp::Test {
          >
          > my ($args, $content) = @_;
          >
          > if ( eval( $args->{test} ) != 0 ) {
          > $Response->Write("$content");
          > }
          >
          > }
          >
          > The problem here is that the parser recognizes the ">" of the arrow
          > operator "->" as the tag closure. Has anyone experienced similar
          > troubles? Is there a good (easy) solution?
          >
          > Thanks In Advance,
          >
          > Chris
          >
          >


          ---------------------------------------------------------------------
          To unsubscribe, e-mail: asp-unsubscribe@...
          For additional commands, e-mail: asp-help@...
        • Josh Chamas
          ... You can also try setting: PerlSetVar XMLSubsPerlArgs Off which will then enable syntax in XMLSubs like:
          Message 4 of 4 , Apr 19, 2004
          • 0 Attachment
            Christopher Brown wrote:
            > Hi,
            >
            > This could be really simple or really easy.
            >
            > I want to write a custom tag that renders the content of the tag only if
            > the 'test' argument evaluates to be true. I want it to work something
            > like this:
            >
            > <asp:Test test="$Session->{User}">
            > The Session User Object Exists
            > </asp:Test>
            >
            >

            You can also try setting:

            PerlSetVar XMLSubsPerlArgs Off

            which will then enable <%= %> syntax in XMLSubs like:

            <asp:Test test="<%= $Session->{User} %>">
            The Session User Object Exists
            </asp:Test>

            Which will make the use of > safe inside those <%= %> blocks.

            Regards,

            Josh
            ________________________________________________________________________
            Josh Chamas, Founder | NodeWorks - http://www.nodeworks.com
            Chamas Enterprises Inc. | NodeWorks Directory - http://dir.nodeworks.com
            http://www.chamas.com | Apache::ASP - http://www.apache-asp.org



            ---------------------------------------------------------------------
            To unsubscribe, e-mail: asp-unsubscribe@...
            For additional commands, e-mail: asp-help@...
          Your message has been successfully submitted and would be delivered to recipients shortly.