Ah... thank you.
I guess the implementation has changed since the documentation was written,
it says (in XSP's POD):

"Note that start_expr, end_expr and append_to_script aren't exported by
default, so you need to do: 

use Apache::AxKit::Language::XSP qw(start_expr end_expr append_to_script);"

Which is no longer the case. Now I realise that $e is a blessed
AxKit::XSP::SAXHandler so that�s why e->start_expr($tag) works but
start_expr($e, $tag) doesn't.

If anyone with CVS write access wants to patch the XSP.pm pod, there are
some basic changes below.

Adam

? xsp_pm.patch
Index: XSP.pm
===================================================================
RCS file: /home/cvspublic/xml-axkit/lib/Apache/AxKit/Language/XSP.pm,v
retrieving revision 1.24
diff -c -r1.24 XSP.pm
*** XSP.pm      2 Jan 2003 16:09:34 -0000       1.24
--- XSP.pm      24 Jan 2003 01:57:55 -0000
***************
*** 1487,1493 ****
  
  Solution:
  
! use start_expr(), append_to_script(), end_expr().
  
  Example:
  
--- 1487,1493 ----
  
  Solution:
  
! use $e->start_expr(), $e->append_to_script(), $e->end_expr().
  
  Example:
  
***************
*** 1496,1502 ****
  in parse_start:
  
    if ($tag eq 'get-datetime') {
!     start_expr($e, $tag); # creates a new { ... } block
      my $local_format = lc($attribs{format}) || '%a, %d %b %Y %H:%M:%S %z';
      return 'my ($format); $format = q|' . $local_format . '|;';
    }
--- 1496,1502 ----
  in parse_start:
  
    if ($tag eq 'get-datetime') {
!     $e->start_expr($tag); # creates a new { ... } block
      my $local_format = lc($attribs{format}) || '%a, %d %b %Y %H:%M:%S %z';
      return 'my ($format); $format = q|' . $local_format . '|;';
    }
***************
*** 1504,1511 ****
  in parse_end:
  
    if ($tag eq 'get-datetime') {
!     append_to_script($e, 'use Time::Object;
localtime->strftime($format);');
!     end_expr($e);
      return '';
    }
  
--- 1504,1511 ----
  in parse_end:
  
    if ($tag eq 'get-datetime') {
!     $e->append_to_script('use Time::Object;
localtime->strftime($format);');
!     $e->end_expr();
      return '';
    }
  
***************
*** 1514,1520 ****
  This is more complex than the first 2 examples, so it warrants some 
  explanation. I'll go through it step by step.
  
!   start_expr(...)
  
  This tells XSP that this really generates a <xsp:expr> tag. Now we don't
  really generate that tag, we just execute the handler for it. So what
--- 1514,1520 ----
  This is more complex than the first 2 examples, so it warrants some 
  explanation. I'll go through it step by step.
  
!   $e->start_expr($tag)
  
  This tells XSP that this really generates a <xsp:expr> tag. Now we don't
  really generate that tag, we just execute the handler for it. So what
***************
*** 1539,1545 ****
  (we'll see why we formatted it this way in #5 below). The first thing we
  get is:
  
!   append_to_script($e, 'use Time::Object; localtime->strftime($format);');
  
  This does exactly what it says, and the script becomes:
  
--- 1539,1545 ----
  (we'll see why we formatted it this way in #5 below). The first thing we
  get is:
  
!   $e->append_to_script('use Time::Object; localtime->strftime($format);');
  
  This does exactly what it says, and the script becomes:
  
***************
*** 1549,1555 ****
  
  Finally, we call:
  
!   end_expr($e);
  
  which closes the do {} block, leaving us with:
  
--- 1549,1555 ----
  
  Finally, we call:
  
!   $e->end_expr();
  
  which closes the do {} block, leaving us with:
  
***************
*** 1562,1573 ****
  statement executed, which is the C<localtime->strftime()> bit there,
  thus doing exactly what we wanted.
  
- Note that start_expr, end_expr and append_to_script aren't exported
- by default, so you need to do:
- 
-   use Apache::AxKit::Language::XSP 
-         qw(start_expr end_expr append_to_script);
- 
  =head2 4. Your tag can take as an option either an attribute, or a child
tag.
  
  Example:
--- 1562,1567 ----
***************
*** 1643,1649 ****
  in parse_start:
  
    if ($tag eq 'get-column') {
!     start_expr($e, $tag);
      my $code = 'my ($col);'
      if ($attribs{col}) {
        $code .= '$col = q|' . $attribs{col} . '|;';
--- 1637,1643 ----
  in parse_start:
  
    if ($tag eq 'get-column') {
!     $e->start_expr($tag);
      my $code = 'my ($col);'
      if ($attribs{col}) {
        $code .= '$col = q|' . $attribs{col} . '|;';
***************
*** 1660,1667 ****
      return ';';
    }
    if ($tag eq 'get-column') {
!     append_to_script($e, 'Full::Package::get_column($col)');
!     end_expr($e);
      return '';
    }
  
--- 1654,1661 ----
      return ';';
    }
    if ($tag eq 'get-column') {
!     $e->append_to_script('Full::Package::get_column($col)');
!     $e->end_expr();
      return '';
    }
  


-----Original Message-----
From: J�rg Walter [mailto:[EMAIL PROTECTED]] 
Sent: 23 January 2003 15:15
To: [EMAIL PROTECTED]
Subject: Re: AxKit::XSP::SAXHandler start_expr


On Thursday, 23. January 2003 12:56, Adam Griffiths wrote:
> The only instance of 'start expr' that I can find is on line 266 
> XSP.pm,v 1.24. (other than in the POD). Where exactly should I look, 
> or, what am I missing?

Forgive me, I mixed up two things. Regarding your original query:

> On Wednesday, 22. January 2003 14:50, Adam Griffiths wrote:
> > Hi everyone,
> > I guess this is realy a Perl question but if there's anyone on this 
> > list who could explain it I'd realy appriciate the help!
> >
> > I was looking arround in XSP.pm, to better my understanding of AxKit 
> > and the API for writing taglibs. I've understood most of what is 
> > there but I am unsure how taglibs, in their own package, have access 
> > to the functions start expr, append to script and end expr in the 
> > AxKit::XSP::SAXHandler pakage, without calling them explicitly.
> >
> > i.e how come we can do this in a taglib:
> > $e->start expr();
> >
> > And don't need to do this: $e->AxKit::XSP::SAXHandler::start expr()

As I see it, $e is an AxKit::XSP::SAXHandler object. (The one accessed as 
->{Handler} in process_*)

-- 
CU
  Joerg

PGP Public Key at http://ich.bin.kein.hoschi.de/~trouble/public_key.asc
PGP Key fingerprint = D34F 57C4 99D8 8F16 E16E  7779 CDDC 41A4 4C48 6F94


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



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

Reply via email to