[23472] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5686 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 21 00:06:16 2003

Date: Mon, 20 Oct 2003 21:05:09 -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           Mon, 20 Oct 2003     Volume: 10 Number: 5686

Today's topics:
        Arguments to CORE::pipe? <newspost@coppit.org>
    Re: C vs Perl <joewwright@earthlink.net>
    Re: C vs Perl <ccya86@yahoo.com>
    Re: C vs Perl <ccya86@yahoo.com>
    Re: C vs Perl <jklaue@ee.tu-berlin.de>
    Re: C vs Perl <ccya86@yahoo.com>
    Re: C vs Perl <jklaue@ee.tu-berlin.de>
    Re: C vs Perl <ccya86@yahoo.com>
    Re: C vs Perl <jklaue@ee.tu-berlin.de>
    Re: C vs Perl <ccya86@yahoo.com>
    Re: C vs Perl <nroberts@dontemailme.com>
    Re: Help me with is code <no@no.no>
    Re: Help me with is code <tom@nosleep.net>
    Re: How do I make a standalone WIN32 executable from Pe <perlnews@kwcpa.com>
    Re: How do I make a standalone WIN32 executable from Pe <perlnews@kwcpa.com>
    Re: How do I make a standalone WIN32 executable from Pe <beetle@localhost.localdomain>
    Re: How to propagate -w and use strict? <lusol@Dragonfly.cc.lehigh.edu>
        IO::Socket::INET - Listen on exactly two IPs the same t (Kai Bleek)
    Re: IO::Socket::INET - Listen on exactly two IPs the sa <uri@stemsystems.com>
        Is Accessing MS SQL(Windows) from MAC possible? (malu)
    Re: Newbie dumb but quick question <perlnews@kwcpa.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 21 Oct 2003 03:34:15 GMT
From: David Coppit <newspost@coppit.org>
Subject: Arguments to CORE::pipe?
Message-Id: <Pine.BSF.4.56.0310202328080.78514@www.provisio.net>

Perl gurus:

What are the arguments to CORE::pipe? Does it check that the arguments are
either filehandle globs or UNIVERSAL::isa('IO::Handle')?

The reason I ask is that I've written a wrapper class for FileHandle, and
CORE::pipe doesn't seem to be working even though I believe I've tied what I
need to and proxied every method in FileHandle to the wrapped filehandle.

By "doesn't work", I mean that this sort of code:

  my $out = new MyFileHandleWrapper;
  my $in = new MyFileHandleWrapper;

  CORE::pipe $out, $in or die;

  # ... then Fork, close $in and read from $out in the parent,
  # print to $in in the child

Raises warnings about trying to close and print to unopened filehandles.

You can try out the code if you'd like:
http://coppit.org/temp/FileHandle-Unget-0.10.tar.gz

Thanks,
David


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

Date: Mon, 20 Oct 2003 23:42:42 GMT
From: Joe Wright <joewwright@earthlink.net>
Subject: Re: C vs Perl
Message-Id: <3F9472F6.77BA@earthlink.net>

Programmer Dude wrote:
> 
> len v wrote:
> 
> > A recent (Oct 3) Fox Trox comic (Bill Amend ) got me thinking
> > causing me to edit the origional comic.
> 
> "Origional" ??
> 
> --
> |_ CJSonnack <Chris@Sonnack.com> _____________| How's my programming? |
> |_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL  |
> |_____________________________________________|_______________________|
I just hate spilling errors.
-- 
Joe Wright                                 http://www.jw-wright.com
"Everything should be made as simple as possible, but not simpler."
                    --- Albert Einstein ---


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

Date: Mon, 20 Oct 2003 18:55:22 -0500
From: "len v" <ccya86@yahoo.com>
Subject: Re: C vs Perl
Message-Id: <GB_kb.1924$5M.47211@dfw-read.news.verio.net>


"Joe Wright" <joewwright@earthlink.net> wrote in message
news:3F9472F6.77BA@earthlink.net...
> Programmer Dude wrote:
> >
> > len v wrote:
> >
> > > A recent (Oct 3) Fox Trox comic (Bill Amend ) got me thinking
> > > causing me to edit the origional comic.
> >
> > "Origional" ??
> >
> > --
> > |_ CJSonnack <Chris@Sonnack.com> _____________| How's my programming? |
> > |_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL  |
> > |_____________________________________________|_______________________|
> I just hate spilling errors.
> -- 
> Joe Wright                                 http://www.jw-wright.com
> "Everything should be made as simple as possible, but not simpler."
>                     --- Albert Einstein ---


Note to self.  Find spell checker for vi.

Looks like I spelled it wrong on the web site too.  I've always maintained
that a programmer does not have to spell correctly, just consistent, either
right or wrong - the syntax checker does not care.




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

Date: Mon, 20 Oct 2003 19:07:01 -0500
From: "len v" <ccya86@yahoo.com>
Subject: Re: C vs Perl
Message-Id: <JM_kb.1926$5M.46683@dfw-read.news.verio.net>


"Joona I Palaste" <palaste@cc.helsinki.fi> wrote in message
news:bn164i$qho$1@oravannahka.helsinki.fi...
> len v <ccya86@yahoo.com> scribbled the following
> on comp.lang.c:
> > A recent (Oct 3) Fox Trox comic (Bill Amend ) got me thinking causing me
to
> > edit the origional comic.  Bill then had to write a patch, as most C
> > programers must do.(
ttp://homepage.mac.com/billamend/images/patch.gif  )
>
> > To see the comparison, go to --->  http://perl.hacker.freeservers.com/
>
> Yes, and I could implement a language called FoxTrot that would have the
> following program:
>
> Do it
>
> translate into code that wrote "I will not throw paper airplanes in
> class" 500 times into stdout. But I wouldn't guarantee FoxTrot would be
> useful for anything else.
>
> IOW, one-off cases like these are useless for comparing elegance of
> languages.
>
> -- 
> /-- Joona Palaste (palaste@cc.helsinki.fi) ------------- Finland --------\
> \-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
> "It sure is cool having money and chicks."
>    - Beavis and Butt-head


I see your point and that is exactly what Perl is all about.  If your
FoxTrot implementation had something to offer the community then FoxTrot
would be added to Perl.

Perhaps you could help me out? I've been trying to remember my C and C++
code, it's been about 5 years.  How do I swap the values of 2 strings?





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

Date: Tue, 21 Oct 2003 03:33:21 +0200
From: Jirka Klaue <jklaue@ee.tu-berlin.de>
Subject: Re: C vs Perl
Message-Id: <bn229k$bov$1@mamenchi.zrz.TU-Berlin.DE>

len v wrote:
 ...
> Perhaps you could help me out? I've been trying to remember my C and C++
> code, it's been about 5 years.  How do I swap the values of 2 strings?

Could you define "value of string", please?

Jirka



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

Date: Mon, 20 Oct 2003 21:02:31 -0500
From: "len v" <ccya86@yahoo.com>
Subject: Re: C vs Perl
Message-Id: <Us0lb.1930$5M.47496@dfw-read.news.verio.net>


"Jirka Klaue" <jklaue@ee.tu-berlin.de> wrote in message
news:bn229k$bov$1@mamenchi.zrz.TU-Berlin.DE...
> len v wrote:
> ...
> > Perhaps you could help me out? I've been trying to remember my C and C++
> > code, it's been about 5 years.  How do I swap the values of 2 strings?
>
> Could you define "value of string", please?
>
> Jirka
>

Sure --
I was using a string (scalar) as an example, it could be any two basic types
(ex: int's, char's, float's, reference's, arrays etc.)  However, in keeping
with the original question:

    CString m_firstName;
    CString m_lastName;

put the value of (contents of, address of) m_firstName in m_lastName and put
m_lastName in m_firstName.

Regards
Len




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

Date: Tue, 21 Oct 2003 04:11:59 +0200
From: Jirka Klaue <jklaue@ee.tu-berlin.de>
Subject: Re: C vs Perl
Message-Id: <bn24i2$djm$1@mamenchi.zrz.TU-Berlin.DE>

len v wrote:

>>Could you define "value of string", please?
 ...
> Sure --
 ...
>     CString m_firstName;
>     CString m_lastName;

There is no CString in C, C++ or Perl.

To clarify my question:

   char a[] = "C", b[] = "C++";

   char *a = "C", *b = "C++";

Are a and b strings? What are their values?
How would *you* swap their "values"?

Jirka



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

Date: Mon, 20 Oct 2003 21:45:13 -0500
From: "len v" <ccya86@yahoo.com>
Subject: Re: C vs Perl
Message-Id: <W41lb.1931$5M.47515@dfw-read.news.verio.net>


"Jirka Klaue" <jklaue@ee.tu-berlin.de> wrote in message
news:bn24i2$djm$1@mamenchi.zrz.TU-Berlin.DE...
> len v wrote:
>
> >>Could you define "value of string", please?
> ...
> > Sure --
> ...
> >     CString m_firstName;
> >     CString m_lastName;
>
> There is no CString in C, C++ or Perl.
>
> To clarify my question:
>
>    char a[] = "C", b[] = "C++";
>
>    char *a = "C", *b = "C++";
>
> Are a and b strings? What are their values?
> How would *you* swap their "values"?
>
> Jirka
>

Perhaps I'm not reading it correctly:
http://support.microsoft.com/default.aspx?scid=kb;en-us;111923

A string would be a scalar.  In Perl it would be $a and $b
http://www.perl.com/pub/a/2000/11/begperl2.html  No need to declare the
type.  Scalars can be a numbers, text, references to a scalar, references to
an array, or references to a hash, or references to a sub (a function or
method).  And no need to pre-declare the variable prior to its' use.

Example of strings (scalars) in Perl:

$a = 'C';
$b = 'C++';

$tmp = $a;
$a = $b;
$b = $tmp;

However this is too much work for me, so I was thinking more like:
$a = 'C';
$b = 'C++';

($a, $b) = ($b, $a);

or

($a, $b) = ('C', 'C++');
($a, $b) = ($b, $a);


Regards
Len




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

Date: Tue, 21 Oct 2003 04:57:07 +0200
From: Jirka Klaue <jklaue@ee.tu-berlin.de>
Subject: Re: C vs Perl
Message-Id: <bn276m$f2c$1@mamenchi.zrz.TU-Berlin.DE>

len v wrote:

>>There is no CString in C, C++ or Perl.
 ...
> Perhaps I'm not reading it correctly:
> http://support.microsoft.com/default.aspx?scid=kb;en-us;111923

CString is part of MFC which is *not* part of C++.
Ever heard of std::string?

> Example of strings (scalars) in Perl:
> 
> $a = 'C';
> $b = 'C++';
> 
> $tmp = $a;
> $a = $b;
> $b = $tmp;
> 
> However this is too much work for me, so I was thinking more like:
> $a = 'C';
> $b = 'C++';
> 
> ($a, $b) = ($b, $a);
> 
> or
> 
> ($a, $b) = ('C', 'C++');
> ($a, $b) = ($b, $a);

std::swap(a, b);

Jirka



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

Date: Mon, 20 Oct 2003 22:02:12 -0500
From: "len v" <ccya86@yahoo.com>
Subject: Re: C vs Perl
Message-Id: <Qk1lb.1932$5M.47549@dfw-read.news.verio.net>


"Jirka Klaue" <jklaue@ee.tu-berlin.de> wrote in message
news:bn276m$f2c$1@mamenchi.zrz.TU-Berlin.DE...
> len v wrote:
>
> >>There is no CString in C, C++ or Perl.
> ...
> > Perhaps I'm not reading it correctly:
> > http://support.microsoft.com/default.aspx?scid=kb;en-us;111923
>
> CString is part of MFC which is *not* part of C++.
> Ever heard of std::string?
>
> > Example of strings (scalars) in Perl:
> >
> > $a = 'C';
> > $b = 'C++';
> >
> > $tmp = $a;
> > $a = $b;
> > $b = $tmp;
> >
> > However this is too much work for me, so I was thinking more like:
> > $a = 'C';
> > $b = 'C++';
> >
> > ($a, $b) = ($b, $a);
> >
> > or
> >
> > ($a, $b) = ('C', 'C++');
> > ($a, $b) = ($b, $a);
>
> std::swap(a, b);
>
> Jirka
>


That is what I'm looking for.  Thank you




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

Date: Mon, 20 Oct 2003 20:14:17 -0700
From: Noah Roberts <nroberts@dontemailme.com>
Subject: Re: C vs Perl
Message-Id: <bn28gj$oae$1@quark.scn.rain.com>

len v wrote:

> Note to self.  Find spell checker for vi.
> 
> Looks like I spelled it wrong on the web site too.  I've always maintained
> that a programmer does not have to spell correctly, just consistent, either
> right or wrong - the syntax checker does not care.
> 

My compiler really doesn't like it when I spell freind wrong.


-- 
Noah Roberts
   - "If you are not outraged, you are not paying attention."



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

Date: Mon, 20 Oct 2003 23:57:55 GMT
From: "Public Interest" <no@no.no>
Subject: Re: Help me with is code
Message-Id: <7E_kb.8529$Ec1.786757@bgtnsc05-news.ops.worldnet.att.net>

>
> > I can put whatever address here.
>
>
> So long then.
>
>
> -- 
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas

Do you expect anyone to post a real email here to receive spams? I opened a
temp address last time and within 3 days I put a message on newsgroup, I
start getting 10 the "MS patch" virus per hour. I am not sure if somebody
scaned my address or his/her computer is infected with this virus.




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

Date: Mon, 20 Oct 2003 20:53:35 -0700
From: "Tom" <tom@nosleep.net>
Subject: Re: Help me with is code
Message-Id: <3f94acfa$1@nntp0.pdx.net>


"Public Interest" <no@no.no> wrote in message
news:7E_kb.8529$Ec1.786757@bgtnsc05-news.ops.worldnet.att.net...
> >
> > > I can put whatever address here.
> >
> >
> > So long then.
> >
> >
> > -- 
> >     Tad McClellan                          SGML consulting
> >     tadmc@augustmail.com                   Perl programming
> >     Fort Worth, Texas
>
> Do you expect anyone to post a real email here to receive spams? I opened
a
> temp address last time and within 3 days I put a message on newsgroup, I
> start getting 10 the "MS patch" virus per hour. I am not sure if somebody
> scaned my address or his/her computer is infected with this virus.

don't wworry about it. no one has to receieve spam.
I'll answer your email.
>
>




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

Date: Mon, 20 Oct 2003 20:07:27 -0400
From: Jeff W <perlnews@kwcpa.com>
Subject: Re: How do I make a standalone WIN32 executable from Perl?
Message-Id: <aZOdncqvAuAk5QmiRVn-vg@comcast.com>


>
>I[t] will, but you need to include the cygwin1.dll, and maybe other
>dll-s, depending on how advanced your perlskript is, if you want to
>run it in another MSwin-environment without Cygwin installed.
>  
>

Ok - so I'm back at square one - you're saying I'm just trading the
requirement that the target machine has Perl for the requirement that it
has Cygwin.  Ok.  It was worth asking.  But, time to learn Visual C++
(sigh)  8-}

Thanks all
/j  [no longer a top poster]



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

Date: Mon, 20 Oct 2003 20:09:11 -0400
From: Jeff W <perlnews@kwcpa.com>
Subject: Re: How do I make a standalone WIN32 executable from Perl?
Message-Id: <aZOdncWvAuC85AmiRVn-vg@comcast.com>



Cyde Weys wrote:

>Jeff W wrote:
>
>> thanks!!!! - And from someone with the same name as my favorite
>> Folk/Rock Artist 8-}
>
>Can you please stop top-posting ... please ... think of the kittens.
>  
>

Got it - I'm new to this group - and I have to admit - as good as you
guys are at answering my questions (and you are, really!).  You're twice
as good about telling me to bottom post.   {aren't you supposed to read
prior posts first to see whether I've already been told 8-}]

sorry - don't mean to pick on you  but this about the 5th admonishment
I've received today 8-{



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

Date: Mon, 20 Oct 2003 21:08:54 -0500
From: "beetle" <beetle@localhost.localdomain>
Subject: Re: How do I make a standalone WIN32 executable from Perl?
Message-Id: <pan.2003.10.21.02.08.53.683364@localhost.localdomain>

On Mon, 20 Oct 2003 20:07:27 -0400, Jeff W wrote:

> 
>>
>>I[t] will, but you need to include the cygwin1.dll, and maybe other
>>dll-s, depending on how advanced your perlskript is, if you want to
>>run it in another MSwin-environment without Cygwin installed.
>>  
>>
> 
> Ok - so I'm back at square one - you're saying I'm just trading the
> requirement that the target machine has Perl for the requirement that it
> has Cygwin.  Ok.  It was worth asking.  But, time to learn Visual C++
> (sigh)  8-}
> 
> Thanks all
> /j  [no longer a top poster]

Actually, you can check out Perlbin (Opensource Module), or you can
purchase PerlApp from activestate, or Perl2exe from the people who 
distribute Indigo Perl.

PerlApp works well, and creates a single exe file out of your Perl Script.
 I think Perl2exe does the same thing.

I like perlbin best though even though it was still in development.  It
runs very well, and is in my price range.  Doesn't put everything into one
file though, it makes a directory for your program to run in, and copies
the files your script needs to run into it.




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

Date: 20 Oct 2003 23:19:50 GMT
From: Steve Lidie <lusol@Dragonfly.cc.lehigh.edu>
Subject: Re: How to propagate -w and use strict?
Message-Id: <bn1qim$ivu@fidoii.CC.Lehigh.EDU>

Jay Tilton <tiltonj@erols.com> wrote:
> "Stephen O. Lidie" <lusol@Pandora.cc.lehigh.edu> wrote:
> 
> : Jay Tilton <tiltonj@erols.com> wrote:
> 
> : > The only solution that comes to mind is to devolve "do $ARGV[0]" into
> : > "eval `cat $ARGV[0]`", so you can graft the pragmas onto the code before
> : > it's run.  Like, say,
> : 
> : >    my $code = `cat $ARGV[0]`;
> : >    eval "{use warnings;use strict;$code}";
> : 
> : Hmm, still no luck );
> : 
> : [lusol@Ray:~/Desktop/TRACE4] perl w-test 
> : Name "main::cow" used only once: possible typo at w-test line 5.
> : w-test, $^W=1.
> : [lusol@Ray:~/Desktop/TRACE4] perl w-test3
> : w-test3, $^W=1.
> : w-test, $^W=1.
> : 
> : Where w-test is before, and w-test3 is a modified version of w-test2:
> : 
> : BEGIN {
> :     $^W=1;
> : }
> : print "w-test3, \$^W=$^W.\n";
> : #do './w-test';
> : 
> : my $code = `cat ./w-test`;
> : eval `cat w-test`;
> 
> Odd.  The "once" category of warnings seems to get crippled once runtime
> starts.  I can't do anything to trigger that warning in code that runs
> from a "do EXPR", "eval EXPR", or "require EXPR" statement.
> 
> But ordinary runtime warnings, like the "uninitialized" category, work
> fine.
> 
> I cannot find an explanation for this in the documentation.
> 

Well, you are correct.  So, I was basically doing everything by the book,
but was misled by testing only using a "used once" error.  Thanks, all is
working now, I'm using "do" in particular because errors are listed with 
proper lines numbers - eval's line numbers are relative to the evaled code,
not the script.



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

Date: 20 Oct 2003 16:20:25 -0700
From: public@spellweaver.de (Kai Bleek)
Subject: IO::Socket::INET - Listen on exactly two IPs the same time?
Message-Id: <4b1ad64e.0310201520.5e84dec0@posting.google.com>

Hi there,

I'm just writing some little perl-server using IO:Socket::INET.

Now, I would like to make the server listen to more than one IP
without listening to ALL IPs (0.0.0.0). Is it possible with
IO::Socket::INET at all to give the server a second, maybe third IP?

I'm not that experienced with this module/socket programming. I
googled around but couldn't find any reference to the solution of this
problem (neither did I find someone mention this problem - it seems
I'm the only one who isn't able to solve this - maybe I have
overlooked something really obvious?)

So, if someone has an idea how to get it working that way, please drop
me a hint.

Thanks in advance,
Kai


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

Date: Tue, 21 Oct 2003 00:00:12 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: IO::Socket::INET - Listen on exactly two IPs the same time?
Message-Id: <x7fzhno3xw.fsf@mail.sysarch.com>

>>>>> "KB" == Kai Bleek <public@spellweaver.de> writes:

  KB> Now, I would like to make the server listen to more than one IP
  KB> without listening to ALL IPs (0.0.0.0). Is it possible with
  KB> IO::Socket::INET at all to give the server a second, maybe third IP?

the socket system only allows binding to one IP/port pair or wildcarding
any IP with a single port.

  KB> So, if someone has an idea how to get it working that way, please drop
  KB> me a hint.

the easiest way would be to listen on each desired IP with the same port
and use an event loop or io::select to handle the multiple listen
sockets. once you get a connected socket you can treat them all the same
if needed or differently based on the listen IP. you can get the listen
IP from the socket with the getsockaddr call

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: 20 Oct 2003 15:31:44 -0700
From: demo_malu@yahoo.com (malu)
Subject: Is Accessing MS SQL(Windows) from MAC possible?
Message-Id: <fdd2ae4c.0310201431.27341a99@posting.google.com>

I have two computers interconnected using a LAN.
Mac -Webserver
Windows- Local

I want to read from a database table which is on a MS SQL database(on
Windows Server) from the MAC

I want to run a CGI/Perl script on Mac which print the data from the
MS SQL.
I have DBI installed on MAC.

I have the Local IP address [10.0.0.140], the port number [], the
database username/password of the Windows/MSSQL.

Is this is something achievable?
If it is, can someone give me some pointers?

Thanking you in advace,
Vinod Kumar.


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

Date: Mon, 20 Oct 2003 20:05:11 -0400
From: Jeff W <perlnews@kwcpa.com>
Subject: Re: Newbie dumb but quick question
Message-Id: <aZOdncuvAuCv5QmiRVn-vg@comcast.com>

Never has so much been written about so ltitle 8-}

PS - interesting tidbit - I own my own domain, and to protect against
spam I created a new Email address to post to this group.  Within <1
hour> of my posting I started receiving SPAM to the new Email address. -
scary.

I think we're done here 8-}
/j



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

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


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