[12136] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5736 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 20 18:07:21 1999

Date: Thu, 20 May 99 15:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 20 May 1999     Volume: 8 Number: 5736

Today's topics:
    Re: A basic question about passing parameters on the co <aqumsieh@matrox.com>
    Re: A basic question about passing parameters on the co <gellyfish@gellyfish.com>
        A few questions about Perl 5 <tonyboy@earthling.net>
    Re: A few questions about Perl 5 (Larry Rosler)
    Re: Any concept of Constant in Perl (Chris Nandor)
        autodecrement tbsmith@deltacom.net
    Re: best way to database stuff using Perl? (Jeffrey Horn)
    Re: Calling unix programs from a perl script / Internal <aqumsieh@matrox.com>
    Re: Calling unix programs from a perl script / Internal <gellyfish@gellyfish.com>
    Re: conditional regexp matching. Please advise. <ravik@cyrix.com>
    Re: conditional regexp matching. Please advise. <*@qz.to>
    Re: conditional regexp matching. Please advise. (Bart Lateur)
    Re: conditional regexp matching. Please advise. (Larry Rosler)
    Re: conditional regexp matching. Please advise. (Larry Rosler)
        Defining file test operators? (Andrew Allen)
    Re: email attachment <gellyfish@gellyfish.com>
        File::Copy & HTTPD::UserAdmin/GroupAdmin not working to (Paananen Tero)
        Has anyone ever used "Scilab" with PERL? <tom22@verio.com>
        Net::FTP Socket error <ngkaren@earthlink.net>
    Re: Newbie needs to build stateless TCP/IP server <gellyfish@gellyfish.com>
    Re: open() function... <gellyfish@gellyfish.com>
    Re: Perl "constructors" <jdporter@min.net>
    Re: Perl "constructors" <jdporter@min.net>
    Re: Perl Unicode/Multibyte Support <juex@my-dejanews.com>
        Premature end of Script header and Apache and Internal  <meowmee@my-dejanews.com>
    Re: Problems with @INC, path gets added but use still n <aqumsieh@matrox.com>
        Remote creation of PERL scripts <andyinfo@yahoo.com>
        Socket.pm error messages me@nospam.com
        The Threading of Articles (was Re: pattern matching pro <gellyfish@gellyfish.com>
    Re: Verifying passwd in FreeBSD <gellyfish@gellyfish.com>
    Re: wait(), zombies, and solaris: why won't my children <barmar@bbnplanet.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Thu, 20 May 1999 13:44:28 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: A basic question about passing parameters on the command line.
Message-Id: <x3yn1yz1vr7.fsf@tigre.matrox.com>


"G. Scott Guillot" <gsguillot@demandsolutions.com> writes:

> 'lo everyone.  Basic question about passing parameters to a perl script via
> the command line.  Take the following example:
> 
> perl myscript.pl R E "This is a comment" Y "This is another comment"

[snip]

> My question is how to get those strings passed into my perl script
> as strings and not individual words.  

They are passed as strings. What exactly do you mean? Witness:

% cat > tt.pl
$, = "\n";
print @ARGV;
__END__
^D

% perl tt.pl R E "This is a comment" Y "This is another comment"
R
E
This is a comment
Y
This is another comment

> Right now $ARGV[0] = R, $ARGV[1] = E,
> $ARGV[2] = This (Note the missing "), $ARGV[3] = is, etc.... and what I want
> is
> 
> $ARGV[0] = R
> $ARGV[1] = E
> $ARGV[2] = "This is a comment"
> $ARGV[3] = Y
> $ARGV[4] = "This is another comment"

But this is exactly what you get. Did you try it out?

Ala



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

Date: 20 May 1999 21:06:46 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: A basic question about passing parameters on the command line.
Message-Id: <7i1th6$l1$1@gellyfish.btinternet.com>

On Thu, 20 May 1999 09:29:47 -0500 G. Scott Guillot wrote:
> 'lo everyone.  Basic question about passing parameters to a perl script via
> the command line.  Take the following example:
> 
> perl myscript.pl R E "This is a comment" Y "This is another comment"
> 
> There are five parameters being passed there; the letter R, the letter E, a
> string "This is a comment", the letter Y, and then finally another string
> "This is another comment".
> 
> My question is how to get those strings passed into my perl script as
> strings and not individual words.  Right now $ARGV[0] = R, $ARGV[1] = E,
> $ARGV[2] = This (Note the missing "), $ARGV[3] = is, etc.... and what I want
> is
> 

Well I'd like to see what you are doing with your parameters.

If You run this :


#!/usr/bin/perl -w


foreach (@ARGV )
{
   print $_,"\n";
}

This should behave as expected.  If it doesnt then something strange is
happening - you should post the output of 'perl -v' perhaps.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Thu, 20 May 1999 17:13:26 -0400
From: "Anthony Lalande" <tonyboy@earthling.net>
Subject: A few questions about Perl 5
Message-Id: <7i1tp8$hoe@tandem.CAM.ORG>

Greetings.

I'm relatively new at scripting, and probalby don't have all the best
methods, since I've learned almost completely by imitation and examples.

I have a few questions. If you could provide an answer, I would _greatly_
appreciate it if you could forward the answer directly to me (and if you
want), post the answer to the newsgroup as well.

My questions:

1- I have a text file with many entries (in order) separated by returns. I
would like to create an array, using a command like:

@array = sort(<FILE>);

However, I don't want the sorting effects of the sort command, just the
delimiting effects. I've tried lines like the following:

@array = split(/\n/,<FILE>); or
@array = split(/\r/,<FILE>);

 ... but none of these seem to work.

2- This one is a little more web-oriented. Is there any way to pass
arguments through Server-Side Includes?

3- Supposing I have a variable: $temporary and the string "button". How
could I merge the two into a printable string:

print "$temporary\button";

This will interpret the b as a control-character. How could I just use a
null character to delimit the end of the variable name and the beginning of
the string character?

Thanks a lot,
- Anthony Lalande


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

Date: Thu, 20 May 1999 14:47:24 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: A few questions about Perl 5
Message-Id: <MPG.11ae22c37290ec59989ad1@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7i1tp8$hoe@tandem.CAM.ORG> on Thu, 20 May 1999 17:13:26 -
0400, Anthony Lalande <tonyboy@earthling.net> says...
+ I'm relatively new at scripting, and probalby don't have all the best
+ methods, since I've learned almost completely by imitation and
+ examples.

I don't grok 'scripting'.  We do programing here!

+ I have a few questions. If you could provide an answer, I would
+  _greatly_appreciate it if you could forward the answer directly to 
+ me (and if you want), post the answer to the newsgroup as well.

Certainly.  Please use shorter lines in the future (72 characters).

+ My questions:

You'd be better off with separate posts for each question in the future.

+ 1- I have a text file with many entries (in order) separated by
+ returns. I would like to create an array, using a command like:
+ 
+ @array = sort(<FILE>);
+ 
+ However, I don't want the sorting effects of the sort command, just
+ the delimiting effects. I've tried lines like the following:
+ 
+ @array = split(/\n/,<FILE>); or
+ @array = split(/\r/,<FILE>);
+ 
+ ... but none of these seem to work.

  @array = <FILE>;

Perl is great!  It does what you want directly.  (<FILE> in list context 
returns the entire file as an array of lines.)
 
+ 2- This one is a little more web-oriented. Is there any way to pass
+ arguments through Server-Side Includes?

No clue.  Is this a Perl question?
 
+ 3- Supposing I have a variable: $temporary and the string "button".
+ How could I merge the two into a printable string:
+ 
+ print "$temporary\button";
+ 
+ This will interpret the b as a control-character. How could I just use
+ a null character to delimit the end of the variable name and the 
+ beginning of the string character?

  print "${temporary}button";

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 20 May 1999 19:03:43 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Any concept of Constant in Perl
Message-Id: <pudge-2005991503470001@192.168.0.77>

In article <7i1al1$9d5$1@owl.slip.net>, "Stephen Warren"
<swarren@www.wwwdotorg.org> wrote:

# Jalil Feghhi <jalil@corp.home.net> wrote in message
# news:927158122.300751@zeppelin.svr.home.net...
# > Is there any way to define constants in Perl?
# 
# One would typically just have a variable somewhere and assign the value to
# it somewhere:
# 
# $varname = 10 ;
# 
# Then just use this like any scalar in your program.
# 
# There probably are ways of making it read-only if you're paranoid. I'll let
# someone else answer that!

Well, you can make a read-only scalar like so:

  *FOO = \10;

But a "better" way is inlined subs:

  BEGIN {
    sub FOO () { 10 }
    sub BAR () { 11 }
    sub BAZ () { 12 }
  }

Note the empty prototypes and BEGIN block.  Another way to do this is with
the use constant pragma, which does basically the same thing:

  use constant FOO => 10;
  use constant BAR => 11;
  use constant BAZ => 12;

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: Thu, 20 May 1999 21:34:56 GMT
From: tbsmith@deltacom.net
Subject: autodecrement
Message-Id: <7i1v61$je5$1@nnrp1.deja.com>

Why was it decided that Perl's autodecrement operator would not be
magical?

--
----------------
Todd Smith -japh
ITC^DeltaCom
tbsmith@deltacom.net


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: 20 May 1999 19:52:00 GMT
From: horn@wheel.cs.wisc.edu (Jeffrey Horn)
Subject: Re: best way to database stuff using Perl?
Message-Id: <7i1p51$nma@spool.cs.wisc.edu>

> Oracle, Ingres and MySQL are all very good no doubt. But theres one
> little difference between these and Perl and Linux, they are not free.
> Isnt there any free GOOD RDBMS i can use with perl? PostGres is free but
> anyone knows where i can find a DBI driver for Postgres?

It is my understanding that DBD::Pg is the database driver for Postgres.
I don't understand why they shortened the name for this driver.

-- Jeff Horn
-- 
Jeffrey Horn (horn@cs.wisc.edu)        |BELZER,BERNHARDT,BOETTCHER,DRAVIS,FETTER
PHONE:(608) 846-1932                   |GAPINSKI,GAUGER,HARMS,HIRSCHINGER,HORNE
FAX:  (608) 846-1934                   |JUECH,KLAJBOR,KROIS,KRONING,LEMKE,RUNGE
http://www.cs.wisc.edu/~horn/horn.html |STOCK,TAUBERT,TRESKE,WILLMERT,ZILLMER


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

Date: Thu, 20 May 1999 14:00:42 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Calling unix programs from a perl script / Internal Server Error
Message-Id: <x3yk8u31v05.fsf@tigre.matrox.com>


Roman Ganhoer <eras023@wi.leidenuniv.nl> writes:

> For example calling the UNIX copy command 'cp' gives no error but
> doesn't execute.

How do you "call" those commands? Could you show us some code?

> When we call the command 'cat' we get an Internal Server Error

Hmmm .. is that CGI I'm smelling?

> What are we doing wrong?

Someone would point out the error in line 17. Another would use the
ESP::Magic::Ball module to figure out the problem. I will remain
silent.

> Can someone help us?

Yeah ... a lot of people can help. It's just very very *VERY* hard to
do it without seeing/feeling some code.



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

Date: 20 May 1999 20:43:37 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Calling unix programs from a perl script / Internal Server Error
Message-Id: <7i1s5p$jm$1@gellyfish.btinternet.com>

On Thu, 20 May 1999 18:02:51 +0200 Roman Ganhoer wrote:
> Hi,
> We are having a problem when executing a Perl script containing a system
> call
> 
> For example calling the UNIX copy command 'cp' gives no error but
> doesn't execute.
> When we call the command 'cat' we get an Internal Server Error
> 
> What are we doing wrong?
> Can someone help us?
> 

I would look at your server logs - which hopefully will give you
more detail as to the nature of the error.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Thu, 20 May 1999 14:11:43 -0500
From: Ravi Kumar <ravik@cyrix.com>
Subject: Re: conditional regexp matching. Please advise.
Message-Id: <37445E6F.F2CDF260@cyrix.com>

Hi,
    This is kind of what I was looking for. You are right in that
I need to capture the value. But $+ would only be partially
helpful for the sentance below.

set addr 0x10000 data deadbeefh bytes 0xff expect bab009h

The regexp would be like so

/set\s+address\s+(**)\s+data(**)\s+bytes\s+(**)\s+expect\s+(**)/
Obviously I wante $1-$4 to contain the numbers without the 'h' and
the '0x'.

What I am trying to avoid is verifying the fields $1 to $4
seperately after extracting from the original sentance.


Larry Rosler wrote:

> In article <37453b0c.21045722@news.skynet.be> on Thu, 20 May 1999
> 16:44:10 GMT, Bart Lateur <bart.lateur@skynet.be> says...
> > Ravi Kumar wrote:
> > >    I have to read in hex numbers specifiable either as 0xffffffff or
> fffffffh.
> > >but not both. I cannot exhaustively try all combinations with several
> > >regexps. How can I do this with one regexp ?
> >
> >       /^(?:0x[0-9A-Fa-f]+|[0-9A-Fa-f]+h)$/
> >
> > but I really can't see what's wrong with
> >
> >       /^0x[0-9A-Fa-f]+$/ or /^[0-9A-Fa-f]+h$/
>
> In a useful snippet, this wouldn't be only a Boolean test but also a
> capture of the value.
>
>   if (/ ^0x ([0-9A-F]+) $  |  ^ ([0-9A-F]+) h$ /ix)
>      { ... Do something with $+ ... }
>
> --
> (Just Another Larry) Rosler



--
Cheers,
--ravi, (ravik,8643)





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

Date: 20 May 1999 20:22:30 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: conditional regexp matching. Please advise.
Message-Id: <eli$9905201612@qz.little-neck.ny.us>

In comp.lang.perl.misc, Ravi Kumar  <ravik@cyrix.com> wrote:
> set addr 0x10000 data deadbeefh bytes 0xff expect bab009h
> 
> The regexp would be like so
> 
> /set\s+address\s+(**)\s+data(**)\s+bytes\s+(**)\s+expect\s+(**)/
> Obviously I wante $1-$4 to contain the numbers without the 'h' and
> the '0x'.

/set \s+ address \s+ (?:0x)?([\da-fA-F]+)h?
     \s+    data \s+ (?:0x)?([\da-fA-F]+)h?
     \s+   bytes \s+ (?:0x)?([\da-fA-F]+)h?
     \s+  expect \s+ (?:0x)?([\da-fA-F]+)h?/x

> What I am trying to avoid is verifying the fields $1 to $4
> seperately after extracting from the original sentance.

This is probably a bad restiction to force upon yourself.
Consider assigning all the matches to an array and using
map to fix them in one swoop if you are worrying about 
having to repeat code to fix them.

Elijah
------
is 'each' a keyword or 3756 in hex?


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

Date: Thu, 20 May 1999 20:34:18 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: conditional regexp matching. Please advise.
Message-Id: <37446fee.2671332@news.skynet.be>

Ravi Kumar wrote:

>    This is kind of what I was looking for. You are right in that
>I need to capture the value. But $+ would only be partially
>helpful for the sentance below.
>
>set addr 0x10000 data deadbeefh bytes 0xff expect bab009h
>
>The regexp would be like so
>
>/set\s+address\s+(**)\s+data(**)\s+bytes\s+(**)\s+expect\s+(**)/
>Obviously I wante $1-$4 to contain the numbers without the 'h' and
>the '0x'.

Well stop trying. Get rid of them afterwards.

  $_ = "set addr 0x10000 data deadbeefh bytes 0xff expect bab009h";
  $hex = '0x[0-9A-Fa-f]+|[0-9A-Fa-f]+h';

@hex=/set\s+addr\w*\s+($hex)\s+data\s+($hex)\s+bytes\s+($hex)\s+expect\s+($hex)/o;
  foreach(@hex) {
	s/^0x// or s/h$//;
  }
  print "Hex numbers: @hex\n";
	

	Bart.


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

Date: Thu, 20 May 1999 13:55:07 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: conditional regexp matching. Please advise.
Message-Id: <MPG.11ae168418c7a611989acf@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

[Instead of bending everyone's brains and wasting their bandwidth by 
quoting the previous post verbatim after your response, select the 
peices you want to comment on, and then comment after each of them.]

In article <37445E6F.F2CDF260@cyrix.com> on Thu, 20 May 1999 14:11:43 -
0500, Ravi Kumar <ravik@cyrix.com> says...
>     This is kind of what I was looking for. You are right in that
> I need to capture the value. But $+ would only be partially
> helpful for the sentance below.
> 
> set addr 0x10000 data deadbeefh bytes 0xff expect bab009h
> 
> The regexp would be like so
> 
> /set\s+address\s+(**)\s+data(**)\s+bytes\s+(**)\s+expect\s+(**)/
> Obviously I wante $1-$4 to contain the numbers without the 'h' and
> the '0x'.
> 
> What I am trying to avoid is verifying the fields $1 to $4
> seperately after extracting from the original sentance.

Yuk.  Here is a 'one-liner' that captures each of the values (looking 
for a word followed by a hex number):

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

$_ = 'set addr 0x10000 data deadbeefh bytes 0xff expect bab009h';

my @values = map hex, grep defined,
  /\w\s+ (?: 0x([0-9A-F]+) | ([0-9A-F]+)h ) \b/gix;

print "@values\n" if @values == 4; # Here is the verification!

__END__

Output:

65536 3735928559 255 12234761

Note that the 'grep defined' is used to pick out the actual match in the 
pair of options for each regex, as $+ did in the previous version.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 20 May 1999 14:16:10 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: conditional regexp matching. Please advise.
Message-Id: <MPG.11ae1b718bfc1da7989ad0@nntp.hpl.hp.com>

In article <eli$9905201612@qz.little-neck.ny.us> on 20 May 1999 20:22:30 
GMT, Eli the Bearded <*@qz.to> says...
> In comp.lang.perl.misc, Ravi Kumar  <ravik@cyrix.com> wrote:
> > set addr 0x10000 data deadbeefh bytes 0xff expect bab009h
> > 
> > The regexp would be like so
> > 
> > /set\s+address\s+(**)\s+data(**)\s+bytes\s+(**)\s+expect\s+(**)/
> > Obviously I wante $1-$4 to contain the numbers without the 'h' and
> > the '0x'.
> 
> /set \s+ address \s+ (?:0x)?([\da-fA-F]+)h?
>      \s+    data \s+ (?:0x)?([\da-fA-F]+)h?
>      \s+   bytes \s+ (?:0x)?([\da-fA-F]+)h?
>      \s+  expect \s+ (?:0x)?([\da-fA-F]+)h?/x

That modifier should be '/ix', of course.

I don't think a sequence of hex digits without the '0x' prefix or the 
'h' suffix is acceptable according to the conditions of the problem, but 
this regex allows it.

In the regex submitted in another post, I used just '\w\s+' to identify 
the names for the succeeding hex values.  That could be replaced by

    \s+ (?: address | data | bytes | expect ) \s+

though that still doesn't deal with values out of order, which your 
regex does deal with.  Maybe it is enough, though.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 20 May 1999 20:07:16 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Defining file test operators?
Message-Id: <7i1q1k$lec$1@fcnews.fc.hp.com>

Is there any way to define (or redefine) a file test operator?

  *{"-F"}=sub{1}; -F("a")

gives

  Unrecognized file test: -F at -e line 1.

which oddly enough, isn't in perldiag. Obviously,

  *{"-F"}=sub{3}; print "-F"->("a");

works, but isn't quite the syntax what I was hoping for.

Also, as I was trying various incantations, I found that

  $a=sub "-F" {1}; print prototype $a; 

prints "-F". Does this have any use? perlsub mentions it (obliquely):

 Some folks would prefer full alphanumeric prototypes. Alphanumerics ve
 been intentionally left out of prototypes for the express purpose of
 someday in the future adding named, formal parameters.

But apparently, not left out of the parser...

Andrew


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

Date: 20 May 1999 19:42:03 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: email attachment
Message-Id: <7i1oib$j9$1@gellyfish.btinternet.com>

On Wed, 19 May 1999 21:21:33 GMT bmccormack7477@my-dejanews.com wrote:
> In article <7h7ca0$ft$1@gellyfish.btinternet.com>,
>   Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>> On Mon, 10 May 1999 17:24:09 +0100 David Craig wrote:
>> >>MIME::Lite is available from CPAN the documentation that comes with
> it has
>> >
>> >
>> > Thanks for that, I found it and the documentation, I am having
> difficulty
>> > extracting the module.  The instructions for use I guess are on a
> UNIX
>> > machine - I'm running WIN32.  Do you have the module to hand that
> you could
>> > mail me?
>> >
>>
>> Er.  If you are using a recent ActiveState Perl then you will be able
> to
>> use PPM to install it which is by far the best thing to do ...
>>
>
> You can just extract lite.pm and put in the path
>  $yourPerlDirectory/lib/MIME/lite.pm
> 

Yeah, right, but if you are using ActiveStates Perl and if the Module is
available as a PPM package (which MIME::Lite is ) then it is infinitely
preferable to use the approved method:  It will cause the index of the
HTML documentation to be updated and the package list.  Also this method
will not work with a majority of modules so it should be considered a
mistake advocating it if a method that will work with all supported modules
exists.  If anything it will stop the posts that start "I read here that
it is possible to copy the .pm files for a module to a directory in
c:\perl\lib so I downloaded DBD::Oracle ... "

/J\

-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 20 May 1999 20:16:34 GMT
From: p116711@ampeeri.ee.tut.fi (Paananen Tero)
Subject: File::Copy & HTTPD::UserAdmin/GroupAdmin not working together?
Message-Id: <7i1qj2$2r9$1@baker.cc.tut.fi>

Perl Version:
This is perl, version 5.005_02 built for sun4-solaris

OS Version:
SunOS <censored> 5.6 Generic_105181-03 sun4u sparc SUNW,Ultra-5_10

Latest HTTPD::UserAdmin / GroupAdmin

Anybody have *any* idea why this little script won't
actually delete the .htpasswd.new and .htgroup.new files?

The move methods return 1 as if they were succesful. The files
do get copied over to .htpasswd and .htgroup, but the old
files don't get deleted.

I've looked in perldocs, the FAQs, DejaNews and AltaVista to
no avail. As far as I know there isn't anything wrong in
what I'm doing.

Please cc by email, my newsserver is flaky.

				-TPP



#!/usr/local/bin/perl

use HTTPD::GroupAdmin;
use HTTPD::UserAdmin;
use File::Copy;

my $create_group = '.htgroup.new';
my $real_group   = '.htgroup';
my $create_user  = '.htpasswd.new';
my $real_user    = '.htpasswd';

@TextGA = (DBType => 'Text',
           DB     => $create_group,
           Server => 'apache',
           Name   => 'test',
           Locking => 0,
           Debug => 'true');

@TextUA = (DBType => 'Text',
           DB     => $create_user,
           Server => 'apache',
           Name   => 'test',
           Locking => 0,
           Debug => 'true');

my $group = new HTTPD::GroupAdmin @TextGA;
my $user  = new HTTPD::UserAdmin @TextUA;

while (<STDIN>)
{
    my ($userid, $passwd) = split( /\t/ );

    $user->add( $userid, $passwd );
    $group->add( $userid );
}

$user->commit();
$group->commit();

print move( $create_group, $real_group ), "\n";
print move( $create_user,  $real_user ), "\n";







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

Date: Thu, 20 May 1999 19:12:34 GMT
From: Tom <tom22@verio.com>
Subject: Has anyone ever used "Scilab" with PERL?
Message-Id: <37445F96.8A46BC74@verio.com>

Hi,

I would like to use PERL for signal processing operations and
simulations but it does not appear to have modules which do FFT's,
filter design, etc. I have used Scilab, a free mathematics package which
is well suited to DSP. I know that it is possible to interface Scilab to
"C" but I was wondering if anyone has interfaced PERL to Scilab instead.

Thanks
Tom
tom@antarestech.com





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

Date: Thu, 20 May 1999 12:31:16 -0700
From: Karen Ng <ngkaren@earthlink.net>
To: comp.lang.perl.modules@earthlink.net
Subject: Net::FTP Socket error
Message-Id: <37446303.CA52DC42@earthlink.net>

Hi,

I am trying to upload a file to a server using Perl and I can't seem to
connect to the server.

This is the error message:
IO::Socket: Cannot configure a generic socket at ftpfile.pl line 5

Line 5:
$ftp = Net::FTP->new("ftp.server..com");

I don't know much about network programming so I would appreciate any
help I can to figure this out.   I am working behind a firewall but the
server I am trying to connect to is also behind the firewall (I need to
get outside the firewall later).

Thanks in advance,
Karen




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

Date: 20 May 1999 19:56:53 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Newbie needs to build stateless TCP/IP server
Message-Id: <7i1pe5$jc$1@gellyfish.btinternet.com>

On Fri, 14 May 1999 09:10:15 -0400 Darrel Davis wrote:
> I need to build a multithreaded stateless TCP/IP server.
> This would be alot like a web server in functionality.  Which
> modules should I look at using?  Are there any web servers
> built in perl?
> 

There are at least two HTTP servers I know of written in Perl - aside
from anything I or someone else might have made for a special purpose.

If you got to <http://reference.perl.com> and follow the obvious links
then you will some stuff on this subject.  Searching DejaNews will almost
certainly find some more.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 20 May 1999 20:55:13 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: open() function...
Message-Id: <7i1srh$jp$1@gellyfish.btinternet.com>

On Thu, 20 May 1999 10:29:16 -0700 Mr. Pumpkin wrote:
> Is there anyway for the open function to open a file using an absolute
> http:// url?
> 
>  eg. open (ORDER,  http://www.site.com/order/index.html")
> 

I believe that someone *did* post some code that implemented a tied
filehandle that would do this.  But underneath it would have used the
LWP::UserAgent module anyhow.  You will probably want to use that module
- part of the libwwwperl bundle from CPAN.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Thu, 20 May 1999 18:56:14 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl "constructors"
Message-Id: <7i1lsc$c7d$1@nnrp1.deja.com>

In article <7hvs6j$2l7$1@nnrp1.deja.com>,
  armchair@my-dejanews.com wrote:
> sub a {
>   my $scalar = $_[0];
> }
>
> my $scalar = myObject->ReturnSomething();
>
> what does $scalar hold at this moment zenin, number, string or
> reference?

It holds what it's supposed to hold.  Those who need to know more, do.

char* p = get_some_chars();

Is the string that p points to null-terminated?  Is it 8-bit clean?
Is it legal SGML?  Maybe get_some_chars actually returns a pointer
to some class instance but has cast it to (char*).  How do you know?

A* p = get_next();

Hmm, does p point to a B, or possibly a C?

--
John Porter
Put it on a plate, son.  You'll enjoy it more.


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Thu, 20 May 1999 19:12:12 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl "constructors"
Message-Id: <7i1mq9$d1q$1@nnrp1.deja.com>

In article <7hvtak$387$1@nnrp1.deja.com>,
  armchair@my-dejanews.com wrote:
>
> With function overloading, you can add new parameter lists and leave
old
> code completely untouched and unmodified. It also makes you code more
> modular. And someone has mentioned a Perl module that somehow allows
> this.

A general discussion of the relative merits of function overloading
is outside the scope of this newsgroup.  But I will say that
overloading, if used at all, must be used very judiciously -- kinda
like multiple inheritance!

Scott Meyers points out that the main use of overloading is for
constructors.  And they're required for that by the definition of
the language  (which restriction Perl fortunately doesn't have).


> The quicker you can see what someone's code is doing, the quicker you
> can get on to making your changes. As much as I hate a standard being
> different from what I want to use, the more things are standardized
the
> easier it becomes for people to comprehend each other's code. That of
> course does not mean that there cannot be complete comprehension of
all
> code given infinite coding styles. But it does say that the
> comprehension will require less effort and occur faster. And could
> become significant if you have to look at large amounts of someone
> else's code.

I know you're talking about constructor naming here; but I'd like to
point out that this goal is not helped, and is in fact hindered,
by function overloading.

With C++ constructors, the behavior of the constructor must be inferred
from the argument list, whereas in Perl it can be made explicit in
the name.

	// C++ constructors for class Foo:
	Foo::Foo();  // default constructor
	Foo::Foo( Foo& other );  // copy constructor
	Foo::Foo( Bar& bar ); // create from a Bar?

	# Perl constructors for class Foo:
	Foo::create_default;
	Foo::copy;
	Foo::create_from_bar;

--
John Porter
Put it on a plate, son.  You'll enjoy it more.


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Thu, 20 May 1999 12:34:11 -0700
From: "J|rgen Exner" <juex@my-dejanews.com>
Subject: Re: Perl Unicode/Multibyte Support
Message-Id: <7i1nve$fi0@news.dns.microsoft.com>

Tom Christiansen <tchrist@mox.perl.com> wrote in message
news:37444c45@cs.colorado.edu...
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc,
>     Farmer Net <farmernet@my-dejanews.com> writes:
> :I am doing research on Perl's Multibyte capabities.  I found information
> :about perllocale, internationalization, localization and so on.  We are
> :trying decide whether to use Java or Perl to handle international
> :languages to publish to international websites (Japan, Chinese, and
> :European countries).
>
> Did you read this:
>
> NAME
>     utf8 - Perl pragma to turn on UTF-8 and Unicode support

Ok, sounds really great to me.
But what about true Unicode support (i.e. not converted into UTF-8)?
That's a problem I'm facing right now.

jue
--
J|rgen Exner





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

Date: Thu, 20 May 1999 20:19:27 GMT
From: Meowmee <meowmee@my-dejanews.com>
Subject: Premature end of Script header and Apache and Internal Server Error
Message-Id: <7i1qob$g0l$1@nnrp1.deja.com>

HI!

I am about to pull my hair out on this one.  I keep getting "Premature
end of script header" in every of my Perl script/packages I have.  I
checked the perl path and it is correct (#!/usr/bin/perl) as well as
having that print statement for the web browser.  I also try and run the
script from shell prompt (./script.pl or ./script.cgi).  Syntax is ok.
My Apache .htaccess has:

AddHandler cgi-script .cgi .pl
Options ExecCGI

I checked everywhere I can for possible errors, but I am still getting
the error =(  Please help!!!!  I don't know where to look anymore.  One
site said I might need to buffer/filter mem or something like that.  I
don't understand it.  HELP please!!!

Thanks!!  Please email me if you can for the answer.  I'll try and check
this newsgroup for answers.

-- J. Wang
tearsea88@yahoo.com


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Thu, 20 May 1999 13:51:34 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Problems with @INC, path gets added but use still not working
Message-Id: <x3ylnej1vfd.fsf@tigre.matrox.com>


Mark Conlin <Mark.Conlin@bridge.bellsouth.com> writes:

> So I try to do this
> 
> 	use Sys::Hostname;
> 
> results in this "undefined subroutine &main::hostname"

I think the problem you have is with your package name. The hostname
subroutine seems to be defined in the Sys/Hostname.pm file, but it
doesn't reside in the Sys::Hostname package. Somewhere at the top of
the Sys/Hostname.pm file, you should have a line that looks like:

	package Sys::Hostname;

Have a look at perlmod, perlmodlib and the entry for use() in perlfunc
for more info.

Ala



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

Date: Thu, 20 May 1999 22:19:39 +0100
From: "Andy Watson" <andyinfo@yahoo.com>
Subject: Remote creation of PERL scripts
Message-Id: <m__03.28$2I6.19524@news.enterprise.net>

Hi

I need someone to write a mailform script that performs some simple maths on
an objectively marked test.

Is anyone interested in doing this work remotely, I'm prepared to pay the
going rate :)

Andy Watson (andyinfo@yahoo.com)




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

Date: 20 May 1999 20:33:21 GMT
From: me@nospam.com
Subject: Socket.pm error messages
Message-Id: <7i1rih$ao$1@usenet40.supernews.com>

I have script that ftp a bunch of files to different machines.
The script uses Net::FTP module and everything is going to its
intended place. But, I see a lot of the following error message

Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16 at /usr
/lib/perl5/i386-linux/5.00405/Socket.pm line 275.

repeated again and again. Do you know why is this happenning and
do you have remedy?

TIA,
selcuk

-- 


Selcuk Ozturk   --- sozturk at fdch dot com

My views are mine alone.


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

Date: 20 May 1999 20:28:29 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: The Threading of Articles (was Re: pattern matching probs...)
Message-Id: <7i1r9d$ji$1@gellyfish.btinternet.com>

On Thu, 20 May 1999 09:54:06 -0700 Larry Rosler wrote:
> 
> But responding to your own post would have kept the thread together.  
> Someone pointed out here yesterday that the newsreader threads by means 
> of the References: header, not by parsing the Subject: header.  This is 
> good.
> 

Thats why I'm in favour of changing the subject line, certainly with tin
the collapsed display shows the subject of the first unread article in
the thread.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 20 May 1999 21:27:11 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Verifying passwd in FreeBSD
Message-Id: <7i1unf$l8$1@gellyfish.btinternet.com>

On Thu, 20 May 1999 16:38:05 GMT -{WinterWolf}- wrote:
> 
>                           Incidently, I am also having problems getting
> my script to setuid. I've chmod'ed it to 4775 and it's owned by root (I
> want it to setuid root) but when I run it as my user the both the real
> and effective uid's remain that of my user. It doesn't set the effective
> uid to root. Any help you can offer there would be appreciated.
> 

Its probable that your system doesnt support setuid scripts and that
your perl was not built to do the emulation.  You might want to check
out the perlsec manpage ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Thu, 20 May 1999 19:31:13 GMT
From: Barry Margolin <barmar@bbnplanet.com>
Subject: Re: wait(), zombies, and solaris: why won't my children die?
Message-Id: <5qZ03.954$jw4.62376@burlma1-snr2>

In article <slrn7k8fsh.p75.charlie@cs.ed.datacash.com>,
Charlie Stross <charlie @ nospam . antipope . org> wrote:
>On a Linux system, when you fork a child it's reasonable to tidy
>up afterwards by saying something like
>
>    $SIG{CHLD} = sub { print STDERR "$$ reaped child ", wait , "\n"; };  
>
>But on Solaris, well, we obviously ain't in Kansas any more. Doing
>this seems to result in the parent process dying. Taking out the
>SIGCHILD handler altogether, meanwhile, spawns zillions of zombies 
>(yes, it's a forking server I'm working on, and the children insist
>on being wait()'ed for.)

Does it also fail without the print command, just a call to wait?  It's
generally not a good idea to do I/O in signal handlers, and I'm not sure if
Perl does anything to make this safe.

-- 
Barry Margolin, barmar@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5736
**************************************

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