[32401] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3668 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 18 03:09:26 2012

Date: Wed, 18 Apr 2012 00:09:06 -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           Wed, 18 Apr 2012     Volume: 11 Number: 3668

Today's topics:
    Re: Clever implementation for s///r <rweikusat@mssgmbh.com>
    Re: Clever implementation for s///r (Tim McDaniel)
    Re: Clever implementation for s///r <ben@morrow.me.uk>
    Re: Clever implementation for s///r <jl_post@hotmail.com>
    Re: Clever implementation for s///r <derykus@gmail.com>
    Re: Clever implementation for s///r (Tim McDaniel)
    Re: First Commercial Perl Program <ronaldljohnson@gmail.com>
    Re: First Commercial Perl Program <ronaldljohnson@gmail.com>
    Re: First Commercial Perl Program <ronaldljohnson@gmail.com>
    Re: First Commercial Perl Program <jimsgibson@gmail.com>
    Re: First Commercial Perl Program <ben@morrow.me.uk>
        Segfault in 5.10.1 <nospam-abuse@ilyaz.org>
    Re: Segfault in 5.10.1 (Tim McDaniel)
    Re: Segfault in 5.10.1 <ben@morrow.me.uk>
        Tracing Perl (Tim McDaniel)
    Re: Why does this code works without cat ? (Tim McDaniel)
    Re: Why does this code works without cat ? <m@rtij.nl.invlalid>
    Re: Why does this code works without cat ? <hjp-usenet2@hjp.at>
        Win32::OLE: Using own classes in an Excel file <jurgen.muck@yahoo.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 16 Apr 2012 21:17:09 +0100
From: Rainer Weikusat <rweikusat@mssgmbh.com>
Subject: Re: Clever implementation for s///r
Message-Id: <87bomrjut6.fsf@sapphire.mobileactivedefense.com>

tmcd@panix.com (Tim McDaniel) writes:
> So I read that Perl 5.14 (and maybe earlier?) has this nice feature
> s///r:
>
>     If the /r (non-destructive) option is used then it runs the
>     substitution on a copy of the string and instead of returning the
>     number of substitutions, it returns the copy whether or not a
>     substitution occurred. The original string is never changed when
>     /r is used. The copy will always be a plain string, even if the
>     input is an object or a tied variable.
>
> and similarly for tr///r.
>
> So I gather that
>
>     my @newargs = map { split ' ', tr/;,/ /r } @_;
>     
> would split each element of @_ at semicolon/comma/whitespace (multiple
> delimiters in a row are the same as one, leading/trailing delimiters
> are ignored), but not change @_.
>
> Alas that I have Perl 5.8.8 at one place, and it knoweth not s///r and
> tr///r.  Is there any clever way to implement it?  I can see no
> way other than to declare a variable and assign to it

The obvious other idea would be to use a function:

sub cpy { return @_; }


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

Date: Mon, 16 Apr 2012 20:23:35 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: Clever implementation for s///r
Message-Id: <jmhv47$90s$1@reader1.panix.com>

In article <87bomrjut6.fsf@sapphire.mobileactivedefense.com>,
Rainer Weikusat  <rweikusat@mssgmbh.com> wrote:
>The obvious other idea would be to use a function:
>sub cpy { return @_; }

That does file off the specialness.  Thanks!  My test was (in a
different test, not the example purpose what I was asking about)

    my @bpbpbp = map { s/^/f/; $_ } sub{@_}->(@a);

-- 
Tim McDaniel, tmcd@panix.com


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

Date: Mon, 16 Apr 2012 22:15:48 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Clever implementation for s///r
Message-Id: <4peu59-2re1.ln1@anubis.morrow.me.uk>


Quoth tmcd@panix.com:
> So I read that Perl 5.14 (and maybe earlier?) has this nice feature
> s///r:

Not earlier, no.

> So I gather that
> 
>     my @newargs = map { split ' ', tr/;,/ /r } @_;
>     
> would split each element of @_ at semicolon/comma/whitespace (multiple
> delimiters in a row are the same as one, leading/trailing delimiters
> are ignored), but not change @_.
> 
> Alas that I have Perl 5.8.8 at one place, and it knoweth not s///r and
> tr///r.  Is there any clever way to implement it?  I can see no
> way other than to declare a variable and assign to it, like
> 
>     my @t = @_;
>     my @newargs = map { tr/;,/ /; split } @t;
> 
> or
> 
>     my @newargs = map { my $t = $_; $t =~ tr/;,/ /; split(' ', $t) } @_;
> 
> or even -- Lord forfend --
> 
>     my @newargs = map { local $_ = $_; tr/;,/ /; split } @_;

This would be my preferred option. (Actually, my preferred option would
be if this were what 'local' did on its own, but I can understand why it
isn't.) Anyone who's frightened of 'local' doesn't know Perl well enough
yet :).

If you were using 5.10, you'd have a fourth option:

    my @newargs = map { given ($_) { tr/;,/ /; split } } @_;

but tbh I don't think that's an improvement.

All of this is *exactly* why s///r was invented. If there were a decent
alternative it would never have gone in.

> Is there an efficient decent way to produce a copy of an array like @_
> and break the magic link back to the original?  I ask because I had
> been thinking that one way to do it would be if
>     (@_)
> or
>     +@_
> would produce a temp copy of @_, but they don't.  And
>     reverse reverse @_
> is just too cutesy.

The usual idiom for a shallow copy of an arrayref is [@$aref], so my
first thought would be to invert that and use @{[ @_ ]}. You can also
assign through a temporary, which is probably the clearest thing to do:

    map {...} do { my @copy = @_ };

Obviously, as Rainer says, you can wrap that last in a function if you
don't like do blocks. 

However, if I were going to do that I'd probably just reach for
Clone::clone, which makes a deep rather than a shallow copy. In cases
where that makes any difference it's often what you meant, anyway.

Ben



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

Date: Mon, 16 Apr 2012 17:19:12 -0700 (PDT)
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: Clever implementation for s///r
Message-Id: <44b7e7ed-8c82-43a8-b8ec-c94083328bc4@h4g2000yqj.googlegroups.com>

On Apr 16, 1:28=A0pm, t...@panix.com (Tim McDaniel) wrote:
> Alas that I have Perl 5.8.8 at one place, and it knoweth not s///r and
> tr///r. =A0Is there any clever way to implement it? =A0I can see no
> way other than to declare a variable and assign to it, like
>
> =A0 =A0 my @t =3D @_;
> =A0 =A0 my @newargs =3D map { tr/;,/ /; split } @t;


   How about:

      my @newargs =3D map { tr/;,/ /; split } @{ [@_] };

Would this work for you?

   -- Jean-Luc


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

Date: Tue, 17 Apr 2012 00:15:56 -0700 (PDT)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: Clever implementation for s///r
Message-Id: <18524419.1360.1334646956189.JavaMail.geo-discussion-forums@vbgx21>

On Monday, April 16, 2012 12:28:34 PM UTC-7, Tim McDaniel wrote:
> So I read that Perl 5.14 (and maybe earlier?) has this nice feature
> s///r:
> 
>     If the /r (non-destructive) option is used then it runs the
>     substitution on a copy of the string and instead of returning the
>     number of substitutions, it returns the copy whether or not a
>     substitution occurred. The original string is never changed when
>     /r is used. The copy will always be a plain string, even if the
>     input is an object or a tied variable.
> 
> and similarly for tr///r.
> 
> So I gather that
> 
>     my @newargs = map { split ' ', tr/;,/ /r } @_;
>     
> would split each element of @_ at semicolon/comma/whitespace (multiple
> delimiters in a row are the same as one, leading/trailing delimiters
> are ignored), but not change @_.
> 
> Alas that I have Perl 5.8.8 at one place, and it knoweth not s///r and
> tr///r.  Is there any clever way to implement it?  I can see no
> way other than to declare a variable and assign to it, like
> 
>     my @t = @_;
>     my @newargs = map { tr/;,/ /; split } @t;
> 
> or
> 
>     my @newargs = map { my $t = $_; $t =~ tr/;,/ /; split(' ', $t) } @_;
> 
> or even -- Lord forfend --
> 
>     my @newargs = map { local $_ = $_; tr/;,/ /; split } @_;
> 
> none of which are as nice (and that last, while legal, would probably
> make my cow-orkers break out in hives and bring out pitchforks.  Note
> that "my $_" wasn't possible in 5.8.8).
> 
> Is there an efficient decent way to produce a copy of an array like @_
> and break the magic link back to the original?  I ask because I had
> been thinking that one way to do it would be if
>     (@_)
> or
>     +@_
> would produce a temp copy of @_, but they don't.  And
>     reverse reverse @_
> is just too cutesy.
> 

my @newargs = map { tr/;,/ /; split } qq{@_}

Still cute and probably dodgy but brief :) 

-- 
Charles DeRykus


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

Date: Tue, 17 Apr 2012 15:47:24 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: Clever implementation for s///r
Message-Id: <jmk3ac$rp8$1@reader1.panix.com>

In article <18524419.1360.1334646956189.JavaMail.geo-discussion-forums@vbgx21>,
C.DeRykus <derykus@gmail.com> wrote:
>my @newargs = map { tr/;,/ /; split } qq{@_}
>
>Still cute and probably dodgy but brief :) 

I've never before reacted to a comp.lang.perl.* posting with LOLing!

Yeah, dodgy -- it depends on $" alias $LIST_SEPARATOR being a space
(the default) or at worst ;,space.  But if you guarantee that, and you
REALLY shouldn't be changing it globally anyway, Bob's your uncle.

-- 
Tim McDaniel, tmcd@panix.com


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

Date: Mon, 16 Apr 2012 13:29:54 -0700 (PDT)
From: "tbb!/fbr!" <ronaldljohnson@gmail.com>
Subject: Re: First Commercial Perl Program
Message-Id: <5740602.2338.1334608194068.JavaMail.geo-discussion-forums@pbag4>

On Monday, April 2, 2012 1:50:46 PM UTC-7, Rainer Weikusat wrote:
> "tbb!/fbr!" <ronaldljohnson@gmail.com> writes:
> 
> [...]
> 
> 
> > use List::Util qw(shuffle);
> > my $str='1234567890!@#$
> > %^&*()qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM_+{}|:"<>?~`-
> > =[]\;\',./1234567890!@#$
> > %^&*()qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM_+{}|:"<>?~`-
> > =[]\;\',./';
> > my @bits=split(//,$str);
> > my @rnd=shuffle(@bits);
> > my $stringer="@rnd";
> > $stringer=~s/\s//g;
> > $stringer=substr($stringer,0,140);
> 
> $stringer = substr(join('', shuffle(grep { $_ !~ /\s/; } split(//, $str))), 0, 140);
> 
> Especially, it makes more sense to throw the whitespace away before
> shuffling etc than to pass it through to the second-to-last stage of
> this 'processing pipeline' where it is deleted from the string.

it was actually a requirement that spaces be available in the output. please hold out on a reply, as I have recoded the entire routine to work exactly to specifications (as given to me) and will be posting it below.

thank you very much for the reply, as well as showing me how to combine my statements.

Ron


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

Date: Mon, 16 Apr 2012 13:31:56 -0700 (PDT)
From: "tbb!/fbr!" <ronaldljohnson@gmail.com>
Subject: Re: First Commercial Perl Program
Message-Id: <1128571.1262.1334608316850.JavaMail.geo-discussion-forums@pbph10>

> 'cos I'm not that smart, yet...
> I'm working on it, though.
>    Justin.
> -- 
> Justin C, by the sea.

tis true. I've been doing this for about a year now, and am getting better. thank you guys for the critique and help.

Ron



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

Date: Mon, 16 Apr 2012 13:44:21 -0700 (PDT)
From: "tbb!/fbr!" <ronaldljohnson@gmail.com>
Subject: Re: First Commercial Perl Program
Message-Id: <7095990.3.1334609061053.JavaMail.geo-discussion-forums@pbcva6>

On Thursday, March 29, 2012 6:48:25 PM UTC-7, tbb!/fbr! wrote:
> use List::Util qw(shuffle);
> my $str=3D'1234567890!@#$
> %^&*()qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM_+{}|:"<>?~`-
> =3D[]\;\',./1234567890!@#$
> %^&*()qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM_+{}|:"<>?~`-
> =3D[]\;\',./';
> my @bits=3Dsplit(//,$str);
> my @rnd=3Dshuffle(@bits);
> my $stringer=3D"@rnd";
> $stringer=3D~s/\s//g;
> $stringer=3Dsubstr($stringer,0,140);
>=20

That was all wrong. It wasn't randomizing properly (I was cheating with the=
 shuffle routine). Each character had to be random and the space character =
needed to be there too (hence the characters needed the ability to 'repeat'=
 if that's what randomly came up). Here's how I recoded that whole bit:

my $str=3D'1234567890!@#$%^&*()qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJK=
LZXCVBNM_+{}|:"<>?~`-=3D[]\;\'\\,./';
my @bits=3Dsplit(//,"$str");
unshift @bits, "\040";
my $range=3D140;
my $rndn=3Dint(rand($range));
my @nbits;

my $count=3D0;
while ($count < $rndn) {
  $nbits[$count]=3D@bits[rand @bits];
  $count++;
}

my $variable;
open JERK, '>', \$variable;
print JERK @nbits;
print $variable;

The randomization is truly random (or a reasonable facsimile), each charact=
er gets it's chance, and I've allowed for the space character to show up as=
 a space character in the string.

I couldn't figure out how to capture the output of print to a variable (I l=
ooked into sprintf, but that didn't do it either (because of the transform =
string to array, and then back again, without the spaces). The 'my $variabl=
e' section has some  debugging code in there, but the only way I could figu=
re out how to maintain the string properly formatted with space characters,=
 was by doing some googling and using the file handle print to variable met=
hod.=20

Being a novice perl programmer, I don't have enough experience and exposure=
 to do it 'properly' however now the code does exactly what's it's suppose =
to, and it's in 'production'.

As you can see up there in the $str variable, I couldn't just put a space c=
haracter there and have it properly 'processed' hence the unshift @bits \04=
0 (which is the space character).

The work is all in the while routine, and again, it works exactly the way t=
he requirements wanted.=20

I look forward to further critique and learning.

Thank you everyone for not flaming another perl novice. Which I think means=
 I might have made a 'proper' newsgroup post.

Thanks,
Ron


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

Date: Mon, 16 Apr 2012 17:14:35 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: First Commercial Perl Program
Message-Id: <160420121714358412%jimsgibson@gmail.com>

In article
<7095990.3.1334609061053.JavaMail.geo-discussion-forums@pbcva6>,
tbb!/fbr! <ronaldljohnson@gmail.com> wrote:

> On Thursday, March 29, 2012 6:48:25 PM UTC-7, tbb!/fbr! wrote:
> > use List::Util qw(shuffle);
> > my $str='1234567890!@#$
> > %^&*()qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM_+{}|:"<>?~`-
> > =[]\;\',./1234567890!@#$
> > %^&*()qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM_+{}|:"<>?~`-
> > =[]\;\',./';
> > my @bits=split(//,$str);
> > my @rnd=shuffle(@bits);
> > my $stringer="@rnd";
> > $stringer=~s/\s//g;
> > $stringer=substr($stringer,0,140);
> > 
> 
> That was all wrong. It wasn't randomizing properly (I was cheating with the
> shuffle routine). Each character had to be random and the space character
> needed to be there too (hence the characters needed the ability to 'repeat'
> if that's what randomly came up). Here's how I recoded that whole bit:
> 
> my
> $str='1234567890!@#$%^&*()qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM
> _+{}|:"<>?~`-=[]\;\'\\,./';
> my @bits=split(//,"$str");
> unshift @bits, "\040";

split(//,$str) will handle a space character just like other
characters, so you don't need to add "\040" to the array, just put it
in the assignment.

> my $range=140;
> my $rndn=int(rand($range));
> my @nbits;
> 
> my $count=0;
> while ($count < $rndn) {
>   $nbits[$count]=@bits[rand @bits];

That should be:

   $nbits[$count] = $bits[rand @bits];

>   $count++;
> }

You could also use this:

  push( @nbits, $bits[rand @bits] ) for 1..$rndn;

> 
> my $variable;
> open JERK, '>', \$variable;
> print JERK @nbits;
> print $variable;

my $variable = join('',@nbits);

-- 
Jim Gibson


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

Date: Tue, 17 Apr 2012 01:43:11 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: First Commercial Perl Program
Message-Id: <vtqu59-usg1.ln1@anubis.morrow.me.uk>


Quoth Jim Gibson <jimsgibson@gmail.com>:
> In article
> <7095990.3.1334609061053.JavaMail.geo-discussion-forums@pbcva6>,
> tbb!/fbr! <ronaldljohnson@gmail.com> wrote:
> 
> > my @bits=split(//,"$str");

perldoc -q quoting

> > unshift @bits, "\040";
> 
> split(//,$str) will handle a space character just like other
> characters, so you don't need to add "\040" to the array, just put it
> in the assignment.
> 
> > my $range=140;
> > my $rndn=int(rand($range));
> > my @nbits;
> > 
> > my $count=0;
> > while ($count < $rndn) {
> >   $nbits[$count]=@bits[rand @bits];
> 
> That should be:
> 
>    $nbits[$count] = $bits[rand @bits];

 ...and if you had been using 'warnings', perl would have told you so.

> >   $count++;
> > }
> 
> You could also use this:
> 
>   push( @nbits, $bits[rand @bits] ) for 1..$rndn;

Or

    my @nbits = map $bits[rand @bits], 1..$rndn;

Ben



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

Date: Tue, 17 Apr 2012 21:04:24 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Segfault in 5.10.1
Message-Id: <jmklso$a76$1@dont-email.me>

Have not seen segfaults in "recent" Perls for quite a long time (at
least not in scripts which were working for decades ;-).

 powdermilk:/tmp->perl -wle 'local *kid = q(abc); $kid[0]  =~ /[9k]/'
 Segmentation fault
 Exit 139

Is it fixed in newer Perls?

Thanks,
Ilya


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

Date: Tue, 17 Apr 2012 21:12:07 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: Segfault in 5.10.1
Message-Id: <jmkmb7$sba$1@reader1.panix.com>

In article <jmklso$a76$1@dont-email.me>,
Ilya Zakharevich  <nospam-abuse@ilyaz.org> wrote:
>Have not seen segfaults in "recent" Perls for quite a long time (at
>least not in scripts which were working for decades ;-).
>
> powdermilk:/tmp->perl -wle 'local *kid = q(abc); $kid[0]  =~ /[9k]/'
> Segmentation fault
> Exit 139
>
>Is it fixed in newer Perls?

$ perl -v

This is perl 5, version 14, subversion 2 (v5.14.2) built for i386-netbsd

Copyright 1987-2011, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on this
system using "man perl" or "perldoc perl".  If you have access to the Internet,
point your browser at http://www.perl.org/, the Perl Home Page.

$ perl -wle 'local *kid = q(abc); $kid[0]  =~ /[9k]/'

Use of uninitialized value $kid[0] in pattern match (m//) at -e line 1.


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

Date: Wed, 18 Apr 2012 03:38:18 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Segfault in 5.10.1
Message-Id: <q1m169-atr2.ln1@anubis.morrow.me.uk>


Quoth Ilya Zakharevich <nospam-abuse@ilyaz.org>:
> Have not seen segfaults in "recent" Perls for quite a long time (at
> least not in scripts which were working for decades ;-).
> 
>  powdermilk:/tmp->perl -wle 'local *kid = q(abc); $kid[0]  =~ /[9k]/'
>  Segmentation fault
>  Exit 139
> 
> Is it fixed in newer Perls?

The bug is present in all 5.10s and 5.12s, and fixed in 5.14.0. 

git bisect says it was fixed by
http://perl5.git.perl.org/perl.git/commitdiff/8f87837 
, which went into 5.13.11. See also
http://www.nntp.perl.org/group/perl.perl5.porters/2011/02/msg169504.html
 .

(The bug *doesn't* appear to be present in any 5.8s, despite
pp_aelemfast containing the same code as in 5.10. Presumably something
else changed in 5.10 that made that code incorrect, and noone realised
and fixed it.)

Ben



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

Date: Wed, 18 Apr 2012 06:54:09 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Tracing Perl
Message-Id: <jmloeh$n89$1@reader1.panix.com>

I'm uncertain on how exactly to do this, maybe just because I'm very
tired, and I'm away from the work systems in question so I can't
easily experiment.  I'm hoping these questions are easy to answer.

I'm working on a large program.  In a sub, I had it output a stack
trace and then die.  I have a warn in the next enclosing eval several
levels up, right after the call where it started down to the point of
the die ... but $@ has been wiped by the time it reaches that warn.
I really want to find out where.

Complicating factors: it's a LARGE program, and it's running under
Apache, I think (I'm sorry, but I know little of Apache and such).

After a little Googling, I think I want to invoke perl with -d:Trace
in PERL5OPT, and I think the appropriate config file allows me to set
arbitrary environment variables.

Devel::Trace is not installed on the system in question.  I think I
should just run cpan in my user account, find where it puts the
resulting Devel/Trace.pm (and hope that I don't slide into dependency
hell), and make sure -I or whatever is set so Perl can find it.  Do I
have to worry about Devel::Trace being modern but the program is being
run under Perl 5.8.8?  I did stumble over
http://www.effectiveperlprogramming.com/blog/1429 , which shows code
for a simple implementation that is easier to control.

-- 
Tim McDaniel, tmcd@panix.com


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

Date: Mon, 16 Apr 2012 20:25:53 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: Why does this code works without cat ?
Message-Id: <jmhv8h$90s$2@reader1.panix.com>

In article <87fwc3jvax.fsf@sapphire.mobileactivedefense.com>,
Rainer Weikusat  <rweikusat@mssgmbh.com> wrote:
>The original claim was:
> 
>	Furthermore, [cat instead of file redirection] keeps the overall
>	flow of information on a pipeline running from left to
>	right, rather than zig-zagging.
>
>As illustrated in this nice example,
>
>,----
>| cat /etc/motd NetBSD 5.1.2 (PANIX-XEN3U-USER) #0: Wed Feb 15 19:17:33 EST 2012
>| 
>| cat </etc/motd NetBSD 5.1.2 (PANIX-XEN3U-USER) #0: Wed Feb 15 19:17:33
>`----
>
>it actually 'zig-zags' ('zig-zaggs'?) in either case because the
>filename argument is to the right either way.

That's true, but

   cat /etc/motd | some long command line with lots of options | maybe some other command

zig-zags much less than

   some long command line with lots of options /etc/motd | maybe some other command

-- 
Tim McDaniel, tmcd@panix.com


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

Date: Mon, 16 Apr 2012 22:33:54 +0200
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: Why does this code works without cat ?
Message-Id: <iacu59-jb4.ln1@news.rtij.nl>

On Mon, 16 Apr 2012 21:06:30 +0100, Rainer Weikusat wrote:

> As illustrated in this nice example,
> 
> ,----
> | cat /etc/motd NetBSD 5.1.2 (PANIX-XEN3U-USER) #0: Wed Feb 15 19:17:33
> EST 2012 |
> | cat </etc/motd NetBSD 5.1.2 (PANIX-XEN3U-USER) #0: Wed Feb 15 19:17:33
> `----
> 
> it actually 'zig-zags' ('zig-zaggs'?) in either case because the
> filename argument is to the right either way.

Ah got it. You used a post that shows that shows there is another way to 
avoid the zig-zagging, incidentally using cat as an example, and snipped 
the other way. Then you tried to make a point about cat, which was the 
original topic, but not the topic of this post.

Yup, very clear. Not.

M4


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

Date: Tue, 17 Apr 2012 23:04:54 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Why does this code works without cat ?
Message-Id: <slrnjormnn.s7c.hjp-usenet2@hrunkner.hjp.at>

On 2012-04-16 19:39, Martijn Lievaart <m@rtij.nl.invlalid> wrote:
> On Mon, 16 Apr 2012 19:58:26 +0100, Rainer Weikusat wrote:
>>
> You reacted to:
>
>> In bash, file redirection characters do not need to be at the end of a
>> command.
>>
>> $ cat /etc/motd NetBSD 5.1.2 (PANIX-XEN3U-USER) #0: Wed Feb 15 19:17:33
>> EST 2012
>>
>> $ cat </etc/motd NetBSD 5.1.2 (PANIX-XEN3U-USER) #0: Wed Feb 15 19:17:33
>> EST 2012
>>
>> $ </etc/motd cat NetBSD 5.1.2 (PANIX-XEN3U-USER) #0: Wed Feb 15 19:17:33
>> EST 2012
>
> To which you said:
>
>> Unless I'm very much mistaken, the filename argument is in the same
>> position relative to the command both times ...
>
> (conveniently omitting the third command line)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> which is completely irrelevant to both the zigzagging claim and the file 
> redirection claim.
>
> So what am I missing?

My guess is that Rainer is missing something: The third command line,
which indeed doesn't zigzag, while the other two do.

(But personally I would prefer a uuoc to the third one in a shell
script: I suspect that most people don't know that shell feature)

	hp

-- 
   _  | Peter J. Holzer    | Deprecating human carelessness and
|_|_) | Sysadmin WSR       | ignorance has no successful track record.
| |   | hjp@hjp.at         | 
__/   | http://www.hjp.at/ |  -- Bill Code on asrg@irtf.org


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

Date: Tue, 17 Apr 2012 04:26:44 -0700 (PDT)
From: JuergenM <jurgen.muck@yahoo.de>
Subject: Win32::OLE: Using own classes in an Excel file
Message-Id: <10278619.771.1334662004876.JavaMail.geo-discussion-forums@ynmm9>

Hi all,=20

Having an Excel (2003) file with classes and functions, I would like to con=
trol it by Perl (ActivePerl 5.12.4) using Win32::OLE. Running functions wor=
ks well with $excel->Run("fun..."), so does working on worksheets or other =
OLE objects, but I don't know how to instantiate (and use) objects of my ow=
n classes.=20

$obj =3D Variant(VT_DISPATCH, 'clsObject')

returns=20

x $obj
Win32::OLE::Variant=3DSCALAR(0x43ba754)
   -> 71232916

which is of TYPE 'VT_DISPATCH',but it has nothing to do with class 'clsObje=
ct' in the VBAProject of my Excel file and it doesn't know clsObject's meth=
ods and attributes.=20

I didn't find any doc for this task. I would like to migrate my Excel proje=
ct to a Perl project over time, but I have to do it step wise, because it h=
as >150 classes :-) So I have to use existing classes / algorithms.=20

Any tips?

Juergen


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

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:

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

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 V11 Issue 3668
***************************************


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