Re: tie question

2000-08-03 Thread Eric L. Brine



 why is tie considered not very efficient i use it often.. what is 'a'
 much better way?

Many modules which use tie also provide an object oriented interface. It's
more efficient to use the OO interface according to benchmarks I've seen
here.

If you have two modules, one which has an OO interface and one that has a
tied interface, create a wrapper to make the tie module object oriented
instead of creating a wrapper to make the OO module into a tie.

For such wrappers to handles, check out IO::Wrap and/or IO::WrapTie (I
don't remember which). They are located in IO::Stringy on CPAN, IIRC. It's
been a while.

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: tie question

2000-07-31 Thread Matt Sergeant

On Mon, 31 Jul 2000, dreamwvr wrote:

 hi,
why is tie considered not very efficient i use it often.. what is 'a'
 much better way?

tie isn't very efficient simply because the code behind it (in the core of
Perl) is fairly complex and slow. Theres not a lot that can be done to
improve it according to Ilya. I don't think there _is_ a better way - tie
is a very specific requirement, and usually its "fast enough". Remember
that STDOUT is tied to the request object in mod_perl...

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




Re: tie question

2000-07-31 Thread Perrin Harkins

On Mon, 31 Jul 2000, Matt Sergeant wrote:

 On Mon, 31 Jul 2000, dreamwvr wrote:
 
  hi,
 why is tie considered not very efficient i use it often.. what is 'a'
  much better way?
 
 tie isn't very efficient simply because the code behind it (in the core of
 Perl) is fairly complex and slow. Theres not a lot that can be done to
 improve it according to Ilya. I don't think there _is_ a better way - tie
 is a very specific requirement, and usually its "fast enough". Remember
 that STDOUT is tied to the request object in mod_perl...

It's possible to call the object methods directly, and this will be faster
than using the tied interface.  Sometimes you can't do this because you
don't want to touch the code that uses the tied interface, but I've done
this successfully with Apache::Session and some other Tie:: modules
before.

Read the perltie manpage or open up the module you're using if you want to
see how to do it.

- Perrin