[27938] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9302 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 15 14:10:19 2006

Date: Thu, 15 Jun 2006 11:10:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 15 Jun 2006     Volume: 10 Number: 9302

Today's topics:
    Re: reference to object method <uri@stemsystems.com>
    Re: reference to object method <uri@stemsystems.com>
    Re: reference to object method xhoster@gmail.com
    Re: reference to object method <hobosalesman@gmail.com>
    Re: reference to object method <mumia.w.18.spam+nospam.usenet@earthlink.net>
    Re: reference to object method <uri@stemsystems.com>
        SemanticDiff and new_value mike.siegel@gmail.com
        Testing a new password <mark@gangwarily.ca>
    Re: Testing a new password <jgibson@mail.arc.nasa.gov>
    Re: Testing a new password <mark@gangwarily.ca>
    Re: Testing a new password <glennj@ncf.ca>
    Re: Testing a new password <glennj@ncf.ca>
    Re: Unix shell script with Perl one-liner causes error <ced@blv-sam-01.ca.boeing.com>
    Re: Unix shell script with Perl one-liner causes error <simonozzy@gmail.com>
    Re: Unix shell script with Perl one-liner causes error <mumia.w.18.spam+nospam.usenet@earthlink.net>
        What am I missing in perlre janfure@gmail.com
    Re: What am I missing in perlre <sherm@Sherm-Pendleys-Computer.local>
    Re: Why doesn't chdir (@args) work? <tadmc@augustmail.com>
    Re: WIN32::PIPE bug ? <karl_zero@free.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 15 Jun 2006 11:45:46 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: reference to object method
Message-Id: <x73be6zal1.fsf@mail.sysarch.com>

>>>>> "GH" == Gunnar Hjalmarsson <noreply@gunnar.cc> writes:

  GH> Uri Guttman wrote:
  >> xhoster  <xhoster@gmail.com> writes:
  >>> "Hobo Salesman" <hobosalesman@gmail.com> wrote:
  >>>> Can I store a reference to an object method in a scalar and use that to
  >>>> call the method?
  >>> my $ref = sub { $object->method(@_) };
  >>> $ref->($argument);
  >> much better to use UNIVERSAL::can:
  GH>    ^^^^^^^^^^^

  >> my $meth = $obj->can( 'method_name' ) ;
  >> $meth->( $arg ) ;

  GH> Why?

you don't need the extra complexity of a closure. why do something that
is not needed?

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Thu, 15 Jun 2006 11:47:48 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: reference to object method
Message-Id: <x7y7vyxvx7.fsf@mail.sysarch.com>

>>>>> "AS" == Anno Siegel <siegel@zrz.tu-berlin.de> writes:

  AS> Uri Guttman wrote:
  >>>>>>> "x" == xhoster  <xhoster@gmail.com> writes:
  >> 
  x> "Hobo Salesman" <hobosalesman@gmail.com> wrote:
  >> >> Can I store a reference to an object method in a scalar and use that
  >> >> to call the method? Something like (and I'm sure this is wrong):
  >> >> 
  >> >> $methodRef = \$object->method();
  >> >> &{$methodRef}($argument);
  >> 
  >> 
  x> my $ref = sub { $object->method(@_) };
  >> 
  x> $ref->($argument);
  >> 
  >> much better to use UNIVERSAL::can:
  >> 
  >> my $meth = $obj->can( 'method_name' ) ;
  >> 
  >> $meth->( $arg ) ;

  AS> Ah, but these are not the same.  The way I read the OP, the idea is to
  AS> freeze both the object and the method in a scalar, and that's what Xhos
  AS> solution does.  Yours only catches the method, the object would still
  AS> have to be supplied as an argument.

i read it as i answered it. we can agree the OP is somewhat ambiguous
there. i see reference to a method (found via an object). he seems to
have the object floating around and so it doesn't need to be stored in
the closure (and so the closure isn't needed). so the OP would need to
clarify this.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 15 Jun 2006 16:08:31 GMT
From: xhoster@gmail.com
Subject: Re: reference to object method
Message-Id: <20060615120854.395$fE@newsreader.com>

Uri Guttman <uri@stemsystems.com> wrote:
> >>>>> "x" == xhoster  <xhoster@gmail.com> writes:
>
>   x> "Hobo Salesman" <hobosalesman@gmail.com> wrote:
>   >> Can I store a reference to an object method in a scalar and use that
>   >> to call the method? Something like (and I'm sure this is wrong):
>   >>
>   >> $methodRef = \$object->method();
>   >> &{$methodRef}($argument);
>
>   x> my $ref = sub { $object->method(@_) };
>
>   x> $ref->($argument);
>
> much better to use UNIVERSAL::can:

Neat, I've never considered can to return more than a boolean.

>         my $meth = $obj->can( 'method_name' ) ;
>
>         $meth->( $arg ) ;

Doesn't that call the method as a regular subroutine, with $arg where $self
should be?

Wouldn't that need to be: ?
$obj->$meth($arg);

The anonymous sub method stores the object as a closure (well, as long
as it is a lexical, anyway), whereas the UNIVERSAL::can method requires you
to keep your hands on the object your own self.  I thought that the point
of the OP was not to have to do that, but maybe I misread his point.


Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 15 Jun 2006 09:46:46 -0700
From: "Hobo Salesman" <hobosalesman@gmail.com>
Subject: Re: reference to object method
Message-Id: <1150390006.585679.226020@y41g2000cwy.googlegroups.com>

Hobo Salesman wrote:
> Can I store a reference to an object method in a scalar and use that to
> call the method?

Thanks for the solutions. I don't have a specific application, I'm just
learning OOP and figuring out different ways to structure things.
THanks again.



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

Date: Thu, 15 Jun 2006 17:27:31 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: reference to object method
Message-Id: <7Mgkg.6312$lp.1404@newsread3.news.pas.earthlink.net>

Hobo Salesman wrote:
> Can I store a reference to an object method in a scalar and use that to
> call the method? Something like (and I'm sure this is wrong):
> 
> $methodRef = \$object->method();
> &{$methodRef}($argument);
> 

The others have given you good methods of doing this including their
pros and cons. This method should avoid the need to lexicalize the
object as well as store all the data required to do a proper method call:

     $callref = [ $obj->can('method') , $obj ];
     $callref->[0]($callref->[1]);

You can make a sub to prettify the call site if you want to.

     sub cR {
         my ($sub, $obj, @arglist) = @_;
         $sub->($obj, @arglist);
     }

     cR @$callref;

HTH




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

Date: Thu, 15 Jun 2006 14:01:54 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: reference to object method
Message-Id: <x7lkryxppp.fsf@mail.sysarch.com>

>>>>> "x" == xhoster  <xhoster@gmail.com> writes:

  x> Uri Guttman <uri@stemsystems.com> wrote:
  >> >>>>> "x" == xhoster  <xhoster@gmail.com> writes:
  >> 
  x> "Hobo Salesman" <hobosalesman@gmail.com> wrote:
  >> >> Can I store a reference to an object method in a scalar and use that
  >> >> to call the method? Something like (and I'm sure this is wrong):
  >> >>
  >> >> $methodRef = \$object->method();
  >> >> &{$methodRef}($argument);
  >> 
  x> my $ref = sub { $object->method(@_) };
  >> 
  x> $ref->($argument);
  >> 
  >> much better to use UNIVERSAL::can:

  x> Neat, I've never considered can to return more than a boolean.

  >> my $meth = $obj->can( 'method_name' ) ;
  >> 
  >> $meth->( $arg ) ;

  x> Doesn't that call the method as a regular subroutine, with $arg where $self
  x> should be?

  x> Wouldn't that need to be: ?
  x> $obj->$meth($arg);

my bad. brain wasn't fully engaged. and i have used can like that a few
times so i should know how to call the method! your code is correct
there.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 15 Jun 2006 08:29:55 -0700
From: mike.siegel@gmail.com
Subject: SemanticDiff and new_value
Message-Id: <1150385395.333471.91490@i40g2000cwc.googlegroups.com>

I'm diffing two XML documents with SemanticDiff.

the relevant portion is as follows:

old:

<fruit>
<fruitcount="0"/>
</fruit>

new

<fruit>
<fruitcount="1"/>
<apple type"red delicious"/>
</fruit>

The problem is this: I have keepdata set to 1, and old_value and
new_value work fine when an element changes.  However, with missing a
rogue elements, the docs (if I'm understanding right) say that in the
case of a missing element, old_value should be set, new_value not set,
and vice versa for a rogue.

However, when I ever I try to print old_value for a missing or
new_value for a rogue, I get "o".

Any ideas?

Thanks,

Mike



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

Date: Thu, 15 Jun 2006 10:58:03 -0400
From: Mark Drummond <mark@gangwarily.ca>
Subject: Testing a new password
Message-Id: <bqmdnY3ZYffg6AzZnZ2dnUVZ_vednZ2d@magma.ca>

I have a chunk of code that generates a random password form a specified 
set of characters. Once the password is generated I want to test it for 
certain characteristics and if it does not meet those characteristics 
then I want to toss it and start again. What I am working with looks 
something like (not necessarily correct code below!):

sub newpass {
	my $pass
	my $badpass = 1;
	my $rand;
	my $passlen = $_[0];
	$passlen = 8 if !$passlen;
	my @chars = qw/ a b c ...
			A B C ...
			0 1 2 ... /;

	while ($badpass == 1) {
		$pass = "";
		for (my $i=0; $i < $passlen; $i++) {
			$rand = int(rand $#chars+1);
			$pass .= $chars[$rand];
		}
		#
		# INSERT PASSWORD TESTS HERE
		#
		$badpass = 0;
	}

	return $pass
}

I wanted to do something like the following for my tests:

# test for at least one lowercase char
next if $pass =~ /[[:lower:]]/;
# test for at least one uppercase char
next if $pass =~ /[[:upper:]]/;
# test for at least one digit
next if $pass =~ /[[:digit:]]/;

But my program just spins in an infinite loop. So clearly I have no idea 
what I am doing!!

Any tips?!

Mark


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

Date: Thu, 15 Jun 2006 08:29:04 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Testing a new password
Message-Id: <150620060829042141%jgibson@mail.arc.nasa.gov>

In article <bqmdnY3ZYffg6AzZnZ2dnUVZ_vednZ2d@magma.ca>, Mark Drummond
<mark@gangwarily.ca> wrote:

> I have a chunk of code that generates a random password form a specified 
> set of characters. Once the password is generated I want to test it for 
> certain characteristics and if it does not meet those characteristics 
> then I want to toss it and start again. What I am working with looks 
> something like (not necessarily correct code below!):
> 
> sub newpass {
>  my $pass
>  my $badpass = 1;
>  my $rand;
>  my $passlen = $_[0];
>  $passlen = 8 if !$passlen;
>  my @chars = qw/ a b c ...
>        A B C ...
>        0 1 2 ... /;
> 
>  while ($badpass == 1) {
>     $pass = "";
>     for (my $i=0; $i < $passlen; $i++) {
>        $rand = int(rand $#chars+1);
>        $pass .= $chars[$rand];
>     }
>     #
>     # INSERT PASSWORD TESTS HERE
>     #
>     $badpass = 0;
>  }
> 
>  return $pass
> }
> 
> I wanted to do something like the following for my tests:
> 
> # test for at least one lowercase char
> next if $pass =~ /[[:lower:]]/;
> # test for at least one uppercase char
> next if $pass =~ /[[:upper:]]/;
> # test for at least one digit
> next if $pass =~ /[[:digit:]]/;
> 
> But my program just spins in an infinite loop. So clearly I have no idea 
> what I am doing!!

You are rejecting any password that contains a lowercase or uppercase
character or a digit, and they all do.

Try:

   next unless $pass =~ /[[:lower]]/;

or

   next if $pass !~ /[[:lower]]/;

etc.


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

Date: Thu, 15 Jun 2006 12:40:33 -0400
From: Mark Drummond <mark@gangwarily.ca>
Subject: Re: Testing a new password
Message-Id: <sOCdnSXmjukcEAzZnZ2dnUVZ_sydnZ2d@magma.ca>

Jim Gibson wrote:
> In article <bqmdnY3ZYffg6AzZnZ2dnUVZ_vednZ2d@magma.ca>, Mark Drummond
> <mark@gangwarily.ca> wrote:
> 
>> I have a chunk of code that generates a random password form a specified 
>> set of characters. Once the password is generated I want to test it for 
>> certain characteristics and if it does not meet those characteristics 
>> then I want to toss it and start again. What I am working with looks 
>> something like (not necessarily correct code below!):
>>
>> sub newpass {
>>  my $pass
>>  my $badpass = 1;
>>  my $rand;
>>  my $passlen = $_[0];
>>  $passlen = 8 if !$passlen;
>>  my @chars = qw/ a b c ...
>>        A B C ...
>>        0 1 2 ... /;
>>
>>  while ($badpass == 1) {
>>     $pass = "";
>>     for (my $i=0; $i < $passlen; $i++) {
>>        $rand = int(rand $#chars+1);
>>        $pass .= $chars[$rand];
>>     }
>>     #
>>     # INSERT PASSWORD TESTS HERE
>>     #
>>     $badpass = 0;
>>  }
>>
>>  return $pass
>> }
>>
>> I wanted to do something like the following for my tests:
>>
>> # test for at least one lowercase char
>> next if $pass =~ /[[:lower:]]/;
>> # test for at least one uppercase char
>> next if $pass =~ /[[:upper:]]/;
>> # test for at least one digit
>> next if $pass =~ /[[:digit:]]/;
>>
>> But my program just spins in an infinite loop. So clearly I have no idea 
>> what I am doing!!
> 
> You are rejecting any password that contains a lowercase or uppercase
> character or a digit, and they all do.
> 
> Try:
> 
>    next unless $pass =~ /[[:lower]]/;
> 
> or
> 
>    next if $pass !~ /[[:lower]]/;
> 
> etc.

Sorry about that. I don't know if this is correct or not but my test 
lines were actually:

	next if $pass =~ /[[:^lower:]]/;

Which I was treating as the negation.

Nonetheless, I followed your suggestion above and it worked. Thanks!

Mark


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

Date: 15 Jun 2006 17:22:07 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: Testing a new password
Message-Id: <slrne935pv.i06.glennj@smeagol.ncf.ca>

At 2006-06-15 12:40PM, Mark Drummond <mark@gangwarily.ca> wrote:
> > Try:
> >    next unless $pass =~ /[[:lower]]/;
> > or
> >    next if $pass !~ /[[:lower]]/;
>  
>  Sorry about that. I don't know if this is correct or not but my test 
>  lines were actually:
>  
>  	next if $pass =~ /[[:^lower:]]/;

Which would reject the password if it contained a single non-lower case
character.  You probably had the same for [:^upper:] and [:^digit:]

You might also test to accept passwords instead of rejecting them:
    while (1) {
        $pass = random_password();
        last if $pass =~ /[[:lower:]] and 
                $pass =~ /[[:upper:]] and 
                $pass =~ /[[:digit:]] ;
    }

-- 
Glenn Jackman
Ulterior Designer


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

Date: 15 Jun 2006 17:28:48 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: Testing a new password
Message-Id: <slrne9366h.i06.glennj@smeagol.ncf.ca>

At 2006-06-15 10:58AM, Mark Drummond <mark@gangwarily.ca> wrote:
>  		for (my $i=0; $i < $passlen; $i++) {
>  			$rand = int(rand $#chars+1);
>  			$pass .= $chars[$rand];
>  		}

You could write this more tersely as:
    $pass .= $chars[int rand @chars] for (1..$passlen);


-- 
Glenn Jackman
Ulterior Designer


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

Date: Thu, 15 Jun 2006 13:04:05 GMT
From: Charles DeRykus <ced@blv-sam-01.ca.boeing.com>
Subject: Re: Unix shell script with Perl one-liner causes error
Message-Id: <J0wKAt.34E@news.boeing.com>

Simon O wrote:
> Hi there
> 
> I have this Unix Borne shell script that does something like this in a
> loop :
> 
> for FILE in  *
> do
>    ROW_COUNT_HEADER=`...`
>    if [ ${ROW_COUNT_HEADER} -ne 0 ]
>    then
>       ...
>       # 1) OLD Option with Sed :
>       # cat ${FILE} |  cut -f1-32 | sed  "s/$/ ${FILE}/g" >> file.dat
>       # 2) NEW Option with Perl :
>       cat ${FILE} | cut -f1-32  | perl -ple "s/$/\t${FILE}/g"  >>
> file.dat
>    fi
>    bzip2 ${FILE}
>    mv ${FILE}.bz2 ${LATEST_ARCHIVE}/IGCPDATA/
> done
> 
> I was having problems with using sed, so changed to option 2) using
> perl which then gave a really weird error. It does what it's supposed
> to but when it gets to the bzip / move section, it gives an error as
> though it's still busy with ${FILE} ?? - being driving me MAD ! Almost
> as though Perl is has said it's finished but is not ?
> 
> The error is this :
> 
> bzip2: I/O or other error, bailing out.  Possible reason follows.
> bzip2: No such file or directory
>         Input file = ABS_MTM_By_Trade, output file =
> ABS_MTM_By_Trade.bz2
> bzip2: Deleting output file ABS_MTM_By_Trade.bz2, if it exists.
> bzip2: WARNING: deletion of output file (apparently) failed.
> 
> and of the 29 files in *, this error occurs randomly for only say five
> of the files and the others are ok ??! The files are definitely there.
> 

Maybe you could wrap a sleep/retry loop around `bzip2 ${FILE}` in case 
this is just a transient, recoverable error. This is unrelated to Perl 
though so you might want to try one of the shell groups for followups.

hth,
-- 
Charles DeRykus


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

Date: 15 Jun 2006 08:38:59 -0700
From: "Simon O" <simonozzy@gmail.com>
Subject: Re: Unix shell script with Perl one-liner causes error
Message-Id: <1150385939.425098.202170@y41g2000cwy.googlegroups.com>

Gentlemen,

Thanks for all your helpful suggestions, I've justed joined this group
and am well impressed. I think I've now found a solution, though I
still don't understand why there was a problem.

To reduce rowcounts, for testing purposes, I had put a head in the
chain of piped commands as follows :

cat ${FILE} | cut -f1-32  | head | perl -ple "s/$/\t${FILE}/"  >>
file.dat

When I took it out, it worked fine !?? Confused ..

Sure, my Perl is not great and as always with Perl there are loads of
ways of killing the cat, but it works !.

Thanks
Simon

John W. Krahn wrote:
> Simon O wrote:
> > Thanks John for the alternatives.
> >
> > Not sure that would solve the problem as the error seems to be in the
> > way the shell passes data to Perl and get's it back.
> >
> > Bzip - could be any other command - gzip or mv, for that matter - seems
> > as though the file is locked by Perl ?
>
> No, Perl does not lock the file, and even if you had explicitly flock()ed the
> file, locking files in Unix is only advisory.  Besides which, in your example,
> there is no physical file to lock because the data is being piped to perl from
> another program.
>
>
> > I thought that because it's unix | perl | unix I thought the file
> > handling would all be done by Unix ?
>
> Each process in the pipe, be it cut or sed or awk or tr or perl, etc., treats
> the data the same way.
> 
> 
> John
> -- 
> use Perl;
> program
> fulfillment



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

Date: Thu, 15 Jun 2006 16:06:57 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: Unix shell script with Perl one-liner causes error
Message-Id: <BAfkg.6173$lf4.3778@newsread1.news.pas.earthlink.net>

Mumia W. wrote:
> Simon O wrote:
>>       [...]
>>       # 1) OLD Option with Sed :
>>       # cat ${FILE} |  cut -f1-32 | sed  "s/$/ ${FILE}/g" >> file.dat
>>       # 2) NEW Option with Perl :
>>       cat ${FILE} | cut -f1-32  | perl -ple "s/$/\t${FILE}/g"  >>
>> file.dat
> 
> Perhaps you need to backslash escape that first '$':
>   s/\$/\t${FILE}/g
> 

And don't forget that your ${FILE} might contain slashes that conflict 
with the s/// operator's slashes, so use another delimiter:

s,\$,\t${FILE},g

You can do something like this with sed also.




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

Date: 15 Jun 2006 10:03:07 -0700
From: janfure@gmail.com
Subject: What am I missing in perlre
Message-Id: <1150390987.772448.243550@i40g2000cwc.googlegroups.com>

I wrote a script for detecting alphabetical/non numeric characters:

#!/usr/local/bin/perl -w
use strict;
$_ = '2 3';
if ($_ =~ m/\D/x){
	print "$_ has non numerical character(s)!\n";
}
$_ = '2A 3';
if ($_ =~ m/\D/x){
	print "$_ has non numerical character(s)!\n";
}

This script does not do what I expected, the presence of the space in
the string seems to cause a match with /\D/x, despite the 'x' modifier,
which causes the regex engine to ignore MOST whitespace, but maybe not
the one that mattered to me.

This script (stripping out spaces from $_) does what I expected the
first one to do:

#!/usr/local/bin/perl -w
use strict;
$_ = '2 3';
$_ =~ s/\s+//g;
if ($_ =~ m/\D/){
	print "$_ has non numerical character(s)!\n";
}
$_ = '2A 3';
$_ =~ s/\s+//g;
if ($_ =~ m/\D/){
	print "$_ has non numerical character(s)!\n";
}

What am I missing, is there a better way to match alphabetical letters
than /\D/x?

Jan



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

Date: Thu, 15 Jun 2006 13:22:58 -0400
From: Sherm Pendley <sherm@Sherm-Pendleys-Computer.local>
Subject: Re: What am I missing in perlre
Message-Id: <m23be68hal.fsf@Sherm-Pendleys-Computer.local>

janfure@gmail.com writes:

> I wrote a script for detecting alphabetical/non numeric characters:
>
> #!/usr/local/bin/perl -w
> use strict;
> $_ = '2 3';
> if ($_ =~ m/\D/x){
> 	print "$_ has non numerical character(s)!\n";
> }
> $_ = '2A 3';
> if ($_ =~ m/\D/x){
> 	print "$_ has non numerical character(s)!\n";
> }
>
> This script does not do what I expected, the presence of the space in
> the string seems to cause a match with /\D/x, despite the 'x' modifier,
> which causes the regex engine to ignore MOST whitespace

The 'x' modifier ignores whitespace and comments *in the pattern*, not in
the target string. It allows you to write stuff like this:

    m/
        \w      # One alphanumeric character
        \d*     # Followed by zero or more digits
     /x;

> What am I missing, is there a better way to match alphabetical letters
> than /\D/x?

    m/[[:alpha:]]/;

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Thu, 15 Jun 2006 08:21:21 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Why doesn't chdir (@args) work?
Message-Id: <slrne92nmh.3am.tadmc@magna.augustmail.com>

Spurrious Umlaut <not-for-email@example.com> wrote:
> "register_allocation" <register_allocation@lycos.com> wrote in 
> news:nP3kg.13122$921.10188@newsread4.news.pas.earthlink.net:
> 
>> [...] Does chdir
>> have a prototype? 
> 
> I figured it out.  Looks like it's prototyped as chdir(;$),


Which can be pretty easily observed by the 1st line of the chdir docs:

       chdir EXPR

If it wanted a list, it would have been

       chdir LIST

(which doesn't make much sense of course, you can't have
 multiple working directories.
)

-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 15 Jun 2006 12:21:52 -0400
From: karl zero <karl_zero@free.net>
Subject: Re: WIN32::PIPE bug ?
Message-Id: <zQfkg.15184$jb.28405@wagner.videotron.net>

Hi Rob,
thanks for the update


> What version of perl are you using ?
> If you're running ActiveState perl, which build ?
> Which version of Win32::Pipe are you running ?
> 
> I'm running perl 5.8.8, AS build 817, Win32:Pipe-0.22:
> 
> E:\>perl -e "print $ActivePerl::VERSION"
> 817
> E:\>perl -MWin32::Pipe -e "print $Win32::Pipe::VERSION"
> 0.022
> E:\>
> 

i am using same version of AS as yours and a version of the module from 
Roth site that is most recent than 0.22 (as seen on CPAN)
and guess what ? 0.22 doesn't leak :)
that s good news and that also may be why CPAN doesn't spread the latest 
version.
the module from Roth's site offers more methods though, try it and check 
your memory usage.
Author of this module should be notified of the leak problem, Dave Roth 
if i trust the module header.
http://www.roth.net/perl/pipe/

Karl.



> Cheers,
> Rob
> 
> 
>>server:
>>
>>#!/usr/bin/perl -w
>>
>>use Win32::Pipe;
>>
>>$PipeName = "test";
>>$| = 1;
>>
>>print "Creating pipe \"$PipeName\".\n";
>>
>>if( $Pipe = new Win32::Pipe( $PipeName ) )
>>{
>>     print "Waiting for a client to connect...\n";
>>
>>     if( $Pipe->Connect() )
>>     {
>>         my $In;
>>
>>         while ($In = $Pipe->Read()) {
>>              print "Client sent us: ".$In."";
>>         }
>>         $Pipe->Disconnect();
>>   }
>>   $Pipe->Close();
>>}
>>
>>
>>client:
>>
>>
>>use Win32::Pipe;
>>
>>$PipeName = "\\\\.\\pipe\\test";
>>print "Connecting to $PipeName\n";
>>
>>if( $Pipe = new Win32::Pipe( $PipeName ) )
>>{
>>   print "\nPipe has been opened, writing data to it...\n";
>>   my $Data;
>>
>>   while (1) {
>>     $Data = "Time on " . Win32::NodeName() . " is: " . localtime() .
> 
> "\n";
> 
>>     $Pipe->Write( $Data );
>>   }
>>   $Pipe->Close();
>>}
>>
> 
> 
> 


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 9302
***************************************


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