home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / Null.pm < prev    next >
Encoding:
Perl POD Document  |  2003-11-12  |  1.6 KB  |  78 lines

  1. # Copyright (c) 1998-2003 by Jonathan Swartz. All rights reserved.
  2. # This program is free software; you can redistribute it and/or modify
  3. # it under the same terms as Perl itself.
  4.  
  5. package HTML::Mason::Resolver::Null;
  6.  
  7. use strict;
  8.  
  9. use HTML::Mason::Resolver;
  10. use base qw(HTML::Mason::Resolver);
  11.  
  12. sub get_info {
  13.     return;
  14. }
  15.  
  16. sub get_source {
  17.     return;
  18. }
  19.  
  20. # Returns everything get_info() returns, plus the component source in a 'comp_source' entry.
  21. sub resolve {
  22.     return;
  23. }
  24.  
  25. sub comp_class {
  26.     return 'HTML::Mason::Component';
  27. }
  28.  
  29. sub glob_path {
  30.     return;
  31. }
  32.  
  33. 1;
  34.  
  35. __END__
  36.  
  37. =head1 NAME
  38.  
  39. HTML::Mason::Resolver::Null - a do-nothing resolver
  40.  
  41. =head1 SYNOPSIS
  42.  
  43.   my $resolver = HTML::Mason::Resolver::Null->new;
  44.  
  45. =head1 DESCRIPTION
  46.  
  47. This HTML::Mason::Resolver subclass is useful if you want to create
  48. components via the C<< HTML::Mason::Interp->make_component >> method
  49. and you never plan to interact with the filesystem.
  50.  
  51. Basically, it provides all of the necessary resolver methods but none
  52. of them do anything.
  53.  
  54. This means that if you use this method things like C<< $interp->exec >>
  55. will simply not work at all.
  56.  
  57. However, if you just want to make an component with an interepreter
  58. and execute it then it can be useful.  For example:
  59.  
  60.   my $interp = HTML::Mason::Interp->new( resolver_class => 'HTML::Mason::Resolver::Null',
  61.                                          data_dir => '/tmp' );
  62.  
  63.   my $comp = $interp->make_component( comp_source => <<'EOF' );
  64. % my $var = 'World';
  65. Hello, <% $var %>!
  66. EOF
  67.  
  68.   my $buffer;
  69.   my $output = $interp->make_request( out_method => \$var )->comp($comp);
  70.  
  71.   print $buffer;
  72.  
  73. =head1 SEE ALSO
  74.  
  75. L<HTML::Mason|HTML::Mason>
  76.  
  77. =cut
  78.