[21840] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4044 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 29 18:10:49 2002

Date: Tue, 29 Oct 2002 15:10:16 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 29 Oct 2002     Volume: 10 Number: 4044

Today's topics:
        read recursive directories <flower.news@vash.de>
    Re: read recursive directories <steven.smolinski@sympatico.ca>
    Re: read recursive directories <mjcarman@mchsi.com>
    Re: read recursive directories <goldbb2@earthlink.net>
    Re: setreuid on AIX 5.1 with perl 5.6.1 <techcog@acme.N3T>
        Substrings (Kasp)
    Re: Substrings <pinyaj@rpi.edu>
    Re: Substrings ctcgag@hotmail.com
    Re: Substrings <goldbb2@earthlink.net>
    Re: Substrings <kaspXXX@epatra.com>
    Re: Substrings <kaspXXX@epatra.com>
        whatever happened to "static typing hints"? <user2048@yahoo.com>
    Re: whatever happened to "static typing hints"? <goldbb2@earthlink.net>
    Re: whatever happened to "static typing hints"? <tassilo.parseval@post.rwth-aachen.de>
    Re: whatever happened to "static typing hints"? <goldbb2@earthlink.net>
    Re: Why is DESTROY called in scalar context? <comdog@panix.com>
    Re: Why is DESTROY called in scalar context? <rgarciasuarez@free.fr>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 29 Oct 2002 19:10:27 +0100
From: Andreas Blume <flower.news@vash.de>
Subject: read recursive directories
Message-Id: <apmiur$2rtmu$1@ID-92737.news.dfncis.de>

Hello!

I like to read a full CD directory including all subdirectories and I 
need following informations:
- name of files
- path
- size
- Date 
- dir or file?

with:
#!/usr/bin/perl
use File::Find;
$vars{CD_Drive}="E:/";
opendir(DirList,"$vars{CD_Drive}");
find(\&AddFileToresult, "$vars{CD_Drive}.");
exit(1);
sub AddFileToresult {
    my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
$ctime,$blksize,$blocks)="";

    ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
$blksize,$blocks)= stat("$File::Find::name");

    print "\n$File::Find::name\t$size\t$ctime\t$mode";
}
I obtain all informations but it's to slow. But I need the information 
of all files (*.*) so I don't need a filer routine. I think the slowest 
part is the stat() command.
Other ideas?
 andreas


------------------------------

Date: Tue, 29 Oct 2002 19:58:13 GMT
From: Steven Smolinski <steven.smolinski@sympatico.ca>
Subject: Re: read recursive directories
Message-Id: <pLBv9.4760$h_4.660582@news20.bellglobal.com>

Andreas Blume <flower.news@vash.de> wrote:

I have some general code comments as well.

> #!/usr/bin/perl

use warnings;
use strict;

> use File::Find;
> $vars{CD_Drive}="E:/";
> opendir(DirList,"$vars{CD_Drive}");

Why is this here?  It doesn't seem to be used.  And warnings would've
told you about that.

> find(\&AddFileToresult, "$vars{CD_Drive}.");

Useless quotes around $vars{CD_Drive}.  If you need the dot in there,
why not put it up in the initializer?

> exit(1);

Aside: Is the return value from Windows programs 1 for success?  Odd.

> sub AddFileToresult {
>     my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
> $ctime,$blksize,$blocks)="";
>
>     ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
> $blksize,$blocks)= stat("$File::Find::name");

Why are they all there; and no need to type twice.  Plus, File::Find
changes you to the proper directory for each file, so using
$File::Find::name here is actually a bug.  It will only work if you
initially specified an absolute pathname to find(), and will break if
you specify a relative one.  This should work no matter what pathname
you start with:

  my($mode, $size, $ctime) = (stat)[2,7,10];

 
>     print "\n$File::Find::name\t$size\t$ctime\t$mode";

Why is the newline at the beginning?  Some shells may eat your last line
of output in that case.

> }
> I obtain all informations but it's to slow. But I need the information 
> of all files (*.*) so I don't need a filer routine. I think the slowest 
> part is the stat() command.

I doubt that stat is your problem; CDROM IO is often very slow since
seek times are huge.  Copy the CD to a hard disk and run it there to
compare, I'll bet it's much faster.  You may be limited by hardware
here.

Steve


------------------------------

Date: Tue, 29 Oct 2002 14:29:33 -0600
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: read recursive directories
Message-Id: <apmr3k$6qg3@onews.collins.rockwell.com>

On 10/29/02 12:10 PM, Andreas Blume wrote:
> 
> I like to read a full CD directory including all subdirectories and I 
> need following informations:
> - name of files
> - path
> - size
> - Date 
> - dir or file?

Your code doesn't flag entries as files/dirs.

> with:
> #!/usr/bin/perl

no 'use warnings' (or -w), no 'use strict'.

> use File::Find;
> $vars{CD_Drive}="E:/";
> opendir(DirList,"$vars{CD_Drive}");

There's no need to call opendir().

> find(\&AddFileToresult, "$vars{CD_Drive}.");

Needless stringification.

> exit(1);
> sub AddFileToresult {
>     my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
> $ctime,$blksize,$blocks)="";

Useless initialization.


>     ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
> $blksize,$blocks)= stat("$File::Find::name");

Making separate copies of lots of stuff you don't use as well as
needless stringification.

>     print "\n$File::Find::name\t$size\t$ctime\t$mode";
> }
> I obtain all informations but it's to slow. But I need the information 
> of all files (*.*) so I don't need a filer routine. I think the slowest 
> part is the stat() command.

This should be /slightly/ faster as it avoids some of the needless
things you did above:

  #!/usr/bin/perl -w
  use strict;
  use File::Find;

  find(\&AddFileToresult, 'E:/');

  sub AddFileToresult {
      my @fstat = stat($File::Find::name);
      printf("%s\t%s%s\t%s\n", $File::Find::name, @fstat[7,10,2]);
  }

I wouldn't expect it a huge improvement, though. The slow part is
probably the printf(), not the stat(). (Printing to the monitor is
slow!) You'll probably have better luck printing directly to a file instead:

  #!/usr/bin/perl -w
  use strict;
  use File::Find;

  open(FH, '>dirlist.txt') or die "Can't open file [$!]\n";
  find(\&AddFileToresult, 'E:/');
  close(FH);

  sub AddFileToresult {
      my @fstat = stat($File::Find::name);
      printf FH ("%s\t%s%s\t%s\n", $File::Find::name, @fstat[7,10,2]);
  }

-mjc



------------------------------

Date: Tue, 29 Oct 2002 16:20:39 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: read recursive directories
Message-Id: <3DBEFBA7.3BAEF592@earthlink.net>

Andreas Blume wrote:
[snip]
> I obtain all informations but it's to slow. But I need the information
> of all files (*.*) so I don't need a filer routine. I think the
> slowest part is the stat() command.
> Other ideas?

Strange but true: On some filesystems, it may be faster to open a file,
and stat the handle, than it is to stat the filename.

Also, when given a filename which you plan on doing an opendir of if
it's a directory, it's probably faster to not bother testing if it's a
directory with the '-d' operator, but just opendir it, and if that
fails, assume that it's not a directory.

   my @files = 'C:';
   local ($,,$\) = ("\t", "\n");
   while( my $path = pop @files ) {
      do { if( open( my($fh), '<', $path ) ) {
         stat $fh or stat $path;
      } else {
         stat $path;
      } } or warn("Could not stat $path: $!"), next;
      print $path, (stat _)[2, 7, 10];
      next unless -d _;
      $path .= '/';
      opendir my($dirfh), $path
         or warn("Could not opendir $path: $!"), next;
      push @files, map $path . $_, grep !/^\.\.?\z/, readdir $dirfh;
   }

If perl allowed my to stat dirhandles, I could optomize it a bit more.

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


------------------------------

Date: Tue, 29 Oct 2002 16:28:11 GMT
From: "techcog@acme.N3T" <techcog@acme.N3T>
Subject: Re: setreuid on AIX 5.1 with perl 5.6.1
Message-Id: <4335204.LjVjqhivDa@gryphon>

Villy Kruse wrote:

> On Tue, 29 Oct 2002 06:25:22 GMT,
>     techcog@acme.N3T <techcog@acme.N3T> wrote:
> 
> 
>>Villy Kruse wrote:
>> 
>>> 
>>> Translated into ($<, $>) = (12345, 12345);
>>> That sometimes works, sometimes it leaves the saved user id,
>>> which may or may not be a problem.  This all depends on the OS
>>> in question.
>>> 
>>
>>Thanks for attempting to answer the original question.  But you've
>>only just danced around the issue setting up strawmen along the way.
>>(or if you prefer, since it's halloween, scarecrows)
>>
>>But the problem lies with perl not AIX.  I will fix perl to behave
>>with AIX.
>>
> 
> 
> How do you plan to do that; perhaps the perl developers should be involed.

Fixing the calls to setreuid, of course.
I don't get it?  The perl programmers are already involved and it's
broken.

> 
> I could imagine a new POSIX-like module that maps setuid, setreuid,
> seteuid, and setresuid and the corresponding setgid functions directly
> to the C functions of the same name.  Modifying the $< or the $> variables
> in the POSIX::setuid function also makes its error behaviour a bit
> unusual.

I could imagine that too, but why bother.
> 
> 
> Villy



------------------------------

Date: 29 Oct 2002 10:45:07 -0800
From: kasp@epatra.com (Kasp)
Subject: Substrings
Message-Id: <3b04990d.0210291045.4e78775c@posting.google.com>

Hello,

I am new to Perl, so pardon my simple question.

I have to detect all possible substring combinations.
The rules are:
1. The string starts with ABC
2. The string can end with PQR or XYZ
3. The string length should be a multiple of 3.

Some examples are:
ABCXYZ is Valid but ABCPXYZ or ABCPQXYZ are invalid because their
length is not a multiple of 3.

Apart from this, is it possible to detect all the substrings that
match such a regular expression?

Eg. PQABCGHKABCPQRAAAXYZ
The answers for this are:
  ABCGHKABCPQR
  ABCGHKABCPQRAAAXYZ
  ABCPQR
  ABCPQRAAAXYZ

Can someone please tell me what the regular expression will be? I have
been trying a lot and the closet I could come was this
~/ABC(.*)?XYZ/;

TIA,
Kasp.


------------------------------

Date: Tue, 29 Oct 2002 14:23:14 -0500
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
To: Kasp <kasp@epatra.com>
Subject: Re: Substrings
Message-Id: <Pine.A41.3.96.1021029142113.32430C-100000@vcmr-104.server.rpi.edu>

[posted & mailed]

On 29 Oct 2002, Kasp wrote:

>1. The string starts with ABC

  /^ABC/

>2. The string can end with PQR or XYZ

  /(PQR|XYZ)$/

>3. The string length should be a multiple of 3.

  /^(.{3})*$/ (or /^(...)*$/)

I'd probably use:

  /^ABC(...)*(PQR|XYZ)$/

That works for me.

-- 
Jeff "japhy" Pinyan      RPI Acacia Brother #734      2002 Acacia Senior Dean
"And I vos head of Gestapo for ten     | Michael Palin (as Heinrich Bimmler)
 years.  Ah!  Five years!  Nein!  No!  | in: The North Minehead Bye-Election
 Oh.  Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)



------------------------------

Date: 29 Oct 2002 20:54:39 GMT
From: ctcgag@hotmail.com
Subject: Re: Substrings
Message-Id: <20021029155439.046$5f@newsreader.com>

kasp@epatra.com (Kasp) wrote:
> Hello,
>
> I am new to Perl, so pardon my simple question.
>
> I have to detect all possible substring combinations.
> The rules are:
> 1. The string starts with ABC
> 2. The string can end with PQR or XYZ
> 3. The string length should be a multiple of 3.
>
> Some examples are:
> ABCXYZ is Valid but ABCPXYZ or ABCPQXYZ are invalid because their
> length is not a multiple of 3.
>
> Apart from this, is it possible to detect all the substrings that
> match such a regular expression?
>
> Eg. PQABCGHKABCPQRAAAXYZ
> The answers for this are:
>   ABCGHKABCPQR
>   ABCGHKABCPQRAAAXYZ
>   ABCPQR
>   ABCPQRAAAXYZ
>
> Can someone please tell me what the regular expression will be? I have
> been trying a lot and the closet I could come was this
> ~/ABC(.*)?XYZ/;

I could spend hours playing around with anchorings and /g
and \G and whatnot, but if operational speed is not of the
essence, how about this:

my $x="PQABCGHKABCPQRAAAXYZ";
while ($x) {
  my $y=$x;
  while ($y) {
    print $y if $y=~ /^ABC(?:...)*(?:XYZ|PQR)$/ ;
    $y=substr $y,1   # cutoff last character
  };
  $x=substr $x,0,-1; # cutoff first character
};'

It runs through every substring of the string, and tests it.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
                    Usenet Newsgroup Service


------------------------------

Date: Tue, 29 Oct 2002 16:39:14 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Substrings
Message-Id: <3DBF0002.BA32EF75@earthlink.net>

Kasp wrote:
> 
> Hello,
> 
> I am new to Perl, so pardon my simple question.
> 
> I have to detect all possible substring combinations.
> The rules are:
> 1. The string starts with ABC
> 2. The string can end with PQR or XYZ
> 3. The string length should be a multiple of 3.
> 
> Some examples are:
> ABCXYZ is Valid but ABCPXYZ or ABCPQXYZ are invalid because their
> length is not a multiple of 3.
>
[harder question moved to end]
> 
> Eg. PQABCGHKABCPQRAAAXYZ
> The answers for this are:
>   ABCGHKABCPQR
>   ABCGHKABCPQRAAAXYZ
>   ABCPQR
>   ABCPQRAAAXYZ
> 
> Can someone please tell me what the regular expression will be?

Here's a simplistic method, which doesn't make full use of the regular
expression engine, but is easy to understand:

   while( $string =~ /ABC/g ) {
      my $rest = substr( $string, pos($string) );
      while( $rest =~ /PQR|XYZ/g ) {
         next if( (pos($rest) % 3) != 0 );
         print "ABC" . substr( $rest, 0, pos($rest) ), "\n";
      }
   }

> Apart from this, is it possible to detect all the substrings that
> match such a regular expression?

You can't make the regex engine return a list of all possible matches...

However, you can put code in to make it do stuff with a partial match,
and you can force a match to fail, causing the regex engine to keep
looking for matches.

$string =~ m/
   (
      ABC
      (?:...)*
      (?:XYZ|PQR)
   )
   (?{ print $1, "\n" })
   (?!) # force a failure
/x;

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


------------------------------

Date: Wed, 30 Oct 2002 01:54:46 +0530
From: "Kasp" <kaspXXX@epatra.com>
Subject: Re: Substrings
Message-Id: <apn0bm$i7s$1@newsreader.mailgate.org>

Here is my code below. What am I doing wrong?
I want to see _all_ the strings that start with ABC and end with PRQ or XYZ.
TIA.

#########################
    chomp;
    print "I read : $_ \n";

    #convert the string to UPPERCASE
    tr/a-z/A-Z/;
    print "After conversion : $_ \n";

    $str = $_;
    print "After copy : $str \n___________\n";

    $str=~/^ABC(...)*(PQR|XYZ)$/;
    print "str is $str \n";
######################


"Jeff 'japhy' Pinyan" <pinyaj@rpi.edu> wrote in message
news:Pine.A41.3.96.1021029142113.32430C-100000@vcmr-104.server.rpi.edu...
[posted & mailed]

On 29 Oct 2002, Kasp wrote:

>1. The string starts with ABC

  /^ABC/

>2. The string can end with PQR or XYZ

  /(PQR|XYZ)$/

>3. The string length should be a multiple of 3.

  /^(.{3})*$/ (or /^(...)*$/)

I'd probably use:

  /^ABC(...)*(PQR|XYZ)$/

That works for me.

--
Jeff "japhy" Pinyan      RPI Acacia Brother #734      2002 Acacia Senior
Dean
"And I vos head of Gestapo for ten     | Michael Palin (as Heinrich Bimmler)
 years.  Ah!  Five years!  Nein!  No!  | in: The North Minehead Bye-Election
 Oh.  Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)





------------------------------

Date: Wed, 30 Oct 2002 03:37:18 +0530
From: "Kasp" <kaspXXX@epatra.com>
Subject: Re: Substrings
Message-Id: <apn1t7$j9h$1@newsreader.mailgate.org>

Thank you guys.
This was so cool.

<ctcgag@hotmail.com> wrote in message
news:20021029155439.046$5f@newsreader.com...
kasp@epatra.com (Kasp) wrote:
> Hello,
>
> I am new to Perl, so pardon my simple question.
>
> I have to detect all possible substring combinations.
> The rules are:
> 1. The string starts with ABC
> 2. The string can end with PQR or XYZ
> 3. The string length should be a multiple of 3.
>
> Some examples are:
> ABCXYZ is Valid but ABCPXYZ or ABCPQXYZ are invalid because their
> length is not a multiple of 3.
>
> Apart from this, is it possible to detect all the substrings that
> match such a regular expression?
>
> Eg. PQABCGHKABCPQRAAAXYZ
> The answers for this are:
>   ABCGHKABCPQR
>   ABCGHKABCPQRAAAXYZ
>   ABCPQR
>   ABCPQRAAAXYZ
>
> Can someone please tell me what the regular expression will be? I have
> been trying a lot and the closet I could come was this
> ~/ABC(.*)?XYZ/;

I could spend hours playing around with anchorings and /g
and \G and whatnot, but if operational speed is not of the
essence, how about this:

my $x="PQABCGHKABCPQRAAAXYZ";
while ($x) {
  my $y=$x;
  while ($y) {
    print $y if $y=~ /^ABC(?:...)*(?:XYZ|PQR)$/ ;
    $y=substr $y,1   # cutoff last character
  };
  $x=substr $x,0,-1; # cutoff first character
};'

It runs through every substring of the string, and tests it.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
                    Usenet Newsgroup Service




------------------------------

Date: 29 Oct 2002 20:45:11 GMT
From: user2048 <user2048@yahoo.com>
Subject: whatever happened to "static typing hints"?
Message-Id: <Xns92B6A0E301BB7mytokxyzzy@216.148.53.81>

Whatever happened to the "static typing hints" mentioned in
Advanced Perl Programming, "A Peek into the Future", p. 369?

The example given is
  my Dog $spot = new Dog;
which would cause $spot->meow() to be a compile-time error.


------------------------------

Date: Tue, 29 Oct 2002 16:24:03 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: whatever happened to "static typing hints"?
Message-Id: <3DBEFC73.D71548AB@earthlink.net>

user2048 wrote:
> 
> Whatever happened to the "static typing hints" mentioned in
> Advanced Perl Programming, "A Peek into the Future", p. 369?
> 
> The example given is
>   my Dog $spot = new Dog;
> which would cause $spot->meow() to be a compile-time error.

Typed lexicals were usurped to make psuedohashes work efficiently.

That meant that they couldn't be used to make $spot->meow into a compile
time error.

Perl 5.8 has thrown away psuedohashes, and perl 5.9/5.10 will probably
have $spot->meow a compile time error.  Maybe.

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


------------------------------

Date: 29 Oct 2002 21:19:53 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: whatever happened to "static typing hints"?
Message-Id: <apmu1p$dlo$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Benjamin Goldberg:

> user2048 wrote:
>> 
>> Whatever happened to the "static typing hints" mentioned in
>> Advanced Perl Programming, "A Peek into the Future", p. 369?
>> 
>> The example given is
>>   my Dog $spot = new Dog;
>> which would cause $spot->meow() to be a compile-time error.
> 
> Typed lexicals were usurped to make psuedohashes work efficiently.
> 
> That meant that they couldn't be used to make $spot->meow into a compile
> time error.
> 
> Perl 5.8 has thrown away psuedohashes, and perl 5.9/5.10 will probably
> have $spot->meow a compile time error.  Maybe.

How is that supposed to work with AUTOLOAD() for instance, or perhaps
weird inheritance hierarchies?

Tassilo
-- 
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;


------------------------------

Date: Tue, 29 Oct 2002 16:51:20 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: whatever happened to "static typing hints"?
Message-Id: <3DBF02D8.5EB0E6AC@earthlink.net>

Tassilo v. Parseval wrote:
> 
> Also sprach Benjamin Goldberg:
> 
> > user2048 wrote:
> >>
> >> Whatever happened to the "static typing hints" mentioned in
> >> Advanced Perl Programming, "A Peek into the Future", p. 369?
> >>
> >> The example given is
> >>   my Dog $spot = new Dog;
> >> which would cause $spot->meow() to be a compile-time error.
> >
> > Typed lexicals were usurped to make psuedohashes work efficiently.
> >
> > That meant that they couldn't be used to make $spot->meow into a
> > compile time error.
> >
> > Perl 5.8 has thrown away psuedohashes, and perl 5.9/5.10 will
> > probably have $spot->meow a compile time error.  Maybe.
> 
> How is that supposed to work with AUTOLOAD() for instance, or perhaps
> weird inheritance hierarchies?

Good question.  I don't know.  That's why I said, "Maybe".

Perhaps *if* this is done, there will be a requirement that all methods
which are autoloaded be stubbed.

As to wierd inheritance... how might that complicated it?

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


------------------------------

Date: Tue, 29 Oct 2002 10:30:13 -0600
From: brian d foy <comdog@panix.com>
Subject: Re: Why is DESTROY called in scalar context?
Message-Id: <291020021030131610%comdog@panix.com>

In article <8uhsru8433uhp1sqld26js8dvl8kcdu60b@4ax.com>, tÓ'pÙ <teh@mindless.com> wrote:

> I wrote a trivial test and DESTROY seems to be called in scalar
> context, is this always so?

DESTROY is called just before object destruction. 

what are you dong?

-- 
brian d foy <comdog@panix.com> - Perl services for hire
The Perl Review - a new magazine devoted to Perl 
<http://www.theperlreview.com>


------------------------------

Date: 29 Oct 2002 20:57:59 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: Why is DESTROY called in scalar context?
Message-Id: <slrnarttim.50u.rgarciasuarez@rafael.example.com>

Teh (tî'pô) wrote in comp.lang.perl.misc :
> I wrote a trivial test and DESTROY seems to be called in scalar
> context, is this always so?
> 
> I would have expected void context. I don't know if this has any
> significance, just wondering.

I just hacked perl to have DESTROY called in void context, and ran the
test suite. Nothing appeared to break. I'll ask for further
clarification on P5P.


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 4044
***************************************


home help back first fref pref prev next nref lref last post