You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by PILCH Hartmut <ph...@a2e.de> on 2006/03/28 13:50:52 UTC

printing to OUT from within a package /was: erratic effect of input key in Execute

> > 	[- print WEB "<h3>blablabla</h3>" -]
> 
> You need to print to OUT inside your Embperl code

That works too, except when I do this in a external package, e.g.


foo/bar.pm

	package Foo::Bar;

	[...]

  	sub say1 {
	  print OUT "DEBUG1: ";
	  printf OUT @_;
 	  print OUT "\n";			
	} 

	__END__


saytest.htm

	[- use Foo::Bar qw(say1);
	   sub say2 {
	        print OUT "DEBUG2: ";
		printf OUT @_;
		print OUT "\n";
	   }
          -]
  	 
        <h3>[- say1 "foo" -]</h3>	
        <h3>[- say2 "bar" -]</h3>


This will print only 

	<h3></h3>
        <h3>DEBUG2: bar</h3>

				
Is the file descriptor OUT not accessible from the package ?

--
Hartmut Pilch		http://a2e.de/phm/adv/embperl/

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


RE: printing to OUT from within a package /was: erratic effect of input key in Execute

Posted by Gerald Richter <ri...@ecos.de>.
> 
> > > 	[- print WEB "<h3>blablabla</h3>" -]
> > 
> > You need to print to OUT inside your Embperl code
> 
> That works too, except when I do this in a external package, e.g.
> 
> 

In an external package you need to tie a filehandle to Embperl::Out eg.

  tie OUT, 'Embperl::Out' ;

Gerald



 
** Virus checked by BB-5000 Mailfilter ** 


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org