in reply to Re: use fields;
in thread use fields;

Thanks, Corion, you are right, there is not any reason to use the weird syntax. I found it two years ago in the book <a href=;http://www.manning.com/Conway/index.html'>Object Oriented Perl by Damian Conway (in my opinion, that book is one of the best Perl books). Probably, that syntax became old. Unfortunately, using
my $self = fields::new($class);
intead of
no strict "refs"; my $self = bless [\%{"${caller}::FIELDS"}], $class;
doen't resolve problem with pseudo-hashes.

---
Michael Stepanov aka nite_man

It's only my opinion and it doesn't have pretensions of absoluteness!

Replies are listed 'Best First'.
Re^3: use fields;
by Corion (Patriarch) on Nov 23, 2004 at 08:12 UTC

    Re-reading the documentation, Perl 5.8.x still uses the pseudo-hash implementation, so I guess you will have to temporarily switch off the warnings for that section of code:

    my $self = do { no warnings 'deprecated'; fields::new($class); };

      I know that. It worryes me that after month or year Perl developers team will decide to forbid using pseudo hashes.

      So, I'm trying to find a way to produce a good code, probably without problems in the future.

      ---
      Michael Stepanov aka nite_man

      It's only my opinion and it doesn't have pretensions of absoluteness!

        Did you read the documentation for the fields pragma? It specifically mentions the differences between the pseudo-hash version for 5.8.x and lower, and the pseudo-hash free version for 5.9.x and higher. This distinction is made because, in 5.9.x and higher, pseudo-hashes will be gone. So, as long as you use fields;, and use fields::new, you should be safe, according to the documentation.