[16437] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3849 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 30 14:10:30 2000

Date: Sun, 30 Jul 2000 11:10:19 -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: <964980619-v9-i3849@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 30 Jul 2000     Volume: 9 Number: 3849

Today's topics:
        Perl 5 worth learning??? <Peter.Bishop@worldnet.att.net>
    Re: Perl 5 worth learning??? <templar318@earthlink.net>
    Re: Perl 5 worth learning??? (Mark-Jason Dominus)
    Re: Perl 5 worth learning??? (brian d foy)
    Re: Perl 5 worth learning??? <Terrill@Bennett.org>
    Re: Perl 5 worth learning??? <dave@dave.org.uk>
    Re: Perl 5 worth learning??? <dan@tuatha.sidhe.org>
    Re: Perl 5 worth learning??? (brian d foy)
        Perl and MySQL <robertNOroSPAM@kronos.custard.org.invalid>
    Re: Perl and MySQL <leo@grx.nl>
    Re: perl reference on nt server <stephen@scriptsavant.com>
    Re: perl reference on nt server (Colin Keith)
        perlcc[5.6.0] - Socket::PF_INET (unable to autoload) <security@solarweb.com>
    Re: Potential perl bug with 'my' variables in modules? (M.J.T. Guy)
        Problem with AP 522 and locale (sort) <asg@natlib.udm.ru>
        Re:Shell commands (Colin Keith)
    Re: Should truncate length be 0? (M.J.T. Guy)
    Re: small regex problem (Colin Keith)
    Re: taint checking with perlis/perlex (Colin Keith)
        unpacking a string of unknown length? <ditlew@abk.auc.dk>
    Re: Using STDIN for email delivery <dietmar.staab@t-online.de>
    Re: Using STDIN for email delivery (Christian Kaufhold)
    Re: Why doesn't my Perl script execute? (M.J.T. Guy)
    Re: wierd regular expression <stephen@scriptsavant.com>
    Re: wierd regular expression (Mark-Jason Dominus)
    Re: wierd regular expression <uri@sysarch.com>
    Re: WIN32::NetAdmin (Colin Keith)
    Re: WIN32::NetAdmin <godzilla@stomp.stomp.tokyo>
    Re: Wraping file with XML code (Mark W. Schumann)
    Re: Writing HTML within Perl <unigni@zaynar.demon.co.uk>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 30 Jul 2000 10:45:12 GMT
From: Peter Bishop <Peter.Bishop@worldnet.att.net>
Subject: Perl 5 worth learning???
Message-Id: <39840910.D6018B2F@worldnet.att.net>

Hi,

I was planning on starting to learn Perl, when I stumbled across
something saying that Perl 6 will be a complete re-write of the
language. Does anyone know how different the syntax/interface to the
language will be. Is it worth learning Perl now? or should I wait until
early next year when the new Perl emerges?

Thanks,
Pete


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

Date: Sun, 30 Jul 2000 10:58:50 GMT
From: David Tsai <templar318@earthlink.net>
Subject: Re: Perl 5 worth learning???
Message-Id: <39840A43.3DEB5636@earthlink.net>

I believe what they mean by a  "complete re-write" is a complete re-write
of the Perl interpreter internals.  The Perl syntax and programming
language specifications will probably not change significantly --
especially the basic functions and operations.  Therefore, I think you
should start as soon as you got time! =)


--

Best Regards,
David Tsai
CGI Paradise
http://www.web-consult.com/scripts/

> I was planning on starting to learn Perl, when I stumbled across
> something saying that Perl 6 will be a complete re-write of the
> language. Does anyone know how different the syntax/interface to the
> language will be. Is it worth learning Perl now? or should I wait until
> early next year when the new Perl emerges?
>
> Thanks,
> Pete





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

Date: Sun, 30 Jul 2000 14:57:00 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Perl 5 worth learning???
Message-Id: <3984423c.25fe$39d@news.op.net>

In article <39840910.D6018B2F@worldnet.att.net>,
Peter Bishop  <Peter.Bishop@worldnet.att.net> wrote:
>I was planning on starting to learn Perl, when I stumbled across
>something saying that Perl 6 will be a complete re-write of the
>language. Does anyone know how different the syntax/interface to the
>language will be. 

Nobody knows.    But it will probably not be too different.

> Is it worth learning Perl now? 

Yes.  Perl 5 will still be in widespread use in ten years.  
Starting to learn Perl 5 now will be valuable when the time comes to
learn Perl 6.

Perl 6 will still be Perl.






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

Date: Sun, 30 Jul 2000 11:14:22 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Perl 5 worth learning???
Message-Id: <brian-ya02408000R3007001114220001@news.panix.com>

In article <39840910.D6018B2F@worldnet.att.net>, Peter Bishop <Peter.Bishop@worldnet.att.net> posted:

> I was planning on starting to learn Perl, when I stumbled across
> something saying that Perl 6 will be a complete re-write of the
> language. Does anyone know how different the syntax/interface to the
> language will be. Is it worth learning Perl now? or should I wait until
> early next year when the new Perl emerges?

Perl 6 will not be around for awhile, and the bits that you learn about
Perl 5 will be a transferable skill.  you'll even be able to keep working
in Perl 5 since it will continue to be supported.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Sun, 30 Jul 2000 11:36:03 -0400
From: "Terrill_b" <Terrill@Bennett.org>
Subject: Re: Perl 5 worth learning???
Message-Id: <emtqBvj#$GA.284@cpmsnbbsa09>

Actually Peter, someone DOES know what Perl 6 will look like, and what's
going to happen:  http://www.perl.com and read for yourself.

Is Perl 5 worth learning? Well, you could wait until 2001 for Perl 6 to come
out! But then, you would have to start waiting for Perl 7, or Perl 8, or...

All (useful) languages are in a state of evolution. GW BASIC "print"
commands still work in Visual BASIC. Microsoft hopes C++ will become C#.
JavaScript still looks like C on steriods and uses Perl regular expressions.
Java, well, it's good either hot or cold and if you mix chocolate with it,
you get caffe mocha!

Knowledge is never wasted. Learn it.

Peter Bishop <Peter.Bishop@worldnet.att.net> wrote in message
news:39840910.D6018B2F@worldnet.att.net...
> Hi,
>
> I was planning on starting to learn Perl, when I stumbled across
> something saying that Perl 6 will be a complete re-write of the
> language. Does anyone know how different the syntax/interface to the
> language will be. Is it worth learning Perl now? or should I wait until
> early next year when the new Perl emerges?
>
> Thanks,
> Pete




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

Date: Sun, 30 Jul 2000 16:52:26 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: Perl 5 worth learning???
Message-Id: <3oj8os8dijuejnrai5p0gm6o158ulsv4ds@4ax.com>

On Sun, 30 Jul 2000 11:36:03 -0400, "Terrill_b" <Terrill@Bennett.org>
wrote:

>Actually Peter, someone DOES know what Perl 6 will look like, and what's
>going to happen:  http://www.perl.com and read for yourself.

Anything that you read about Perl 6 is only speculation. Discussions
have been going on for ten days. Nothing is known for sure yet.

Dave...

-- 
<http://www.dave.org.uk>  SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>

"There ain't half been some clever bastards" - Ian Dury [RIP]


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

Date: Sun, 30 Jul 2000 17:14:30 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Perl 5 worth learning???
Message-Id: <WnZg5.8451$f_5.39322@news1.rdc1.ct.home.com>

Peter Bishop <Peter.Bishop@worldnet.att.net> wrote:
> Hi,

> I was planning on starting to learn Perl, when I stumbled across
> something saying that Perl 6 will be a complete re-write of the
> language. Does anyone know how different the syntax/interface to the
> language will be. Is it worth learning Perl now? or should I wait until
> early next year when the new Perl emerges?

Given that perl 6 is definitely not going to be anywhere near a useable
state by early next year (we're shooting for an alpha for TPC5.0 in July)
I'd learn perl 5. There will be a perl 5->perl 6 converter program so you
won't lose anything, and perl 6 will be awfully close to perl 5 anyway
(wouldn't be perl if it wasn't), so you shouldn't have any sort of
problems.

					Dan


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

Date: Sun, 30 Jul 2000 14:04:57 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Perl 5 worth learning???
Message-Id: <brian-ya02408000R3007001404570001@news.panix.com>

In article <emtqBvj#$GA.284@cpmsnbbsa09>, "Terrill_b" <Terrill@Bennett.org> posted:

> Actually Peter, someone DOES know what Perl 6 will look like, and what's
> going to happen:  http://www.perl.com and read for yourself.

nobody knows what Perl 6 will look like yet.  if you want the official
story, you need to go to http://www.perl.org/perl6/.  everything
else is speculation and rumors.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Sun, 30 Jul 2000 08:36:14 -0700
From: Robert <robertNOroSPAM@kronos.custard.org.invalid>
Subject: Perl and MySQL
Message-Id: <16bc5578.31ee94cd@usw-ex0101-008.remarq.com>

Hello,

I am looking to start learning MySQL. It is my understanding that
PHP is generally used to manage MySQL commands, but I am also
aware that DBI can interface MySQL commands aswell using Perl.

I would prefer to use Perl and DBI if possible in order to
maintain consistency throughout my website. However, I am a total
beginner when it comes to using MySQL.

Unfortunately, I do not have shell access to my web host, but I
have heard there is a Perl equivalent of phpMyAdmin so I can
create a database via the web browser. Does anyone know what this
is called, and where I can download it from?

Also, can anyone recommend any good tutorial sites, or books,
that can help me learn this strange new language?

Sorry if I sound like a plank, but I have searched Google for
Perl and DBI, but didn't get what I was after.

Many thanks for any help you can offer,

Rob.


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

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



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

Date: Sun, 30 Jul 2000 20:01:04 +0200
From: "leo grapendaal" <leo@grx.nl>
Subject: Re: Perl and MySQL
Message-Id: <8m1qh0$38a$1@news1.xs4all.nl>

> Unfortunately, I do not have shell access to my web host, but I
> have heard there is a Perl equivalent of phpMyAdmin so I can
> create a database via the web browser. Does anyone know what this
> is called, and where I can download it from?

Dunno. Can't help you there! Have a look at www.mysql.com, they have a
 zillion links to all sorts of MySQL clients.

( I can't tell from experience, but it would seem HORROR to me having to
 implement/run/maintain a Perl/MySQL application without even having shell
 access. I would advise you to switch to a host that does offer this!)

>
> Also, can anyone recommend any good tutorial sites, or books,
> that can help me learn this strange new language?

I use:

Mysql
Dubois
New Riders Publishing, Paperback, Published December 1999, 756 pages,
mysql_nr, ISBN 0735709211
a very good  MySQL-book including good Perl DBI coverage, and:

Programming the Perl Dbi : Database programming with Perl
Descartes & Bunce
O'Reilly & Associates, Paperback, Published February 2000, 346 pages,
prog_perl_dbi, ISBN 1565926994

If you buy the MySQL book, you could do without the DBI book.

I bought them at http://www.bookpool.com , they are cheap and fast.
(as opposed to Amazon, they're still not even selling Camel 3, and I'm
already reading it thanks to Bookpool...)

The DBI manpages are also very informative. You can find them via
http://cpan.org/doc
>

Leo Grapendaal

Amsterdam Perl Mongers <URL:http://amsterdam.pm.org/>





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

Date: Sun, 30 Jul 2000 11:51:17 GMT
From: "Stephen" <stephen@scriptsavant.com>
Subject: Re: perl reference on nt server
Message-Id: <VEUg5.1962$DA.141605@news.flash.net>

Do you know what web server it is running?  IIS4.0 will require that the web
server specifically associate the filename extension with the Perl
interpreter (separate from the OS's association).  Sambar server uses the
normal Unix convention of shebang in the script itself.  I don't know about
any other web servers, but hopefully that will give you a start.

Stephen Brown

"Tom McLean" <tommclean@mindspring.com> wrote in message
news:8lv7h7$rqr$1@slb6.atl.mindspring.net...
> I am trying to execute a script on an nt webserver that has the
interpreter
> installed in the ntreskit directory.  No matter how I try to reference the
> script I get the error.
>
> %1 is not a valid Windows NT application
>
> the script executes on mindsprings servers.
>
> How do i change the first line of code to reflect the interpreter location
>
> Help
>
> Tom
>
>
>
>




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

Date: Sun, 30 Jul 2000 14:30:00 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: perl reference on nt server
Message-Id: <IZWg5.27$DT4.1994133@nnrp2.clara.net>

In article <8lv7h7$rqr$1@slb6.atl.mindspring.net>, "Tom McLean" <tommclean@mindspring.com> wrote:
>I am trying to execute a script on an nt webserver that has the interpreter
>installed in the ntreskit directory.  No matter how I try to reference the
>script I get the error.
>
>%1 is not a valid Windows NT application

That looks like a registry setting along the lines of the open command being 
tied to d:\bin\perl.exe %1

There's a post "Re: perl on  windows NT web server" in this group that might 
be the solution to this as well. 
(<39828205.524144494f47414741@radiogaga.harz.de>)

>the script executes on mindsprings servers.

Call them and tell them it don't werk then.

>How do i change the first line of code to reflect the interpreter location

#!d:\bin\perl.exe

but I didn't think that worked even on NT (It definitely doesn't on win9x) 
because the execution is done by the association in the registry afaik.

>Help
>
>Tom
>
>
>
>


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


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

Date: Sun, 30 Jul 2000 10:52:18 GMT
From: Zach Pardos <security@solarweb.com>
Subject: perlcc[5.6.0] - Socket::PF_INET (unable to autoload)
Message-Id: <3983ED49.8BF4A3CE@solarweb.com>

When I ran perlcc with my previous version of perl (5.0050) I recieved
20+ "No definition" errors. Now that I have upgraded, when I issue
# perlcc -o getm -prog /usr/share/getm.pl
I recieve these errors

No definition for sub Socket::PF_INET
No definition for sub Socket::PF_INET (unable to autoload)
No definition for sub Socket::SOCK_STREAM
No definition for sub Socket::SOCK_STREAM (unable to autoload)

perlcc continues the compilation only without the nessesary Socket
module.
When I run the compiled binary I get an expected,  "Undefined subroutine
&Socket::inet_aton called".
Suggestions on how to fix?



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

Date: 30 Jul 2000 15:16:22 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Potential perl bug with 'my' variables in modules?
Message-Id: <8m1gs6$cuo$1@pegasus.csx.cam.ac.uk>

Torsten Hartmann  <Torsten.Hartmann@nokia.com> wrote:
>
>The main script calls a subroutine located in a package. This package
>has a variable which is declared with 'my' at the top of the package.
>The subroutine calls another routine which sets the variable using an
>'eval' statement.
>The strange behavior is that the variable is defined only if there is a
>'print' statement after the 'eval'. If this statement is missing the
>variable is not defined in all other routines in the package.
>
>Has anybody an idea about that strange behavior? Is this be a bug in
>Perl?

Yes, this is a known bug in Perl.    And unfortunately, noone
knows how to fix it, at least without unacceptable overhead.

It's related to the problems which give rise to the error message
"will not stay shared"  -  see discussion of that error in perldiag.pod.
Essentially, Perl can't decide which instance of $var to use.
I suspect examples like yours ought to give rise to this error message.


Mike Guy


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

Date: 30 Jul 2000 13:42:59 GMT
From: Sergey Aleshin <asg@natlib.udm.ru>
Subject: Problem with AP 522 and locale (sort)
Message-Id: <8m1bd3$270i$1@dfree.natlib.udm.ru>


Hello All!

I have some code that lists book index and want to build an navbar
of first letters of alphabet:

hash %alphabet consist of letters as keys and page numbers as values

For list it in aphabetic order i'm use this code:

use locale; # at head of script - i need it because of Russian language
 ...
for(sort(keys %alphabet))
{
 my $pn=$alphabet{$_};
 print "$_ - $pn\n"
}

Works fine on FreeBSD 3.5 but don't work on Win32 with ActivePerl build 522

The problem is that keys on Unix returns unsorted list (as documented)
and keys on Win32 returns sorted! And sort of sorted list mess it to unsorted!
So code like 

for(keys %alphabet)                                                       
{                                                                               
 my $pn=$alphabet{$_};                                                          
 print "$_ - $pn\n"                                                             
}
works on Win32 but nor on unix :-)

Does anyone have any suggestions?
--
Sergey Aleshin
e-mail: asg@natlib.udm.ru
ICQ UIN: #73148842


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

Date: Sun, 30 Jul 2000 14:56:38 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re:Shell commands
Message-Id: <GmXg5.28$DT4.1996638@nnrp2.clara.net>

In article <39838E3F.D599A25C@home.com>, "Stephen L. Sims" <s1sims@home.com> wrote:
># Now lets convert them thar' audio files
>        rmdtopvf("$msg") | pvfspeed ("-s 8000") | pvftoau (">$myjoin");

Ooh, line 33.
They'd want to be logical OR's (||) rather than bitwise OR's (|) I assume.
It's complaining because its taking the return code of each sub routine 
(that happens to call an external program cos of the magic of Shell.pm) and 
bitwise OR'ing them together ... and then not assigning it to anything - 
hence the context is void.

Thus:

rmdtopvf("$msg") || pvfspeed("-s 8000") || pvftoau(">$myjoin");

Shouldn't that be && anyway? So if one fails it doesn't continue to try and 
process them. 

Better still would be to check if each worked and log it to a file if one 
fails ... maybe even using "or die" if it doesn't.  But that'll only get 
*someone* coming along and posting about how you don't need to check the 
return values of code and how people should stop advocating the use of "or 
die" again :-)


[ HTML/VCF/Othercrap snipped ]


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


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

Date: 30 Jul 2000 15:50:04 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Should truncate length be 0?
Message-Id: <8m1irc$e7h$1@pegasus.csx.cam.ac.uk>

In article <8lt9km$dra$1@nnrp1.deja.com>,
Katia Hayati  <hayati@math.berkeley.edu> wrote:
>In article <m3l2oskqu9qqpc7dqru1ervfflu2c383b3@4ax.com>,
>  Bart Lateur <bart.lateur@skynet.be> wrote:
>> However, This sequence:
>>
>> 	seek FILE, 0, 0;
>> 	print FILE, $data;
>> 	truncate FILE, tell FILE;
>>
>> *has already failed* on me, on a fews platforms. IT truncated the file
>> to the wrong length, even though I think that tell() returned the
>> correct offset.
>
>Does that mean that truncate() can be trusted to work only with a 2nd
>argument of 0?

"perldoc perlport" says

     truncate EXPR,LENGTH
             Not implemented. (VMS)

             Truncation to zero-length only. (VOS)

             If a FILEHANDLE is supplied, it must be writable and
             opened in append mode (i.e., use `open(FH,
             ''>filename')> or `sysopen(FH,...,O_APPEND|O_RDWR)'.
             If a filename is supplied, it should not be held
             open elsewhere. (Win32)

So it looks like the only (known) problem is VOS.


Mike Guy


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

Date: Sun, 30 Jul 2000 15:14:51 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: small regex problem
Message-Id: <LDXg5.29$DT4.1998867@nnrp2.clara.net>

In article <8lulk9$aad$1@nnrp1.deja.com>, hamed53@my-deja.com wrote:
>Hi everyone...
>
>I have this string:
>$string = "[10] OutBound Digits   : 111111        ";
>
>i want to extract: "10" and "OutBound Digits" and "111111" from it.
>
>I have written small regex myself, but it seems it only extracts a word
>"OutBound" and not the second word "Digits" where it should extract all
>words between "[10]" and ":"
>
>heres the code i've written
>
>$string =~ /^\[\s*(\d+)\] (\w*)\s+\: (.*)/;

This isn't the regexp you're using if you're getting that output.

Cus "OutBound Digits" has a white space in the middle of it and you specify 
a [ 
0+ white spaces 
1+ digits 
a ] 
a space
0+ word characters (letters) 
1+ spaces 
a : (which doesn't need to be escaped with a \)
a space
anything 0+ times.

It'll get as far as (\w*)\s+ and then fail, because you have the space after 
"OutBound" which matches the \s+ above. But then you specify a : which isn't 
what it is followed by ... Thus:

maia% perl -w -Mstrict
$_ = '[10] OutBound Digits   : 111111        ';
/^\[\s*(\d+)\] (\w*)\s+\: (.*)/;

print "$1, $2, $3\n";

Use of uninitialized value at - line 4.
Use of uninitialized value at - line 4.
Use of uninitialized value at - line 4.
, , 


You should be using
perl -w -Mstrict
$_ = '[10] OutBound Digits   : 111111        ';
/^\[\s*(\d+)\] ([\w\s]+?)\s+: (\d+)\s*$/;
print "'$1'\n'$2'\n'$3'\n";

'10'
'OutBound Digits'
'111111'

(single quotes added for clarity to show the +? at work)


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


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

Date: Sun, 30 Jul 2000 15:47:41 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: taint checking with perlis/perlex
Message-Id: <x6Yg5.30$DT4.2002283@nnrp2.clara.net>

In article <972097A1F1360AB1.5CD40BCFE202CF9E.C0968634F952A71B@lp.airnews.net>, Grant Boyle <gboyle@sympatico.ca> wrote:
>Unfortunately I haven't been able to figure out how to enable taint
>checking when using perl for ISAPI (perlis.dll) under NT4/IIS4. I
>tried the -T switch on a #! line but that just gave the usual 'too
>late' message. I did some searching on the net but came up empty.

Wouldn't you need to add it to the bit that calls the perl interpreter? I 
though this came out of the registry, but IIS4 might have its own settings 
for this. I would suggest you look for and try changing the command line 
that's run from the registry. (but obviously back it up first, *disclaim* 
*disclaim* *disclaim*)

'nyway, you don't *have* to have taint checking enabled afaik. It is a very 
good idea for CGI scripts because it kicks you squarely in the direction of 
having to think about the data you're given, and catches (some) human 
errors. It can't (unfortunately) force you to ensure that the data is clean. 
/^(.*)$/ will untaint your data, but its a *very* stupid thing to do. Worse 
is if you say "I want to allow my Win32 users to upload files, they can have 
spaces, hyphens, letters and numbers, etc. in the file name" and your reg 
exp will then allow the 'filename' "rm -rf" ...

(Hey, P6 coders, wanna make (.*) not untaint?  
Oooh, P6 I like the sound of that .. 
"It was the dawn of the 21st centuary .. it was the birth .. of P6!" :-)

>Any ideas?

Many. Most of them involve getting a job in the US (offers welcome:-)

Col.


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


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

Date: Sun, 30 Jul 2000 17:27:29 GMT
From: "Daniel Ditlew" <ditlew@abk.auc.dk>
Subject: unpacking a string of unknown length?
Message-Id: <5AZg5.10163$MJ5.127223@twister.sunsite.auc.dk>

My doc on unpack seems very sparce..
I cant figure out how to unpack a string of unknown length followed by
something else..
example:
I cant unpacked the following:
"unknown_name 40"

I cant use:
$unpacked = unpack("A* i", $packed);

and since the length is unknown I cant use this either:
$unpacked = unpack("A12 i", $packed);

- Ditlew




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

Date: Sun, 30 Jul 2000 12:38:46 -0500
From: "Dietmar Staab" <dietmar.staab@t-online.de>
Subject: Re: Using STDIN for email delivery
Message-Id: <8m10i8$2a4$18$1@news.t-online.com>

In article <3983d0c5.59141939@news.pacbell.net>, lmahan@designwest.com(Lee
Mahan) wrote:

> Below is the script (at least the significant part):
> 
> #!/usr/bin/perl
> 
> while(<STDIN>)
> {
>   $msg[$l] = $_;
>   $l++;
> }
> 
> I'm then attempting to save it to a test file (That part works), but
> nothing seems to be loaded in the msg array....how am I doing this
> wrong?

Hi Lee,

there's nothing wrong, but how do you test the content of your array?
#!/usr/bin/perl

while(<STDIN>)
{
  $msg[$l] = $_;
  $l++;
  $_ =~/^\n$/ && last;
}

print @msg;

Best regards, Dietmar


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

Date: Sun, 30 Jul 2000 14:34:25 +0200
From: ch-kaufhold@gmx.de (Christian Kaufhold)
Subject: Re: Using STDIN for email delivery
Message-Id: <8m18jg$eki$2@f40-3.zfn.uni-bremen.de>

lmahan@designwest.com(lee wrote:
> Below is the script (at least the significant part):

The part you posted does about what you want it to do.

 
> #!/usr/bin/perl

Please turn on warnings:

#!/usr/bin/perl -w

and I suggest you:

use strict;


> 
> while(<STDIN>)
> {
>   $msg[$l] = $_;
>   $l++;
> }

You will still have the newlines in the array. This may later lead to
confusion. Better "chomp" them off now and add them later if desired.

You also don't need an explicit index, this isn't C.

my @msg;

while (<STDIN>)
{
    chomp;
    push @msg, $_;
}

or even (if you don't plan to add any validation etc.)

my @msg;

chomp (@msg = <STDIN>);


> I'm then attempting to save it to a test file (That part works), but
> nothing seems to be loaded in the msg array....how am I doing this
> wrong?


That is probably a bug in the code you didn't post or in the way you
call the program.



Christian
-- 
$   _    = "Just another Perl Hacker\n";
sub __   { local $ - ; 1 while caller ++ $ - ; -- $ - - $ ___ }
$   ___  = 1;
sub ____ { (length >= __) && substr($_, __, $___).____() } print ____


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

Date: 30 Jul 2000 14:59:05 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Why doesn't my Perl script execute?
Message-Id: <8m1frp$c6q$1@pegasus.csx.cam.ac.uk>

Larry Rosler  <lr@hpl.hp.com> wrote:
>In article <8lpaou$dpo$1@nnrp1.deja.com> on Thu, 27 Jul 2000 12:43:11 
>GMT, Rodney Engdahl <red_orc@my-deja.com> says...
>> In article <8lp4s0$9mq$1@nnrp1.deja.com>,
>>   apolinad@my-deja.com wrote:
>> >
>> > Illegal modulus of constant 0 in "inputvars="
>> > Syntax error "my $count"
>
>That smacks of Perl 4.

Yep.   That's the error you get with Perl 4.

>> 
>> are you certain there is no space between % and inputvars?
>
>What difference would that make?  perl sees them as separate tokens, so 
>white space is irrelevant (though no one uses any there -- bad golf, you 
>know!).

White space makes no difference to that example in either Perl 4 or Perl 5.


Mike Guy


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

Date: Sun, 30 Jul 2000 11:43:37 GMT
From: "Stephen" <stephen@scriptsavant.com>
Subject: Re: wierd regular expression
Message-Id: <JxUg5.1961$DA.141373@news.flash.net>

> On Sun, 30 Jul 2000, john quoth:
>
> $$ I have done the most simple regular expression, replacing a certain
text
> $$ with the content of a variable:
> $$
> $$ s/text/$variable/gi
> $$
> $$ the expression is used several times, with different values of
> $$ $variable:
> $$ for example "text" is first replaced with "pig", later with "chicken"
> $$ and finally with "hotdog".
> $$
> $$ but - after using this expression once, it keep replacing the given
text
> $$ with the first value of $variable, ignoring the new values - so the
> $$ string "text" will always be replaced with "pig" even if later
$variable
> $$ is "chicken" or "hotdog".
> $$ is there a way to prevent this strange behavior?
>
> Well since you did not post any code, I will have assume.
> After the first substitution, you have replaced 'text' with 'pig'.
> Your string no longer contains 'text' so subsequent substitutions
> will fail, and the text will remain with the word pig.  If you
> want to avoid this make a copy of your data before modifying it,
> so that you can restore the copy when necessary.
>
> anm

If I am guessing correctly at the problem, all you should need to do is
remove the /g.  That will allow you to replace the first instance of "text"
with the first "$variable", the next instance will be replaced by the next
instance, and so on.

sgb





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

Date: Sun, 30 Jul 2000 14:53:57 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: wierd regular expression
Message-Id: <39844185.25e9$d9@news.op.net>

In article <x7n1j03yv9.fsf@home.sysarch.com>,
Uri Guttman  <uri@sysarch.com> wrote:
>/o is almost never needed anymore as regexes are not recompiled
>unless a var being interpolated into it has changed its value since
>the last time the regex was executed.

But if you don't use /o, then every time Perl does a match with the
regex, Perl has to perform the variable interpolation, and check the
to see if it has changed.  With /o, it skips these steps completely.
So it's still worth using when appropriate.

I don't think it is true that /o is almost never needed any more.
It was an optimization, and it's still an optimization.


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

Date: Sun, 30 Jul 2000 17:51:21 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: wierd regular expression
Message-Id: <x7k8e34icn.fsf@home.sysarch.com>

>>>>> "MD" == Mark-Jason Dominus <mjd@plover.com> writes:

  MD> But if you don't use /o, then every time Perl does a match with
  MD> the regex, Perl has to perform the variable interpolation, and
  MD> check the to see if it has changed.  With /o, it skips these steps
  MD> completely.  So it's still worth using when appropriate.

  MD> I don't think it is true that /o is almost never needed any more.
  MD> It was an optimization, and it's still an optimization.

true. but it is less of a needed optimization than before. perl used to
recompile a regex each time through without /o. now it may just
interpolate and check which is not as heavy a load as regex
compilation. and /o is a permanent thing where you can never change the
regex again while the interpolation check can be used to control the
regex by chnaging the interpolated vars. i just don't find too many
places where i would use /o these days. 

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Sun, 30 Jul 2000 16:08:52 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: WIN32::NetAdmin
Message-Id: <oqYg5.31$DT4.2004806@nnrp2.clara.net>

In article <3983C2C6.F4EFF040@stomp.stomp.tokyo>, "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
>"Timothy H. Schilbach" wrote:
>> print "<H3>FORM('username'), your password has been changed as per your
>> request\n</H3>";

Btw, if this is the first line of output of your script its wrong. HTTP is a 
protocol that follows the Internet 'standard' use by mail/news/etc. in that 
a message has a header and the actual data. This shouldn't be confused with 
the <HEAD> and <BODY> section of the HTML page itself. All of that is the 
data. The headers look something like:

print "Content-Type: text/html\n\n";

Which the server will then (most likely) expand to include the 
Content-Length, Date: etc. And, most importantly for HTTP, the status code - 
200, 404, etc. (But its dependant upon the server whether it adds any extra 
headers) Note also the two \n's That prints a blank line separating the 
header from the message body.

You might wish to consider using the CGI module for this. But as suggested 
you have pretty much what you need here already so it maybe overkill.

> This will increase your security right off, by
> thirty-three percent.

Where do you get that figure from, out of curiosity? :)


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


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

Date: Sun, 30 Jul 2000 09:50:28 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: WIN32::NetAdmin
Message-Id: <39845CD4.888704F1@stomp.stomp.tokyo>

Colin Keith wrote:
> Godzilla!
> > Timothy H. Schilbach wrote:

> > This will increase your security right off, by
> > thirty-three percent.
 
> Where do you get that figure from, out of curiosity? :)

If you hold one apple, it is one-hundred percent of your apples.
If you hold two apples, each represents fifty-percent of your apples.
If you hold three apples, each is thirty-three percent of your apples,
with one having a small one-percent missing due to an apple worm.

Just don't try comparing apples and alligators as many do 
around here. Alligators bite. Worms do not.

Godzilla!

-- 
print "file:///%43|%2f";


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

Date: 30 Jul 2000 11:56:26 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Wraping file with XML code
Message-Id: <8m1j7a$43f@junior.apk.net>

In article <964949517.7949@itz.pp.sci.fi>,
Ilmari Karonen  <usenet11168@itz.pp.sci.fi> wrote:
>In article <39819FC8.CC279424@eurodyn.com>, Sasa Danicic wrote:
>>I've need to wrap a binary file with a portion of XML-like code.
>>XML-like code is something so called "an envelope".
>
>Well, you could base64-encode it.  The easiest way to do that in Perl
>should be with pack "u" and tr/// - I think there's some example code
>in the Camel book.  Base64 data contains no XML metacharacters, so it
>should be a simple matter of inserting it between appropriate tags.
>
>(I think there's a base64 module, which would be even easier.  I have
>never used it, but searching CPAN for "base64" ought to help.)

I think the original poster needs to refine the question, and at that
point the answer will likely be in a module such as the one you mention.



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

Date: Sun, 30 Jul 2000 17:34:13 +0100
From: Unigni <unigni@zaynar.demon.co.uk>
Subject: Re: Writing HTML within Perl
Message-Id: <XXUrPFAFkFh5EwHN@zaynar.demon.co.uk>

>> print <<HTML;
>> <html><head><title>HTML Page</title></head><body><font size='3'
>> color='#000066'>You are the  $num visitor to this
>> website.</font><BR></body></html>
>> HTML;

Don't put a ; after that last line
-- 
Philip Taylor
philip @ zaynar . demon . co . uk
http://hangman.games.ultrastore.com - Hangman Online!


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

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


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