[28794] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 38 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 16 18:06:00 2007

Date: Tue, 16 Jan 2007 15:05:05 -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, 16 Jan 2007     Volume: 11 Number: 38

Today's topics:
    Re: convert Vbscript to Perl code <uri@stemsystems.com>
    Re: convert Vbscript to Perl code <vronans@nowheresville.spamwall>
    Re: convert Vbscript to Perl code <uri@stemsystems.com>
    Re: convert Vbscript to Perl code <vronans@nowheresville.spamwall>
    Re: convert Vbscript to Perl code <uri@stemsystems.com>
    Re: convert Vbscript to Perl code <greg.ferguson@icrossing.com>
    Re: convert Vbscript to Perl code <RedGrittyBrick@SpamWeary.foo>
    Re: convert Vbscript to Perl code <RedGrittyBrick@SpamWeary.foo>
    Re: convert Vbscript to Perl code <uri@stemsystems.com>
    Re: Piping from perl to C (Marc Espie)
    Re: Position in an array <RedGrittyBrick@SpamWeary.foo>
    Re: Position in an array <bew_ba@gmx.net>
    Re: Position in an array <glex_no-spam@qwest-spam-no.invalid>
    Re: Position in an array <RedGrittyBrick@SpamWeary.foo>
    Re: Postscript-Wizzards? How to set the background for  <RedGrittyBrick@SpamWeary.foo>
    Re: the => operator <bik.mido@tiscalinet.it>
    Re: the => operator <louisREMOVE@REMOVEh4h.com>
    Re: the => operator <abigail@abigail.be>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 16 Jan 2007 14:07:12 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: convert Vbscript to Perl code
Message-Id: <x7odoyn63j.fsf@mail.sysarch.com>

>>>>> "V" == Vronans  <vronans@nowheresville.spamwall> writes:

  V> Tad McClellan wrote:

  V> Your assuming he tried already, when it seems clear that he doesnt know 
  V> where to start, but I think you knew that but had to be 'witty' any how.

  >> Can anyone write it for you? No, only some people can write it for
  V>   ^^^^^^^^^^                   ^^^      ^^^^^^^^^^^^^^^
  >> you.

  V> Why do you ask if 'anyone can', answer 'No', then say 'some people can' 
  V> ? Self contractiction if I ever saw one, or purposely messing with 
  V> someone who is just seeking help. But I guess you deservse to smack 
  V> people silly because you otherwise help, right?

  >> Will anyone write it for you? Probably not.
  >> 
  >> Show us the Perl code you have so far, we cannot "help" with your
  >> Perl code if you do not show us your Perl code.

  V> He didnt post any code, and you knew that, so why are you kicking this 
  V> guy around in the dirt? Maybe if you didnt waste time thinking up half 
  V> wit replies to new people youre writing would make more sense and you 
  V> wouldnt look like a pompus ass school yard bully, mate.

and my bitch is about jerks like you who bitch about how others actually
help people but who don't do any helping themselves. until you have
participated here for some time and with acceptable answers, i would
advise you not to give any advice on how things work here.

and calling someone a bully is bullying too. so get off your own
anonymous (the worst kind of complainer) high horse and try to answer
questions yourself in the most polite way you can. this challenge has
been asked of everyone who ever bitches about how the guidelines are
enforced and not one has ever even started to do anything let alone
succeed. given your initial tone, i have no doubts you will fall into
that pile of talkers with no action.

have a nice perl day,

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: Tue, 16 Jan 2007 12:19:39 -0800
From: "Vronans" <vronans@nowheresville.spamwall>
Subject: Re: convert Vbscript to Perl code
Message-Id: <M6CdnQSsaLbDrjDYnZ2dnUVZ_tWhnZ2d@wavecable.com>

Uri Guttman wrote:
> > > > > > "V" == Vronans  <vronans@nowheresville.spamwall> writes:
>
> > Tad McClellan wrote:
>
> > Your assuming he tried already, when it seems clear that he doesnt
> > know where to start, but I think you knew that but had to be
> > 'witty' any how.
>
>  >> Can anyone write it for you? No, only some people can write it for
> >   ^^^^^^^^^^                   ^^^      ^^^^^^^^^^^^^^^
>  >> you.
>
> > Why do you ask if 'anyone can', answer 'No', then say 'some people
> > can' ? Self contractiction if I ever saw one, or purposely messing
> > with someone who is just seeking help. But I guess you deservse to
> > smack people silly because you otherwise help, right?
>
>  >> Will anyone write it for you? Probably not.
>  >>
>  >> Show us the Perl code you have so far, we cannot "help" with your
>  >> Perl code if you do not show us your Perl code.
>
> > He didnt post any code, and you knew that, so why are you kicking
> > this guy around in the dirt? Maybe if you didnt waste time thinking
> > up half wit replies to new people youre writing would make more
> > sense and you wouldnt look like a pompus ass school yard bully,
> > mate.
>
> and my bitch is about jerks like you who bitch about how others
> actually help people but who don't do any helping themselves. until
> you have participated here for some time and with acceptable answers,
> i would advise you not to give any advice on how things work here.

Amazing how one sided you are. You bitch about ho I bitched but it's 
perfectly ok for Tad and other to do so to others. He did not offer help 
here, and in fact, the amount of posts in which he actually helps seems 
to be actually dropping, but with pundants like yourself support every 
move he makes, no matter how wrong it is, things in this group will 
never improve. I have participated in this and many groups in the past, 
but I tend to find information on my own.

> and calling someone a bully is bullying too. so get off your own
> anonymous (the worst kind of complainer) high horse

Wrong again. Pointing out someone is being a bully is not bullying in 
itself, but rather pointing someting out. If you'd stop and look at how 
he needlessly brates people, instead of giving him complete immunity, we 
might get somewhere.

> and try to answer questions yourself in the most polite way you can.

The point is, why cant _HE_ do that? Or again, he is just free to 
respond however he wishes and its perfect ok for him to do so, right?

> this challenge has
> been asked of everyone who ever bitches about how the guidelines are
> enforced and not one has ever even started to do anything let alone
> succeed. given your initial tone, i have no doubts you will fall into
> that pile of talkers with no action.

No, the problem is people like you who continue to send people like him 
the message that its ok to berate and humiliate people rather than to be 
polite and informative. Google-Groups has all of his uneeded replies if 
you actually bothered to look for your self.

Stop pretending that people like Tad should be completely immune to the 
very things you preach, and maybe you wont sound like such a bloody 
hypocrit.




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

Date: Tue, 16 Jan 2007 15:26:27 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: convert Vbscript to Perl code
Message-Id: <x7bqkyn2fg.fsf@mail.sysarch.com>

>>>>> "V" == Vronans  <vronans@nowheresville.spamwall> writes:

  V> Amazing how one sided you are. You bitch about ho I bitched but it's 
  V> perfectly ok for Tad and other to do so to others. He did not offer help 
  V> here, and in fact, the amount of posts in which he actually helps seems 
  V> to be actually dropping, but with pundants like yourself support every 
  V> move he makes, no matter how wrong it is, things in this group will 
  V> never improve. I have participated in this and many groups in the past, 
  V> but I tend to find information on my own.

i am waiting for any help from you on any topic posted here. tad (and i)
have been doing it for years. next topic.

  >> and calling someone a bully is bullying too. so get off your own
  >> anonymous (the worst kind of complainer) high horse

  V> Wrong again. Pointing out someone is being a bully is not bullying in 
  V> itself, but rather pointing someting out. If you'd stop and look at how 
  V> he needlessly brates people, instead of giving him complete immunity, we 
  V> might get somewhere.

no, you did it in a bullying way with asinine comments and the typical
outsider attitude of 'you suck but i won't/can't help'. next topic.

  >> and try to answer questions yourself in the most polite way you can.

  V> The point is, why cant _HE_ do that? Or again, he is just free to 
  V> respond however he wishes and its perfect ok for him to do so, right?

he does answer all the time. the OP didn't provide anything useful and
was told that. that is useful to the OP. you are not useful to this
group. next topic.

  >> this challenge has
  >> been asked of everyone who ever bitches about how the guidelines are
  >> enforced and not one has ever even started to do anything let alone
  >> succeed. given your initial tone, i have no doubts you will fall into
  >> that pile of talkers with no action.

  V> No, the problem is people like you who continue to send people like him 
  V> the message that its ok to berate and humiliate people rather than to be 
  V> polite and informative. Google-Groups has all of his uneeded replies if 
  V> you actually bothered to look for your self.

no, people like you who never help have no right to complain about those
who help. that is the law of usenet. you lose. next topic. 

  V> Stop pretending that people like Tad should be completely immune to the 
  V> very things you preach, and maybe you wont sound like such a bloody 
  V> hypocrit.

hypocrisy is in the mouth of those who don't help. please to be going
elsewhere to babble as i am done with you. google will archive this for
future historians and i am sure tad and i will look better than you as
we help with perl questions.

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: Tue, 16 Jan 2007 12:43:10 -0800
From: "Vronans" <vronans@nowheresville.spamwall>
Subject: Re: convert Vbscript to Perl code
Message-Id: <uoOdnXZ0nqh8pTDYnZ2dnUVZ_u-unZ2d@wavecable.com>

Uri Guttman wrote:
> > > > > > "V" == Vronans  <vronans@nowheresville.spamwall> writes:
>
> > Amazing how one sided you are. You bitch about ho I bitched but it's
> > perfectly ok for Tad and other to do so to others. He did not offer
> > help here, and in fact, the amount of posts in which he actually
> > helps seems to be actually dropping, but with pundants like
> > yourself support every move he makes, no matter how wrong it is,
> > things in this group will never improve. I have participated in
> > this and many groups in the past, but I tend to find information on
> > my own.
>
> i am waiting for any help from you on any topic posted here. tad (and
> i) have been doing it for years. next topic.

but the point is, how does any amount of help given justify dragging 
someone through the dirt? Dont even try to tell me that doesn't happen 
either.

>  >> and calling someone a bully is bullying too. so get off your own
>  >> anonymous (the worst kind of complainer) high horse
>
> > Wrong again. Pointing out someone is being a bully is not bullying
> > in itself, but rather pointing someting out. If you'd stop and look
> > at how he needlessly brates people, instead of giving him complete
> > immunity, we might get somewhere.
>
> no, you did it in a bullying way with asinine comments and the typical
> outsider attitude of 'you suck but i won't/can't help'. next topic.

Again, hypocritical response. Why is it ok for Tad, among other, to do 
it? That is the point. Stop dancing around the bush.

>  >> and try to answer questions yourself in the most polite way you
> can.
>
> > The point is, why cant _HE_ do that? Or again, he is just free to
> > respond however he wishes and its perfect ok for him to do so,
> > right?
>
> he does answer all the time. the OP didn't provide anything useful and
> was told that. that is useful to the OP. you are not useful to this
> group. next topic.

So why did Tad need to respond at all? Why are you defending him, while 
at the same thing castizing me, when both our posts contributed nothing 
useful to the OP? Stop using double standards.

>  >> this challenge has
>  >> been asked of everyone who ever bitches about how the guidelines
>  are >> enforced and not one has ever even started to do anything let
>  alone >> succeed. given your initial tone, i have no doubts you will
>  fall into >> that pile of talkers with no action.
>
> > No, the problem is people like you who continue to send people like
> > him the message that its ok to berate and humiliate people rather
> > than to be polite and informative. Google-Groups has all of his
> > uneeded replies if you actually bothered to look for your self.
>
> no, people like you who never help have no right to complain about
> those who help. that is the law of usenet. you lose. next topic.

How do you know I've never helped? Why are you using flake arguements to 
dance away from the point? Why is it Tad can make all the useless posts 
he wants and it's -perfectly-OK- ?

> > Stop pretending that people like Tad should be completely immune to
> > the very things you preach, and maybe you wont sound like such a
> > bloody hypocrit.
>
> hypocrisy is in the mouth of those who don't help. please to be going
> elsewhere to babble as i am done with you. google will archive this
> for future historians and i am sure tad and i will look better than
> you as we help with perl questions.

Again you argument purely based on assumptions you make of me. And the 
fact of matter google shows everyone one of his useless posts, like his 
reply to OP here, and yes, historians will judge him and blind followers 
like your self themselves.

Just because someone helps doesn't give them the right to be an ass. 
Just because someone doesnt participate, doesn't mean they cant voice a 
comment. Only a communistic-type mind-set might feel otherwise. 




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

Date: Tue, 16 Jan 2007 15:50:51 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: convert Vbscript to Perl code
Message-Id: <x77ivmn1as.fsf@mail.sysarch.com>

>>>>> "V" == Vronans  <vronans@nowheresville.spamwall> writes:

  V> but the point is, how does any amount of help given justify dragging 
  V> someone through the dirt? Dont even try to tell me that doesn't happen 
  V> either.

give it up. you don't help, you have no rights to comment. end of
discussion.

  V> Again, hypocritical response. Why is it ok for Tad, among other, to do 
  V> it? That is the point. Stop dancing around the bush.

give it up. you don't help, you have no rights to comment. end of
discussion.

  V> So why did Tad need to respond at all? Why are you defending him, while 
  V> at the same thing castizing me, when both our posts contributed nothing 
  V> useful to the OP? Stop using double standards.

give it up. you don't help, you have no rights to comment. end of
discussion.

  V> How do you know I've never helped? Why are you using flake arguements to 
  V> dance away from the point? Why is it Tad can make all the useless posts 
  V> he wants and it's -perfectly-OK- ?

because your name is not familiar and almost of the regular helpers
are. simple. 

so give it up already and go away. you are not helping with perl and not
helping with anything about this group.

btw, tad is the primary author (with plenty of group feedback) of this
group's guidelines which are published regularly. i suggest you read
them. and then you can shut up.

  V> Again you argument purely based on assumptions you make of me. And the 
  V> fact of matter google shows everyone one of his useless posts, like his 
  V> reply to OP here, and yes, historians will judge him and blind followers 
  V> like your self themselves.

no assumptions. you have not mentioned perl once in this thread. guilty
as charged!! 

  V> Just because someone helps doesn't give them the right to be an ass. 
  V> Just because someone doesnt participate, doesn't mean they cant voice a 
  V> comment. Only a communistic-type mind-set might feel otherwise. 

nope. no helping means no commenting on how others help. you
lose. BZZZZZTTT. next contestant please!

BTW you are being mocked and you are even more foolish for attempting to
keep this going. i won't let go until you shut up and leave. keep
proving how foolish you are by continuing. your choice.

or you can actually make some comments about perl for a change. i doubt
that will happen. prove me wrong. i triple dog dare ya!!

have a nice perl day,

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: 16 Jan 2007 12:55:40 -0800
From: "gf" <greg.ferguson@icrossing.com>
Subject: Re: convert Vbscript to Perl code
Message-Id: <1168980940.777548.44600@q2g2000cwa.googlegroups.com>


Boris Skoblo wrote:
> Hi All,
>
> please help me convert following VBscript code to Perl code
> ..............................................................................................
> strLDAP = "LDAP://CN=test,OU=users,DC=tech,DC=com"
> set usr = GetObject(strLDAP)
>
> Wscript.echo usr.TerminalServicesWorkDirectory
> Wscript.echo usr.TerminalServicesInitialProgram
>
> usr.TerminalServicesInitialProgram= "cmd.exe"
> usr.TerminalServicesWorkDirectory= "D:\path"
>
> usr.SetInfo
>
> WScript.echo usr.TerminalServicesInitialProgram
> Wscript.echo usr.TerminalServicesWorkDirectory
>
> Can anyone help?
>
> Thanks!

Hi Boris,

What you're asking is not a trivial thing. As mentioned above, you need
to show what you've tried and what did or did not work. From my
experience doing VBScript to Perl code conversions it looks like what
you posted are some extracted lines from some existing code that is
handling some remove session login. But, those lines don't show how the
original VBScripter handled the issues between the lines you included
and without those we can't put together very usable responses for you.

Translating from one language to another is not a trivial task; To do
it well requires good knowledge of the languages, plus of the hardware
and/or OS and the tasks being accomplished. VBScript is (to my mind) a
lot higher level language than Perl, and VBScript is tightly coupled to
the WIndows OS and Microsoft apps.

To get you started on the right path toward YOU coding a solution,
you'll want to install a copy of ActiveState's PERL, then start reading
through the docs for their flavor of Perl. ActiveState includes a lot
of Windows/DOS only extensions to tie together Perl and the Windows OS
- things you won't find in the standard Perl distribution - so you'll
want to know about those as they'll save you a lot of
wheel-reinvention. Get "Programming Perl" and maybe a book for Perl on
Windows or maybe the Perl for Windows admins book.

Then you'll want to get all the docs for VBScript or at least one
really good VBScript book, and learn it as VBScript is (kind of) an
object-oriented language, where Perl can be procedural or OO (kind of).


Then show some more complete examples of what you've tried and what
didn't work.



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

Date: Tue, 16 Jan 2007 21:55:06 +0000
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: convert Vbscript to Perl code
Message-Id: <X9udnRh4_t4p1DDYnZ2dnUVZ8tChnZ2d@bt.com>

Vronans wrote:
> Tad McClellan wrote:
>> Boris Skoblo <borsk@technion.ac.il> wrote:
>>
>>> please help me convert following VBscript code to Perl code
>> [snip VB code ]
>>> Can anyone help?
>>
>> Sure! What part are you stuck on?
> 
> Your assuming he tried already, when it seems clear that he doesnt know 
> where to start, but I think you knew that but had to be 'witty' any how.

Tad is pointing out that if you want help with Perl, it is a good idea 
to make an attempt and post your code. The Posting Guidelines which are 
posted to this newsgroup twice a week also make this point.

> 
>> Can anyone write it for you? No, only some people can write it for
>   ^^^^^^^^^^                   ^^^      ^^^^^^^^^^^^^^^
>> you.
> 
> Why do you ask if 'anyone can', answer 'No', 

Tad's sentence means "When you wrote 'can anyone help?', did you mean 
'can anyone write it for me?' if so, the answer is no."

> then say 'some people can'? Self contractiction if I ever saw one, 

Not really, "anyone" can mean *all* people. Consider the phrase "can 
anyone convert VB to Perl or are some special skills or knowledge 
required?" Clearly only someone with some knowledge of both VB and Perl 
can translate the OP's VB to Perl. There are *some* people who can do 
this but not *anyone* can do it.

I think Tad is being a bit picky, but I suspect anyone spending years 
answering such questions (as Tad has) is likely to become a bit 
irritated by what appears to be laziness.


>> Show us the Perl code you have so far, we cannot "help" with your
>> Perl code if you do not show us your Perl code.
> 
> He didnt post any code, and you knew that, 

Tad asked him to post what he hadn't posted so far. Only the OP knows 
whether he has already made an attempt at writing a Perl equivalent of 
the VB.


> so why are you kicking this guy around in the dirt?

Tad's request is a reasonable one. I don't feel it equates to being 
kicked in the dirt.  After all this is primarily a newsgroup for helping 
Perl programmers (including learners), not a newsgroup for getting 
complete programs written by other people.



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

Date: Tue, 16 Jan 2007 22:01:05 +0000
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: convert Vbscript to Perl code
Message-Id: <X9udnRt4_t6D1jDYnZ2dnUVZ8tDinZ2d@bt.com>

Wayne M. Poe wrote:
> I don't spend much time in -this- forum, but who the hell are you to 
> tell me I cannot comment? 

http://www.catb.org/~esr/faqs/smart-questions.html#not_losing


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

Date: Tue, 16 Jan 2007 17:05:54 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: convert Vbscript to Perl code
Message-Id: <x73b6amxtp.fsf@mail.sysarch.com>

>>>>> "WMP" == Wayne M Poe <louisREMOVE@REMOVEh4h.com> writes:

  WMP> I don't spend much time in -this- forum, but who the hell are you to 
  WMP> tell me I cannot comment? You are nto a moderator, do please don't quit 
  WMP> your day job.

i have 5 day jobs and i can't quit any of them. all involve coding perl
for high wages. your turn.

  >> because your name is not familiar and almost of the regular helpers
  >> are. simple.

  WMP> HOW does this give them the right to voilate the very rules you preach 
  WMP> to me?

what are you babbling about?

  >> so give it up already and go away. you are not helping with perl and
  >> not helping with anything about this group.

  WMP> Neither are you it seems. you seem to just want to keep on with your 
  WMP> clouded view of people like yourself are completely immune fro mthe 
  WMP> guidelines you hold so high.

hmm, i seem to recall writing about perl here almost every day. your turn.

  >> btw, tad is the primary author (with plenty of group feedback) of this
  >> group's guidelines which are published regularly. i suggest you read
  >> them. and then you can shut up.

  WMP> I dont care if hes the Queen of England, NO ONE has the right to just 
  WMP> berate people the way he does. I have read the guidelines, as I do for 
  WMP> any ng or forum I visit and I'm still puzzeled why hes allowed to 
  WMP> frequently voilate his -own- rules. Should that not reflect on him?

who? don't use dangling pronouns. didn't your third grade english
teacher learn you that?

  >> no assumptions. you have not mentioned perl once in this thread.
  >> guilty as charged!!

  WMP> Neither have you, but I forgot, it's ok for you and your aligned to go 
  WMP> against what ever you preach.

hmm, check google please. not only do i help here, i give talks to my
local pm, at yapc, at oscon (here and across the pond), publish perl
articles, publish popular perl modules on cpan and i also am writing a
module to stop global warming. your turn!

  >> > Just because someone helps doesn't give them the right to be an ass.
  >> > Just because someone doesnt participate, doesn't mean they cant
  >> > voice a comment. Only a communistic-type mind-set might feel
  >> > otherwise.
  >> 
  >> nope. no helping means no commenting on how others help. you
  >> lose. BZZZZZTTT. next contestant please!

  WMP> Funny how you like to self proclaim your self as a game shwo host when 
  WMP> we are supposed to be same level discussing. Just shows oddles about 
  WMP> whats wrong with your general view of things, imho.

that is an incorrect answer. the correct answer is that i help people
(like you!) with perl issues. i don't charge for it here. yous gets
whats youse pays for. and i pays a lot!

  >> BTW you are being mocked and you are even more foolish for attempting
  >> to keep this going. i won't let go until you shut up and leave. keep
  >> proving how foolish you are by continuing. your choice.

  WMP> Unlike you for continually preaching rule and regulations and then 
  WMP> reminding how you and others are free to break them whenever you damn 
  WMP> please. Yes, I'm the one who appears foolish...

what rules have i violated? please quote the guidelines which i have
broken. have you read the guidelines? i ask specific perl questions of
posters in order to help them. so did tad. those are part of teaching
perl. your turn!

  >> or you can actually make some comments about perl for a change. i
  >> doubt that will happen. prove me wrong. i triple dog dare ya!!

  WMP> But you dont have to, right? As for Perl, I make use of it quit a bit my 
  WMP> every day programming needs, at work and at home.

wow. i never use perl for my baking or cooking.

please don't try to defend vronans. you will look as foolish as he does.

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: Tue, 16 Jan 2007 21:28:24 +0000 (UTC)
From: espie@lain.home (Marc Espie)
Subject: Re: Piping from perl to C
Message-Id: <eojg1o$i9h$1@biggoron.nerim.net>

In article <1168963346.806080.219270@11g2000cwr.googlegroups.com>,
Igna <ignleotta@gmail.com> wrote:
>Hello. I have to write a pipe to joint a GUI in perl and a simulation
>program in c. I have read  all the docs found in perl.com and now I am
>trying to make a test with this simple program. It seems working but it
>does not write "bonjour" at the end. Can anybody tell me where my
>mistake is? I will be happy for any sample of code for a pipe between c
>and perl sent to me too.

Read your code before executing, there are several glaring mistakes in there.
>Thanks in advance,
>                            Ignazio
>
>
>
>#include <stdio.h>
>#include <memory.h>
>#include <unistd.h>
>
>char chaine[7];
>int status;
>
>int main( int argc, char ** argv )
>{
>/* create the pipe */
>int pfd[2];


You forgot to call pipe(pfd), didn't you ?
>
> int pid;
> if ((pid = fork()) < 0)
>{
>  printf("fork failed\n");
>  return 2;
>}
>
>if (pid == 0)
>{
>  /* child */
>  close(pfd[0]);

check the system call return!!!

>write(pfd[1],"bonjour",7);
>  dup2(pfd[1], 1); /* connect the write side with stdout */
>
What for ? since you're perfectly happily writing to it.
>  close(pfd[1]); /* close the write side */

Ok, so you close pfd[1]... 1 is still around.
>  printf("CHAINE FILS %s\n",chaine);
>  //return 3;
>  exit(0);
>}
>else
>{
>  /* parent */
>  close(pfd[1]); /* close the unused write side */
>  dup2(pfd[0], 0); /* connect the read side with stdin */
why do you connect stuff if you don't use it ?
>  read (pfd[0],chaine,7);
>
>   close(pfd[0]); /* close the read side */
>  printf("CHAINE PARENT %s\n",chaine);
>   wait(&status);
>}
>}

- don't post sloppy code. Fix more mistakes before you post.
- always, always check all system call returns. You will notice more
errors.
- you don't understand dup2. After dup2(fd, fd2), BOTH fd and fd2 point to
the same opened file (pipe, in that case). you do not need to use dup2 to
write to a pipe. You just need to use it to make sure a pipe points to the
`right' fd. It's used to perform tasks similar like cmd >file in the shell.

The proper idiom for which would be:

fd = open(file, O_WRONLY | O_CREAT| O_TRUNC, 0666);
// check that fd != -1
dup2(fd, 1); // check the result !
if (fd != 1) // XXX
	close(fd); // to avoid having 2 fd on the same files.
exec(cmd); // more or less...

and that has very little to do with perl... in fact, most of this is
highly language independent.

I suggest you read perlipc, and come back when you grok how files and
file descriptors and processes work in a unix settings...


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

Date: Tue, 16 Jan 2007 20:50:27 +0000
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: Position in an array
Message-Id: <sNWdnSa4QKwQpzDYRVnysAA@bt.com>

bernd wrote:
> $count = 0 ;
> foreach ( @testarr ) {
>    if ( $count == 0 ) { print $_ }
>    # same code for all items ....
>    $count++ ;
> }
> 

Isn't that the same as this?

print $testarr[0];
for (@testarr) {
     # ...
}


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

Date: 16 Jan 2007 13:06:43 -0800
From: "bernd" <bew_ba@gmx.net>
Subject: Re: Position in an array
Message-Id: <1168981603.237781.250730@v45g2000cwv.googlegroups.com>


Not at all, I guess. But what is Your intention?

On Jan 16, 9:50 pm, RedGrittyBrick <RedGrittyBr...@SpamWeary.foo>
wrote:
> bernd wrote:
> > $count = 0 ;
> > foreach ( @testarr ) {
> >    if ( $count == 0 ) { print $_ }
> >    # same code for all items ....
> >    $count++ ;
> > }Isn't that the same as this?
>
> print $testarr[0];
> for (@testarr) {
>      # ...
> 
> 
> 
> }- Hide quoted text -- Show quoted text -



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

Date: Tue, 16 Jan 2007 16:11:49 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Position in an array
Message-Id: <45ad4d07$0$706$815e3792@news.qwest.net>

bernd wrote:

Fixed top-post...
> 
> On Jan 16, 9:50 pm, RedGrittyBrick <RedGrittyBr...@SpamWeary.foo>
> wrote:
>> bernd wrote:
>>> $count = 0 ;
>>> foreach ( @testarr ) {
>>>    if ( $count == 0 ) { print $_ }
>>>    # same code for all items ....
>>>    $count++ ;
>>> }Isn't that the same as this?
>> print $testarr[0];
>> for (@testarr) {

 > Not at all, I guess. But what is Your intention?

I think what the person is showing is, if you only want to print the 
first element in @testarr, you can do that by

print $testarr[0];

In other words, there's no need to have a for loop, if all you want to
do is print the first element.  I don't think that has anything
to do with your initial question, however based on the code
above that seems to be a possible point to make.


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

Date: Tue, 16 Jan 2007 22:18:41 +0000
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: Position in an array
Message-Id: <XbSdnTjFqcSj0jDYnZ2dnUVZ8s3inZ2d@bt.com>

bernd top-posted:
> Not at all, I guess. But what is Your intention?
I was wondering what yours was.


C:\>perl bernd.pl
--- bernd begins ---
fee
--- bernd ends ---

--- RGB begins ---
fee
--- RGB ends ---



C:\>type bernd.pl
#!perl

@testarr = qw(fee fie foe fum);

print "--- bernd begins ---\n";
#
# bernd wrote
#
$count = 0 ;
foreach ( @testarr ) {
    if ( $count == 0 ) { print $_ }
    # same code for all items ....
    $count++ ;
}
print "\n--- bernd ends ---\n\n";

print "--- RGB begins ---\n";
#
# RGB wrote
# "Isn't that the same as this?"
#
print $testarr[0];
for (@testarr) {
     # ...
}
print "\n--- RGB ends ---\n";


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

Date: Tue, 16 Jan 2007 20:41:09 +0000
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: Postscript-Wizzards? How to set the background for each letter?
Message-Id: <65Wdnb8gi_LCpTDYnZ2dnUVZ8srinZ2d@bt.com>

Michael Hagedorn wrote:
> Hi,
> I found this little script
> http://www.codebunny.org/coding/index.html#graphics
> --> Shanty: Generates an PostScript file representing an image using 
> coloured text.
> 
> It works fine. You can take any text and any picture you want and get a 
> poster "a la Matrix" or like this
> http://www.codebunny.org/coding/shanty/download/openbsd_a4.pdf
> 
> One problem occurs when I tried to print a poster in DinA1 or DinA0 
> format. The poster doesnt have bright contrasts and it's not very bright.
> To change this it should be possible to change the perl-Script.
> Does anyone know how to realise a setting like this: When i.e. a red 
> letter appears the background of this letter should also set to a darker 
> red. This should increase contrast and brightness?
> 
> In other words: how to change the background color of a letter in 
> dependency of its foreground-color?
> Any ideas? Thank you,
> M.

http://www.blakjak.demon.co.uk/mul_crss.htm

Multi-posted, Answered in comp.lang.postscript


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

Date: Tue, 16 Jan 2007 22:39:11 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: the => operator
Message-Id: <kchqq2lt9cn277prhmc657d0in8f0qcs24@4ax.com>

On Tue, 16 Jan 2007 09:13:44 -0800, "Wayne M. Poe"
<louisREMOVE@REMOVEh4h.com> wrote:

>> --  any document on this opeartor?
      ^
      ^

[snip]
>> Abigail
>> --
>> #!/opt/perl/bin/perl -w
>
>Abigail, why in the name of Larry Wall are you using a sig delimiter for 
>a quote-char ? You do realize you breaking any processor that does 

AFAIK the sig delimiter is "-- \n", so he's *not* using it as a quote
char.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Tue, 16 Jan 2007 13:56:15 -0800
From: "Wayne M. Poe" <louisREMOVE@REMOVEh4h.com>
Subject: Re: the => operator
Message-Id: <515003F1ho4vuU1@mid.individual.net>

Michele Dondi wrote:
> On Tue, 16 Jan 2007 09:13:44 -0800, "Wayne M. Poe"
> <louisREMOVE@REMOVEh4h.com> wrote:
>
> > > --  any document on this opeartor?
>      ^
>      ^
>
> [snip]
> > > Abigail
> > > --
> > > #!/opt/perl/bin/perl -w
> >
> > Abigail, why in the name of Larry Wall are you using a sig
> > delimiter for a quote-char ? You do realize you breaking any
> > processor that does
>
> AFAIK the sig delimiter is "-- \n", so he's *not* using it as a quote
> char.

In some places thats exactly what was there (any plank lien that was 
quoted ends up being "-- \n"), and that makes it break any processor 
that color codes quoting levels as well sigs based on that key you 
noted. 




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

Date: 16 Jan 2007 22:03:55 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: the => operator
Message-Id: <slrneqqiu5.74f.abigail@alexandra.abigail.be>

Wayne M. Poe (louisREMOVE@REMOVEh4h.com) wrote on MMMMDCCCLXXXVI
September MCMXCIII in <URL:news:515003F1ho4vuU1@mid.individual.net>:
``  Michele Dondi wrote:
`` > On Tue, 16 Jan 2007 09:13:44 -0800, "Wayne M. Poe"
`` > <louisREMOVE@REMOVEh4h.com> wrote:
`` >
`` > > > --  any document on this opeartor?
`` >      ^
`` >      ^
`` >
`` > [snip]
`` > > > Abigail
`` > > > --
`` > > > #!/opt/perl/bin/perl -w
`` > >
`` > > Abigail, why in the name of Larry Wall are you using a sig
`` > > delimiter for a quote-char ? You do realize you breaking any
`` > > processor that does
`` >
`` > AFAIK the sig delimiter is "-- \n", so he's *not* using it as a quote
`` > char.
``  
``  In some places thats exactly what was there (any plank lien that was 
``  quoted ends up being "-- \n")

No.

``                                 and that makes it break any processor 
``  that color codes quoting levels as well sigs based on that key you 
``  noted. 

I'll grand you that it will break any processor if my message contained
"-- \n". But it didn't.


Abigail
-- 
END   {print "Hacker\n"}
CHECK {print "another "}
BEGIN {print "Just "   }
INIT  {print "Perl "   }


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

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 V11 Issue 38
*************************************


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