[16042] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3454 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 22 14:10:49 2000

Date: Thu, 22 Jun 2000 11:10:36 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <961697435-v9-i3454@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 22 Jun 2000     Volume: 9 Number: 3454

Today's topics:
    Re: I need to get better at Perl mark_f_edwards@my-deja.com
    Re: I'm confused, help please... <softley@natlab.research.philips.com>
    Re: I'm confused, help please... <billy@arnis-bsl.com>
    Re: Know of any good perl books? (Eric Bohlman)
    Re: Know of any good perl books? mark_f_edwards@my-deja.com
    Re: Know of any good perl books? <care227@attglobal.net>
        Looking for mortgage calculations nater@vlender.com
    Re: Newbie question about subroutines... (Bart Lateur)
    Re: Passing filehandles to subroutines (Mike)
    Re: Passing filehandles to subroutines <sariq@texas.net>
    Re: Perl Network Programming (Arek P)
        Perl Programming Style Question <gt6786b@prism.gatech.edu>
    Re: Perl Programming Style Question <blah@nospam.com>
    Re: Perl Programming Style Question (Tim)
    Re: Perl Programming Style Question (Samuel A. Mullen)
    Re: Perl Programming Style Question <care227@attglobal.net>
        Powerfull Regex <g.euzet@gti-info.com>
    Re: Powerfull Regex (Keith Maggert)
    Re: Powerfull Regex <g.euzet@gti-info.com>
    Re: Powerfull Regex <panderse@us.ibm.com>
    Re: Powerfull Regex <care227@attglobal.net>
        PPM Hotfix Fails bayers@my-deja.com
        Problems working with CPAN and ftp... <sergey@cgen.com>
        Question on ARGV peter_5575@my-deja.com
    Re: Question on ARGV (Tim)
    Re: SMS help <dfleet@avaterra.com>
        socket read fails with PerlIS.dll? (David Wall)
        synonyms <aertsko@se.bel.alcatel.be>
    Re: Sys::Syslog & _PATH_LOG <d-weber@itg.uiuc.edu>
        Urgent: Perl Access to MySql wihout DBI.pm possible ??? <whofer@access.ch>
    Re: Urgent: Perl Access to MySql wihout DBI.pm possible <blah@nospam.com>
    Re: Where is @INC in ActiveState Perl for Win32 ??????? <tye@metronet.com>
        Who is the Perl Princess ? martinagoo@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 22 Jun 2000 17:25:57 GMT
From: mark_f_edwards@my-deja.com
Subject: Re: I need to get better at Perl
Message-Id: <8iti6e$cp7$1@nnrp1.deja.com>



 actually, i mean an "advanced learning perl" book to be written by
schwartz & christianson.

i found this book the EASIEST to learn from by far.  i have all the
other books mentioned, and none of them have educated me quite as well
as the excellent "learning perl" book.

i really want the two authors to write another book together, as their
first book begs for a sequal.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 22 Jun 2000 15:24:23 GMT
From: Chris Softley <softley@natlab.research.philips.com>
Subject: Re: I'm confused, help please...
Message-Id: <39522FA7.8DD7A78E@natlab.research.philips.com>

Nathan Wright wrote:
> 
> The following script is giving me trouble...

[SNIP code] 

> For instance, on Thursday the shell window says "4" to "date +%u", but
> the script says "5".

Weird- works fine for me under HPUX-11 and perl version 5.005_02 built
for PA-RISC2.0

Of course, there are other ways to get hold of the day-of-week in perl
which you could (and possibly should) be using. E.g. localtime

HTH,
	Chris.


-----------------------------------------------------------------
Chris Softley            | Phone: +31-40-27-43690
Philips Research, WAY-4, | Email:
Prof. Holstlaan 4,       |  softley@natlab.research.philips.com
5656 AA Eindhoven,       | Project: High Speed Log. Arithmetic,
The Netherlands.         |     see: http://napier.ncl.ac.uk/HSLA
---- Speaking only for myself, not Philips or Newcastle Uni. ----


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

Date: Thu, 22 Jun 2000 15:47:59 GMT
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: I'm confused, help please...
Message-Id: <8itcf8$81t$1@nnrp1.deja.com>

In article <395227A0.6E2692E2@sdrc.com>,
  Nathan Wright <nathan.wright@sdrc.com> wrote:
> The following script is giving me trouble...
>
> #!/usr/local/bin/perl5

#!/usr/local/bin/perl5 -w

use strict;


> print "Content type: text/html \n\n";
> my $WEEKDAY = `date +%u`;
> print "$WEEKDAY";

You do not need quotes here.

>
> The output is always one value greater than what the unix shell window
> displays when I just type "date +%u.
>
> For instance, on Thursday the shell window says "4" to "date +%u", but
> the script says "5".
>
> "date +%d" is working fine though.  The shell value and script value
are
> the same.  I'm missing something really dumb aren't I?from shell
>

On my AIX 4.3 with perl 5.005 it works as expected
printing the same value from shell and perl.

But, look, why do you need to use an external program
to do such a simple thing ?
A much faster and portable way IMHO:

#!/usr/bin/perl -w

use strict;

my $weekday = (localtime(time))[6];

print $weekday;

# that's all

Consult your local 'perldoc -f localtime'
or http://www.cpan.org/doc/manual/html/pod/perlfunc/localtime.html
for more details.

Hope this helps.
Ilja.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 22 Jun 2000 16:03:40 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Know of any good perl books?
Message-Id: <8itdcs$lcb$1@slb6.atl.mindspring.net>

Rob - Rock13.com (rob13@rock13.com) wrote:
: David Bell wrote:
: > 
: > Hello!  I'm looking for a good Perl book.  I've got 'Learning Perl' from
: > O'Reilly, and it's great, but I'd like something a bit more in-depth.  ...And
: > with more CGI info.  I was thinking about getting 'Programming Perl', is this
: > one good?
: 
: Its consider the official language reference so getting it would

No it isn't.  The documentation supplied with perl is considered the 
official language reference for Perl.  The Camel basically represents a 
partial snapshot of Perl's documentation as of four years ago (I 
understand a new edition is in the works).  It's certainly a *very* 
useful resource, but an official reference it is not.


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

Date: Thu, 22 Jun 2000 17:30:47 GMT
From: mark_f_edwards@my-deja.com
Subject: Re: Know of any good perl books?
Message-Id: <8itig8$d49$1@nnrp1.deja.com>

also check:

 http://www.netcat.co.uk/rob/perl/win32perltut.html

it's excellent, and you cannot beat the price.

i hear 'effective perl programming' is pretty good, too.
any book written by RANDAL SCHWARTZ is very educational and useful.


mark_f_edwards@excite.com



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 22 Jun 2000 13:44:17 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Know of any good perl books?
Message-Id: <39525071.84E4E646@attglobal.net>

mark_f_edwards@my-deja.com wrote:
> 
> i hear 'effective perl programming' is pretty good, too.
> any book written by RANDAL SCHWARTZ is very educational and useful.
>                     ^^^^^^^^^^^^^^^


Thanks to the powers that be that Mr. Schwartz is not as picky as
a certain monospaced font/no mixed case/no punctuation after the d
personage known to pass by this way =)

<duck>


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

Date: Thu, 22 Jun 2000 16:57:09 GMT
From: nater@vlender.com
Subject: Looking for mortgage calculations
Message-Id: <8itggq$bbp$1@nnrp1.deja.com>

Hello,
  I am looking for the formulas for mortgage calculators, specifically
rent vs own (buy) calculation.  I have browsed the web, but have only
been able to find the actual calculators running behind cgi scripts
that I cannot Seem to find any help on the source.

  If anyone has these formulas that would be willing to share them, I
would greatly appreciate it.

  Thanks in advance....

    Nate



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 22 Jun 2000 14:57:02 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Newbie question about subroutines...
Message-Id: <395227c2.439784@news.skynet.be>

Vlasis Hatzistavrou wrote:

>I want to launch them together because I want to make a metasearch engine
>andthe searches in the different engines must happen at the same time because
>otherwise it would take a lot of time to wait for one engine to finish, then
>launch the other etc.

An this on NT... Jeez.

You can make each search agent a separate script, and use the
Win32::Process, or the ShellExecute API call through  Win32::API, to
launch the processes. You need to check and wait until each script has
finished, and then make a total report for the results.

-- 
	Bart.


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

Date: 22 Jun 2000 09:37:44 -0700
From: tcsh@holly.colostate.edu (Mike)
Subject: Re: Passing filehandles to subroutines
Message-Id: <slrn8l4cm8.n4n.tcsh@faure.cs.colostate.edu>

tadmc@metronet.com (Tad McClellan):
> On 21 Jun 2000 12:24:46 -0700, Mike <tcsh@holly.colostate.edu> wrote:
> 
>    perldoc -q filehandle
> 

That's as helpful as typing filehandle in at perlfaq.com was.

waters (9:30am) ~ >perldoc -q filehandle
Unknown option: q

Regardless, thanks to a different followup the solution was found.

Thanks anyway,
Mike


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

Date: Thu, 22 Jun 2000 10:56:39 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Passing filehandles to subroutines
Message-Id: <39523737.17EC9402@texas.net>

Mike wrote:
>
> waters (9:30am) ~ >perldoc -q filehandle
> Unknown option: q

Upgrade.

- Tom


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

Date: Thu, 22 Jun 2000 12:35:27 EDT
From: Arek@nospam.pietruszewski.com (Arek P)
Subject: Re: Perl Network Programming
Message-Id: <8itf8f$1rgc$1@earth.superlink.net>

On Thu, 22 Jun 2000 14:54:05 GMT, nfin8axs@hotmail.com wrote:

>I am fairly new to Perl, but one of the things that I am interested
>in is the ability to hand craft your own TCP packets. I am by convention
>C coder (within the Linux platform) and I want to be able to extend some
>of the functionality of my Perl code to have this capacity.
>
>As a separate issue, I was wondering about "type-casting: Is there any
>way I can force a numerical value upon a variable?
> E.G.


>$input = <STDIN>; #user inputs: 12345?
>chop ($input);

I think

$input= int($input);

 will suffice.  It will return an integer of any number, and it
returns zero if it $input is a string. The only problem that I see
with it is how to handle zero case, but u can just introduce another
conditional statement to check for that I guess. 

unless ($input eq "0")    #for zero case
	{
	if (!(int($input))
		{
		print "OOps, we have a string\n";
		}
		else 
		{
		$input =int($input);
		}
this is not tested, but should work.

>
>How can I be sure that $input is numerical and not a string value?
>I have been doing the equivalent to $input=$input+1 but i
>know there has to be a better way to perform this function. Ultimately,
>this value will be used for comparison to over 700,000 cells in a hash
>table, so I need the value to be numeric (because numeric comparisons
>are faster than string.)
>
>If anyone could assist with this, I would be truly appreciative.
>Thanx
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.



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

Date: 22 Jun 2000 13:30:07 GMT
From: Jang Choe <gt6786b@prism.gatech.edu>
Subject: Perl Programming Style Question
Message-Id: <8it4cv$kot$1@news-int.gatech.edu>

Just wondering if it's better to write a perl script like this:

#!/usr/bin/perl -w
use strict;

{
  stuff here; 
}

or like this:

#/usr/bin/perl -w
use strict;

stuff here;

The difference is the braces. Thanks 

-- 





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

Date: Thu, 22 Jun 2000 18:08:21 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: Perl Programming Style Question
Message-Id: <395239F5.6897F341@nospam.com>

Jang,

Jang Choe wrote:
> Just wondering if it's better to write a perl script like this:
> #!/usr/bin/perl -w
> use strict;
> {
>   stuff here;
> }
> or like this:
> #/usr/bin/perl -w
> use strict;
> stuff here;
> The difference is the braces. Thanks

  Since braces define a block and since in a block it is possible to do
some nice things, such as declares local variables (lexically or not),
if you need some of these features you may need braces.  Otherwise, they
only mix up a possible reader.


	Best regards,
		Marco

> 
> --


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

Date: Thu, 22 Jun 2000 16:01:56 GMT
From: SPAM+indigo@dimensional.com (Tim)
Subject: Re: Perl Programming Style Question
Message-Id: <8F5B61A7Aindigodimcom@166.93.207.145>

gt6786b@prism.gatech.edu (Jang Choe) wrote in <8it4cv$kot$1@news-
int.gatech.edu>:

>Just wondering if it's better to write a perl script like this:
>
>#!/usr/bin/perl -w
>use strict;
>
>{
>  stuff here; 
>}
>
>or like this:
>
>#/usr/bin/perl -w
>use strict;
>
>stuff here;
>
>The difference is the braces. Thanks 

The second form is more common for ordinary scripts.  

However, if you are writing a package, you may wish to enclose
you code in braces in case you wish to have package scoped
variables.

-T



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

Date: Thu, 22 Jun 2000 16:27:16 GMT
From: smullen@oppunl.com (Samuel A. Mullen)
Subject: Re: Perl Programming Style Question
Message-Id: <slrn8l4fst.ugj.smullen@smullen.oppunl.com>

Depends, if you prefer putting the braces in, by all means.  Of course
I've never seen anyone else do that, but you do it however you want.

There is no one way to get the job done.  Personally, I'm a bit of a
minimalist, so I leave out as much as possible.

Sam

* Jang Choe <gt6786b@prism.gatech.edu> [22 Jun 2000 13:30:07 GMT]:
> Just wondering if it's better to write a perl script like this:
> 
> #!/usr/bin/perl -w
> use strict;
> 
> {
>   stuff here; 
> }
> 
> or like this:
> 
> #/usr/bin/perl -w
> use strict;
> 
> stuff here;

-- 
 _____________________
/   Samuel A. Mullen  \
|  Programmer Analyst  |_______________________________________________
|  Opportunities Unl.  | But murmured in their tents, [and] hearkened  \
\_____________________/| not unto the voice of the LORD.               |
                       |                    Psalms 106:25              |
                       \_______________________________________________/


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

Date: Thu, 22 Jun 2000 13:33:28 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Perl Programming Style Question
Message-Id: <39524DE8.4A5947A3@attglobal.net>

"Samuel A. Mullen" wrote:

>> {
>>   stuff here; 
>> }
> 
> Depends, if you prefer putting the braces in, by all means.  Of course
> I've never seen anyone else do that, but you do it however you want.
> 
> There is no one way to get the job done.  Personally, I'm a bit of a
> minimalist, so I leave out as much as possible.

I think for reasons of readability, the block should be ommited 
unless needed.  Don't consider such a block a style issue, but 
instead one of function.  If its doung something, use it.  
Otherwise...


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

Date: Thu, 22 Jun 2000 18:04:39 +0200
From: "Gabriel Euzet" <g.euzet@gti-info.com>
Subject: Powerfull Regex
Message-Id: <8itdm7$o5r$1@reader1.fr.uu.net>

Hi

I've tried to use a regex which contain
"[[.foo.]]*guy"
This should match strings like :
fooguy
foofooguy
foo...fooguy

BUT an error occurs and tell me that it is
reserved for future extensions ...
Does somebody know when it will work ?
I absolutely need this !
If you've got any solution thanks to answer.

Gabe





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

Date: Thu, 22 Jun 2000 09:24:09 -0800
From: keith@biomail.ucsd.edu (Keith Maggert)
Subject: Re: Powerfull Regex
Message-Id: <keith-2206000924090001@alexthinkpad.salk.edu>

In article <8itdm7$o5r$1@reader1.fr.uu.net>, "Gabriel Euzet"
<g.euzet@gti-info.com> wrote:

> Hi
> 
> I've tried to use a regex which contain
> "[[.foo.]]*guy"
> This should match strings like :
> fooguy
> foofooguy
> foo...fooguy

I may be misunderstanding your question,but
why not use somthing like:
/(?:foo)*guy/
Cameron


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

Date: Thu, 22 Jun 2000 19:04:22 +0200
From: "Gabriel Euzet" <g.euzet@gti-info.com>
Subject: Re: Powerfull Regex
Message-Id: <8ith65$q24$1@reader1.fr.uu.net>


Keith Maggert <keith@biomail.ucsd.edu> a écrit dans le message :
keith-2206000924090001@alexthinkpad.salk.edu...
> In article <8itdm7$o5r$1@reader1.fr.uu.net>, "Gabriel Euzet"
> <g.euzet@gti-info.com> wrote:
>
> > Hi
> >
> > I've tried to use a regex which contain
> > "[[.foo.]]*guy"
> > This should match strings like :
> > fooguy
> > foofooguy
> > foo...fooguy
>
> I may be misunderstanding your question,but
> why not use somthing like:
> /(?:foo)*guy/
> Cameron

You have understood but, sorry, I've forgoten the ^
"[^[.foo.]]*guy"





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

Date: Thu, 22 Jun 2000 12:01:26 -0500
From: "Paul R. Andersen" <panderse@us.ibm.com>
Subject: Re: Powerfull Regex
Message-Id: <39524666.8D98C74A@us.ibm.com>

Gabriel Euzet wrote:
> 
> Hi
> 
> I've tried to use a regex which contain
> "[[.foo.]]*guy"
> This should match strings like :
> fooguy
> foofooguy
> foo...fooguy
> 
> BUT an error occurs and tell me that it is
> reserved for future extensions ...
> Does somebody know when it will work ?
> I absolutely need this !
> If you've got any solution thanks to answer.
> 
> Gabe

A small experiment reveals that ^[foo]*guy will match what you want. 
You could have done that!

-- 
Paul Andersen
+++++++++++++
The difference between theory and practice is that in theory there is no
difference between theory and practice; but in practice there is.


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

Date: Thu, 22 Jun 2000 13:30:48 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Powerfull Regex
Message-Id: <39524D48.79535041@attglobal.net>

Gabriel Euzet wrote:
> 
> Hi
> 
> I've tried to use a regex which contain
> "[[.foo.]]*guy"
   ^^^^^^^^^

That notation looks alot like the POSIX regex standards.
Might be why you got the error you did, as perl uses a
plain old NFA engine, not the POSIX one.  (Yet?)


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

Date: Thu, 22 Jun 2000 15:26:00 GMT
From: bayers@my-deja.com
Subject: PPM Hotfix Fails
Message-Id: <8itb5i$6r2$1@nnrp1.deja.com>

I've encluded the output of the hotfix below.  The hotfix fails to
repair PPM.

Any ideas?  I might have to go back to an older version.

====================================

C:\Perl\bin>perl -x -S "ppm"  verify --upgrade --location=. PPM
Cannot forceunlink C:\Perl\bin\ppm.bat: Permission denied at
C:/Perl/site/lib/PPM.pm line 617
Installing C:\Perl\site\lib\PPM.pm
Installing C:\Perl\bin\ppm.pl
Writing C:\Perl\site\lib\auto\PPM\.packlist
Package PPM upgraded to version 1,1,4,0

C:\Perl\bin>if NOT "C:\WINNT\system32\cmd.exe" == "C:\WINNT\system32
\cmd.exe" go
to endofperl

C:\Perl\bin>if 0 == 9009 echo You do not have Perl in your PATH.

C:\Perl\bin>if errorlevel 1 goto
script_failed_so_exit_with_non_zero_val  2>nul


C:\Perl\bin>goto endofperl

C:\Perl\bin>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 22 Jun 2000 17:23:39 GMT
From: Sergey Gribov <sergey@cgen.com>
Subject: Problems working with CPAN and ftp...
Message-Id: <39524B3D.D9611E05@cgen.com>

Hello,

I have the firewall setup which requires me to work with passive ftp.
CPAN tries to use ftp, NET::FTP & LWP, but all of them fails because
I can't use active ftp...

When I'm trying to inialize CPAN it tries to get MIRRORED.BY file, but fails...

I've configured lynx to use passive ftp, but it doesn't use lynx at this stage.

How can I configure CPAN to use passive ftp?

Thanks in advance,

//========================================================================\\
        Sergey Gribov                   |   A specialist is someone who
 E-Mail: sergey@cgen.com                | learns more and more about less 
         sergey@sergey.com              | and less, and ends up knowing
 WWW: http://www.sergey.com/            | everything about nothing...

       Compugen Inc.       Phone: (617)9283096, Fax: (617)9283070
\\========================================================================//


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

Date: Thu, 22 Jun 2000 15:44:15 GMT
From: peter_5575@my-deja.com
Subject: Question on ARGV
Message-Id: <8itc8g$a6g$1@nnrp2.deja.com>

I am new to perl and am having problems with command line arguments using the
array @ARGV. I have been reading the book "Learning Perl on win32 systems and
have typed in some of the examples using @ARGV to get command line input, but
the array remains empty. I was wondering if anyone has run into this problem?
Are there any options when compiling perl that enable or disable this? Any
ideas would be appreciated.



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 22 Jun 2000 16:04:26 GMT
From: SPAM+indigo@dimensional.com (Tim)
Subject: Re: Question on ARGV
Message-Id: <8F5B6584Aindigodimcom@166.93.207.145>

peter_5575@my-deja.com wrote in <8itc8g$a6g$1@nnrp2.deja.com>:

>I am new to perl and am having problems with command line arguments
>using the array @ARGV. I have been reading the book "Learning Perl on
>win32 systems and have typed in some of the examples using @ARGV to get
>command line input, but the array remains empty. I was wondering if
>anyone has run into this problem? Are there any options when compiling
>perl that enable or disable this? Any ideas would be appreciated.

You may be experiencing any number of problems.

Please post some code so we might figure out which one it is.

-T


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

Date: Thu, 22 Jun 2000 09:32:00 +0100
From: "David Fleet" <dfleet@avaterra.com>
Subject: Re: SMS help
Message-Id: <3951cd79$1_1@nnrp1.news.uk.psi.net>

Yes, trying to set up my own gateway.
Not sure if I need any specialised hardware, or if I can use a normal http
server with Perl scripts.


"Alan J. Flavell" <flavell@mail.cern.ch> wrote in message
news:Pine.GHP.4.21.0006211726350.6396-100000@hpplus03.cern.ch...
> On Wed, 21 Jun 2000, David Fleet wrote:
>
> > Anyone know if it's possible to send SMS by Perl?
>
> Perl is a complete programming language.  It can program anything
> that's feasible.
>
> SMS's don't get into the GSM network by telepathy or osmosis, they
> need some kind of gateway.  Are you trying to implement a gateway, or
> find one? If you're only looking to find one, then you've not come to
> the best place.
>
> (I send mine by modem dial-up, but there are also email gateways
> etc.).
>




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

Date: 22 Jun 2000 11:25:26 -0400
From: darkon@one.net (David Wall)
Subject: socket read fails with PerlIS.dll?
Message-Id: <8F5B7D223darkononenet@206.112.192.118>


I have a short script to send mail from a web form that suddenly stopped 
working when I installed Perl 5.6.  After some tinkering, I found the 
problem, and extracted the following bit of code (mostly from Sendmail.pm) 
that replicates it.  It works fine when I run it from the command line, but 
as a CGI script it fails, that is, it prints "No data from socket".  Am I 
doing something wrong?

I'm running Activestate Perl 5.6, build 613, on Windows NT 4.0 SP4.


#!/usr/bin/perl -w
use strict;
use Socket;

# simple-minded check for CGI
print "Content-type: text/plain\n\n" if $ENV{'SERVER_PROTOCOL'};

my ($server, $port, $ipaddr, $connected, $str);

$server='smtp.server.example'; # not the real address, obviously
$port=25;
$ipaddr = inet_aton $server;

unless ( socket S, AF_INET, SOCK_STREAM, (getprotobyname 'tcp')[2] ) {
    die "socket failed ($!)"
}
unless ( $connected = connect S, pack_sockaddr_in($port, $ipaddr) ) {
    die "Connect failed! ($!)"
}
$str = <S>;
print $str ? $str : "No data from socket\n";
close S or die "Error closing socket: $!";

-- 
David Wall
darkon@one.net


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

Date: Thu, 22 Jun 2000 18:13:42 +0200
From: Koen Aerts <aertsko@se.bel.alcatel.be>
Subject: synonyms
Message-Id: <39523B36.7A3B3FAE@se.bel.alcatel.be>

Does perl support the use of synonyms (like the #define in C), and if
so, how?

Thanks,
K.


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

Date: Thu, 22 Jun 2000 10:33:15 -0500
From: Daniel Weber <d-weber@itg.uiuc.edu>
Subject: Re: Sys::Syslog & _PATH_LOG
Message-Id: <395231BB.979C6024@itg.uiuc.edu>

Thanks Tom and Jonathan for both responses. I realize a few days isn't long for
responses, but a nagging doubt that it would have been better to cross post
encouraged me to repost.

The suggestion of rebuilding with some ifdefs occurred to me in the shower this
morning too. Perhaps I should follow the "five shower rule": if five days of
clean thinking in the shower hasn't suggested a solution, then post. :-) All the
same, your note gave a couple other ideas, Jonathan.

I should have been clearer regarding the croak: I understood the message wasn't
coming from there, but that the error message in the .pm file indicates that the
 .ph file is being used when in fact it isn't.

Thanks again, and if I come up with a solution, I'll definitely send in patches.

-daniel


-- 

]:o_ | Daniel E. Weber (d-weber@uiuc.edu) - ITG Information Technologies | _o:{
 |O =| 4311 Beckman Institute, 405 N Mathews, Urbana, IL, 61801 MC-251   |= O|
 |_o=| 217-244-3191 (off) * 217-244-6219 (fax) * 217-244-3074 (lab)      |=o_|
  \  |                              *moo*                                |  /


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

Date: Thu, 22 Jun 2000 19:36:02 +0100
From: "WWW_DESIGN_HOSTING" <whofer@access.ch>
Subject: Urgent: Perl Access to MySql wihout DBI.pm possible ???
Message-Id: <8itft3$n7k$1@pacifica.access.ch>

Hi

can anybody tell me how i can access from a Perl-Script to a Mysql Database
( MySql is on a Linux Server ).

I have to make the exam and the system administrator told me, that the
DBI.pm Perl Module
is not installed on the Server. He also told me, that they will never
install DBI.pm on the server !

But how can i have access to MySql from a Perl-Script without the DBI Module
?????

A lot of thanks in advance
Werner Hofer    (whofer@access.ch)





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

Date: Thu, 22 Jun 2000 19:09:01 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: Urgent: Perl Access to MySql wihout DBI.pm possible ???
Message-Id: <3952482D.5468A1B2@nospam.com>

Werner,

WWW_DESIGN_HOSTING wrote:
> can anybody tell me how i can access from a Perl-Script to a 
> Mysql Database ( MySql is on a Linux Server ). I have to make the 
> exam and the system administrator told me, that the DBI.pm Perl 
> Module is not installed on the Server. He also told me, that they 
> will never install DBI.pm on the server !

  Sprinkle your sysadmin with pitch and hen feathers and automagically
he will install a microscopic but powerful tool on the server...  By the
way, are you sure you have to work on that server?  You can easy find a
small Linux box with MySQL and Perl, a poor i486 seems ok for didactic
aims.

> But how can i have access to MySql from a Perl-Script without the 
> DBI Module

  Search the CPAN and hope to find an alternative (e.g., for PostGRESql
DBMS, once upon a time, there was a non-DBI/DBD module called Pg.pm).

	http://www.cpan.org


	Best regards,
		Marco


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

Date: 22 Jun 2000 10:57:05 -0500
From: Tye McQueen <tye@metronet.com>
Subject: Re: Where is @INC in ActiveState Perl for Win32 ???????
Message-Id: <8itd0h$3tl@beanix.metronet.com>

) >Nick Palmer wrote:
) >> 
) >> Nobody seems to know the answer to this question.

an400@freenet.carleton.ca (Steve A. Taylor) writes:
) REGEDIT4
) 
) [HKEY_USERS\.Default\Software\Perl]
) @="d:\\perl56\\bin\\perl.exe"
) "Path"="d:\\perl56\\bin"
) "TERM"="Win32"
) -----------------------
) REGEDIT4
) 
) [HKEY_LOCAL_MACHINE\SOFTWARE\Perl]
) @="d:\\perl56"
) "bindir"="d:\\perl56\\bin"
) "lib"="d:\\server\\lib"
) -----------------------

But the most important information used to fill @INC under Win32
is >>>the location of perl.exe<<<.  When perl.exe is built,
several bits of information are compiled in.  One bit is the
default values for @INC.  But on Win32, there are also some
options compiled in that tell perl to look up the path of the
executable it is running from, delete the last few directories of
it, and tack on things like "lib", "site", an architecture string,
and/or a version string and then stuff the results of these steps
into @INC as well.

So rename the directory where you installed perl from, say
"perl" to "notjava", cd to the "bin" subdirectory where perl.exe
is and type:

    .\perl -e "print qq(@INC)"

and note that now there are probably two entries that mention
"notjava".  [Rename "notjava" back to the orignal name when done
so perl.exe will be in your path again, etc.]  I think the values
in the Registry just add directories to @INC, not overriding the
values that are compiled in or computed from the location of the
executable.  [If you need to know for sure and this isn't
documented, then go read the source code or try an experiment but
realize that undocumented behavior can change between versions of
Perl.]

The values in @INC are a combination of the compiled-in list of
directories, some silly values in the Registry, the values of
environment variables like PERLLIB and PERL5LIB, command-line
options like "-I", things added by scripts [usually via C<use
lib>], directories computed from the location of the executable
[based on compiled-in options], and perhaps other things I haven't
thought of.

Now, if move the location where Perl is installed [on Win32], then
most things magically just work because you move perl.exe and the
"lib" directories together and the "lib" directories are found
based on where perl.exe is.  However, compiling your modules will
stop working.  This is because lib/Config.pm needs to be updated
to know the new locations of the "lib" directories.

Also, CPAN will probably stop working until you tell it to
reconfigure itself.  [Read the CPAN documentation to figure out
how to do this -- I don't know off the top of my head.]

There may be a few other things that cache the Perl installation
directory information but I haven't run into them.
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


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

Date: Thu, 22 Jun 2000 17:26:32 GMT
From: martinagoo@my-deja.com
Subject: Who is the Perl Princess ?
Message-Id: <8iti7h$cpi$1@nnrp1.deja.com>

Find out about this web phenom at
http://oozinggoo.com/perlprincess
She's sweeping the web!
How did this all start?!?!


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 3454
**************************************


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