[13240] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 650 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 26 09:09:32 1999

Date: Thu, 26 Aug 1999 06:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 26 Aug 1999     Volume: 9 Number: 650

Today's topics:
    Re: =?iso-8859-1?Q?can=B4t?= flock files <isabelle@unixpro.mch.pn.siemens.de>
    Re: A nice tough RegEx for u to solve..? <pdobbs@home.com>
        broker <igor@rtsnet.ru>
    Re: Computing loop over array problem <rick.delaney@home.com>
        eperl v. embperl which would you suggest? emarkert@pace.edu
        Getting Data from a website (Desmond)
    Re: Getting Data from a website <gellyfish@gellyfish.com>
    Re: Getting Data from a website <jpeterson@office.colt.net>
    Re: How to Address an email using CGI <fty@mediapulse.com>
        inet_ntoa on HPUX 10.20 rstagg@my-deja.com
    Re: inet_ntoa on HPUX 10.20 <meowing@banet.net>
    Re: Integrating CORBA and Perl <esumerfd@poboxes.com>
    Re: LWP Legality Issue? (Bart Lateur)
    Re: Perl a Black Sheep? <csaba.raduly@sophos.com>
    Re: Perl a Black Sheep? <csaba.raduly@sophos.com>
    Re: Perl a Black Sheep? (Bart Lateur)
    Re: Perl a Black Sheep? <revjack@radix.net>
        perl versus Servlets <R.Wiechmann@alcatel.de>
    Re: perl versus Servlets <jpeterson@office.colt.net>
    Re: Regex Question (Gary O'Keefe)
    Re: rename with ActivePerl (Jenda Krynicky)
        Servers for NT marius_13@my-deja.com
    Re: Shell vs Perl <esumerfd@poboxes.com>
        Tough RegEx TWO - Its almost perfect BUT.. <pdobbs@home.com>
    Re: What are valid characters in hash keys (Bart Lateur)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Thu, 26 Aug 1999 10:35:02 +0200
From: Isabelle Leroy <isabelle@unixpro.mch.pn.siemens.de>
Subject: Re: =?iso-8859-1?Q?can=B4t?= flock files
Message-Id: <37C4FC35.CBE2F5E4@unixpro.mch.pn.siemens.de>

Well, thanks for the help. I change open (ISA, "isa.txt")  with open (ISA,
"+< isa.txt") and now there is no more pb, I can make the exclusive
blocking lock .

Richard Tibbitt wrote:

> isabelle Leroy <isabelle@unixpro.mch.pn.siemens.de> wrote:
>
> >I tried two ways to lock files but it doesnīt work, could you help me?
> >Thanks.
> >
> >first  I tried:
> >
> >sub easy_lock {
> >open (ISA, "isa.txt") || die "Can't Open isa.txt $!\n";
> >flock (ISA, 2) or warn ("canīt lock right now, will try again soon\n");
> >close (ISA);
> >}
>
> A couple of points to note here - by default, flock doesnt return
> until it can achieve the lock or it fails - your 'warn' would be
> better as a 'die' with $! in the message to tell you exactly why flock
> is failing - it is unlikely to be because the file is currently locked
> by another process - an OPERATION of 2 is probably an exclusive
> blocking lock on your system (but it may not necessarily be - see FAQ
> 5 etc for details).
>
> Trying to obtain an exclusive lock on a file opened only for reading
> (as you have above) may generate an error on some systems - it hasn't
> for me on half a dozen different versions of Perl5 & flavours of Unix
> until I tried out a Cobalt RAQ2 with Perl 5.004_04 built for
> mips-Linux - flock failed with a "Bad file descriptor" error.
>
> Hope this helps
>
> --
> Richard Tibbitt
> Looe, Cornwall, UK
> tibbs@netcomuk.co.uk



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

Date: Thu, 26 Aug 1999 10:58:52 GMT
From: Paul Dobbs <pdobbs@home.com>
Subject: Re: A nice tough RegEx for u to solve..?
Message-Id: <37C52014.23F8030F@home.com>

 Your, and some other suggestions here, worked great
thank-you. 
 I made one small change though.. the .* to a (/S+)
 But now.. how would you negate such a regex? IE: So that
 we do not alter anything between the strings href=" and ">
?

 I figured an OR operator within the replace function would
do it;
 (I use % sign to separate my sections)

s%(?<=">)(.{40})(\S+)(?=</a>)|(?<=href=")(\S{40})(\S+)(?=">)%$1
$2%ig;

 So I am wanting to say if the text is between "> and </a>
OR
 if its NOT between href=" and "> then lets split it at 40
chars.
 I tried changing the ?<= to ?!= and it didn't do what I
wanted,
 it split inside the href=" section. I think all I need is
the 
 correct "not" format to apply and all will be roses..

 Is it a syntax error to apply the OR pipe in a replace
command?

 If this text split can be made to work just as so, the
world will be
 a better place and s%:-(%:->%g; 

Abigail wrote:
> 
> You might want something like:
> 
>     s{(?<=">)(.{40})(.*)(?=</a>)}{$1 $2}gs;
> 
> But that will go from the first "> to the last </a>.
> 
> Of course, if this has anything to do with HTML, any approach remotely
> resembling a single regex is going to utterly fail.
> 
> Abigail


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

Date: 26 Aug 1999 15:52:15 +0400
From: Igor Vinokurov <igor@rtsnet.ru>
Subject: broker
Message-Id: <37c52a6f.0@news.rtsnet.ru>

Hello.

There is a necessity to run on remote server (unix host) some
administrative commands (create user, create home directory etc)
from script on local host.

I plan to realize it, as client/server.

For example simple session:

C: telnet host 106
S: 200 broker ready
C: USER admin
S: 300 please send the PASS
C: PASS adminpassword
S: 200 login OK
C: adduser user
S: 200 OK
C: QUIT
S: 200 broker connection closed

Well, from what to begin? :)

How I understand, to me the unit Net::Daemon is necessary?

Probably, someone already has written something similar?

Probably, there are guidelines on writing such programs?

-- 
Igor Vinokurov

P.S: Please add Cc: igor@rtsnet.ru when replying if possible.



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

Date: Thu, 26 Aug 1999 12:52:03 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Computing loop over array problem
Message-Id: <37C5385B.AAB2700B@home.com>

marcza@my-deja.com wrote:
> 
> This is my current (slow) solution:

It also doesn't work.  Please cut and paste your code, don't retype.

> sub calc {
>     local($tmp) = $_[0];

This is not the place to use local().  Use my() instead.

    my $tmp = $_[0];

perldoc perlsub

>     $tmp = trim($tmp);  # removes leading/trailing spaces
>     $tmp = split(/ +/,$tmp);
      ^^^^
      @tmp

There is no need for &trim here if you use awk-like split.

    my @tmp = split ' ', $tmp;

>     local($w) = 0;

Again, my().

>     while(0 < $#tmp) {
>        if (pop(@tmp) < pop(@tmp)) {
>           $w++; }
>        else {
>           $w--; } }
>     return((( 0 <= $w) ? "n" : "y")); }

Your algorithm seems sound enough.  Here's a variation on it using the
<=> operator.  I don't know if this is any faster, but it's shorter.

perldoc perlop
 
sub calc {
    my @nums = split ' ', $_[0];
    my $c = 0;
    while(my @n = splice(@nums, 0, 2)) {
        $c += ($n[0] <=> $n[1]);
    }
    return $c > 0 ? 'y' : 'n';
}

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Thu, 26 Aug 1999 12:28:33 GMT
From: emarkert@pace.edu
Subject: eperl v. embperl which would you suggest?
Message-Id: <7q3bt5$ju7$1@nnrp1.deja.com>

First, I'm not looking to start a holy war over which product is best,
so my apologies if that is what happens...

I am looking for are solid recommendations for either product.  I have a
project that I need to have parsed HTML.  I've already taken a look at
PHP but ditched it because of the extensive perl object libraries that I
have to use and from what I've seen PHP cannot take advantage of these
perl objects.

What I need is to be able to use my perl objects, be able to connect to
MySQL databases, and be able to coexist on Apache.

TIA.


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


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

Date: Thu, 26 Aug 1999 19:01:07 +0800
From: desmond@letterbox.com (Desmond)
Subject: Getting Data from a website
Message-Id: <desmond-2608991901070001@tns03311.singnet.com.sg>

Hello,

I'm new at perl and have encountered a problem


How can I from my perl/CGI script, send a POST query to a website and wait
for the website to send the data back.

Currently, I have to go to that website, key in my query string and
"submit" it and wait patiently for the infomation/data to appear on my
browser. It is okay if there is only a few queries but I usually have a
hundred or so and this can take me a few days to do.

I have tried a number of ways but I can't get my script to "submit" the
query automatically. I have all the <input text ......> fields.

Can anyone help my out. Thanks


Desmond


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

Date: 26 Aug 1999 12:44:42 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Getting Data from a website
Message-Id: <37c528aa_2@newsread3.dircon.co.uk>

Desmond <desmond@letterbox.com> wrote:
> Hello,
> 
> I'm new at perl and have encountered a problem
> 
> 
> How can I from my perl/CGI script, send a POST query to a website and wait
> for the website to send the data back.
> 

You will want to use the module LWP::UserAgent which is part of the
libwww-perl bundle available from CPAN.

/J\
-- 
"The only man in the cabinet who supported them was that fucking lunatic
Redwood" - John Major


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

Date: Thu, 26 Aug 1999 12:18:03 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Getting Data from a website
Message-Id: <%fax3.6$RY.325@news.colt.net>

Desmond <desmond@letterbox.com> wrote:
> Hello,

> I'm new at perl and have encountered a problem

> How can I from my perl/CGI script, send a POST query to a website and wait
> for the website to send the data back.

1. Discover CPAN by going to www.perl.com/cpan and reading everything you see 
there.
2. Discover the LWP module that allow you to do exactly what you want with
great ease.
3. Learn how to use LWP by reading the documentation thoroughly, especially
LWP::Simple, which is probably as much as you need. If you get confused by
talk of packages, modules, objects, or references, then consult the perl
documentation at www.perl.com to learn about them.

Enjoy!



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

Date: Thu, 26 Aug 1999 08:05:49 -0400
From: Jay Flaherty <fty@mediapulse.com>
Subject: Re: How to Address an email using CGI
Message-Id: <935669403.519291805@news.mindspring.com>

On Wed, 25 Aug 1999, Tom Renic wrote:
>
>> I'm trying to set up a cgi script that will send out an email. I'm
>> having a problem trying to set it up so that a variable ($testrecipient)
>> is set in the "To" section and variables ($recipient, $recipient1,
>> $recipient2) are set in the "Cc" section as well as setting the
>> "Subject". Can someone PLEASE tell me how to do this? I can't get it to
>> run on HP-UX10 machine. HELP!!!!

Check out  The Perl Journal - ISSS+UE #14 (VOL. 4, NO. 2). It has many 
examples using smtp and there is also an artilce on how to include attachments.

jay


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

Date: Thu, 26 Aug 1999 11:01:53 GMT
From: rstagg@my-deja.com
Subject: inet_ntoa on HPUX 10.20
Message-Id: <7q36qt$gjn$1@nnrp1.deja.com>

I have a small Perl socket program, which uses perl 5.004.

Under Linux, it works perfectly. Using the same version of Perl (static
binary distribution from the Liverpool University HPUX porting centre),
it fails to perform the inet_ntoa() that I need:

/usr/lib/dld.sl: Unresolved symbol: inet_ntoa (code) from
opt/perl5/lib/PA_RISC1.1/5.00404/auto/Socket/Socket.sl

I've failed to find any information about this on the 'net, except that
it's happened to other people but no answers were posted.

Does anyone have any clues? Or any suggestions for circumventing the
problem?

Many thanks
Richard Stagg
(Direct e-mail: stagg at lentil dot org)


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


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

Date: 26 Aug 1999 08:38:25 -0400
From: meow <meowing@banet.net>
Subject: Re: inet_ntoa on HPUX 10.20
Message-Id: <87n1ve67jy.fsf@slip-32-100-243-13.ma.us.ibm.net>

In comp.lang.perl.misc, rstagg <rstagg@my-deja.com> wrote:

> I have a small Perl socket program, which uses perl 5.004.
> Under Linux, it works perfectly. Using the same version of Perl (static
> binary distribution from the Liverpool University HPUX porting centre),
> it fails to perform the inet_ntoa() that I need:

> /usr/lib/dld.sl: Unresolved symbol: inet_ntoa (code) from
> opt/perl5/lib/PA_RISC1.1/5.00404/auto/Socket/Socket.sl

I guess they forgot to link that in, eh?  I hate when that happens.

> I've failed to find any information about this on the 'net, except that
> it's happened to other people but no answers were posted.

> Does anyone have any clues? Or any suggestions for circumventing the
> problem?

Fortunately it's a small function.  This is borrowed from a similar
workaround in INN's C library.  I hope you're not missing much more.

use Socket;
sub inet_ntoa { join('.',  unpack('C4', shift)) }


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

Date: Thu, 26 Aug 1999 07:41:43 -0400
From: Edward Sumerfield <esumerfd@poboxes.com>
Subject: Re: Integrating CORBA and Perl
Message-Id: <37C527F7.83B767D3@poboxes.com>

I am looking for a similar package. If someone knows something please spill
the beans.

My requirements are different. I need to make my production apps into Corba
servers so that the support clients can remotely start and stop them.

Fred Fahnert wrote:

> Aravind Subramanian wrote:
>
> > Has anyone used Perl implementations of CORBA - the MICO or COPEX
> > modules
> >
> > I am trying to determine the viability of using CORBA and Perl in this
> > architecture: database - server - client
> >
> > Perl scripts on remote clients need access to a single relational
> > database. In the architecture above, this access would be provided
> > through an intermediate tier that uses JDBC to do the actual database
> > transactions.
> >
> > What CORBA-Perl *client* side tools would be needed for this? The only
> > requirement I have been able to determine is a idl2perl
> > compiler. Are there others? Server side implementaion is in Java and
> > tools exist for this already.
> >
> > Does anyone have *alternative strategies* to integrate Perl into a CORBA
> >
> > based architecture?
> >
>
> I know of somebody using a java servlet to proxy http calls from Perl to
> CORBA stuff.
>
> --fred




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

Date: Thu, 26 Aug 1999 10:17:09 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: LWP Legality Issue?
Message-Id: <37c613ba.363603@news.skynet.be>

Kit wrote:

>No, that would not be a copyright violation.  You cannot copyright what
>a form looks like.

No, but the DATA they present may well be copyrighted. Submitting a form
to a search engine, and representing the results, without showing on
your page that you're using this search engine, sure sounds like a
rip-off.

	Bart.


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

Date: Thu, 26 Aug 1999 10:35:12 +0100
From: Csaba Raduly <csaba.raduly@sophos.com>
Subject: Re: Perl a Black Sheep?
Message-Id: <37C50A50.BD3A8E3D@sophos.com>

Mark wrote:
> 
> joeyandsherry@mindspring.com wrote:
[snippage]
> 
> I'd be interested in what his definition of a REAL PROGRAMMING LANGUAGE is.

A programming language used by Real Programmers, i.e. FORTRAN :-)
Csaba

-- 
-----BEGIN GEEK CODE BLOCK----- 
Version 3.1
GCS/>GMU d- s:- a30 C++$ UL+ P+>+++ L++ E- W+ N++ o? K? w++>$ O++$ M-
V- PS PE Y PGP- t+ 5 X++ R* tv++ b++ DI+++ D++ G- e+++ h-- r-- !y+
-----END GEEK CODE BLOCK----- 

Csaba Raduly,    Software Developer (OS/2),    Sophos Anti-Virus
mailto:csaba.raduly@sophos.com            http://www.sophos.com/
US Support +1 888 SOPHOS 9            UK Support +44 1235 559933
Life is complex, with real and imaginary parts.


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

Date: Thu, 26 Aug 1999 10:43:30 +0100
From: Csaba Raduly <csaba.raduly@sophos.com>
Subject: Re: Perl a Black Sheep?
Message-Id: <37C50C42.EC65962C@sophos.com>

joeyandsherry@mindspring.com wrote:
> 
> Greetings,
> 
[snipp]
> 
> Why is Perl treated with such disdain? I've found many occasions where Perl
> programmers say "Perl can do that...", 
> 

What's more, as any Perl hacker knows, 
There's More Than One Way To Do It (tm)

Csaba

-- 
-----BEGIN GEEK CODE BLOCK----- 
Version 3.1
GCS/>GMU d- s:- a30 C++$ UL+ P+>+++ L++ E- W+ N++ o? K? w++>$ O++$ M-
V- PS PE Y PGP- t+ 5 X++ R* tv++ b++ DI+++ D++ G- e+++ h-- r-- !y+
-----END GEEK CODE BLOCK----- 

Csaba Raduly,    Software Developer (OS/2),    Sophos Anti-Virus
mailto:csaba.raduly@sophos.com            http://www.sophos.com/
US Support +1 888 SOPHOS 9            UK Support +44 1235 559933
Life is complex, with real and imaginary parts.


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

Date: Thu, 26 Aug 1999 10:40:13 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl a Black Sheep?
Message-Id: <37c7146c.541340@news.skynet.be>

Bart Lateur wrote:

>Whoever is pro Microsoft and contra Perl, is a clueless idiot.

Perhaps I'd better elaborate a bit on that.

If you have ANY experience with MS products, you know they're
bug-ridden. You can easily recognize a MS internet server by the errors
it gives in a Netscape browser: you often get message boxes saying
"socket is not connected" of "document contains no data". For that
reason, I'm pretty sure that Hotbot uses Microsoft servers. BTW that is
*NOT* Netscape's fault, but definitely an unreliable server. I bet that
Microsofts "solution" is for Internet Explorer simply to retry when it
receives these errors, and that's why you don't see that error on IE.

OTOH, experience with Perl shows me that it's VERY stable, and although
it has some bugs, virtually all of them are in obscure places where
non-geek programmers rarely thread.

Perl for CGI *is* primitive, but it is also extremly powerful. With it,
you need to go a really long way before hit your head on the ceiling. I
find, for example, that Perl's primitives allow far much easier data
manipulation, than a SQL based database.

ASP and other MS "solutions" start on a somewhat higher level, but
you'll hit that ceiling pretty early.

Anyway. If someone is in favour of MS with an almost religious
fanatiscism, and thinks that Perl is "outdated", that surely indicates
to me that this person has virtually no przactical experience, because
any experience will contradict those claims.

	Bart.


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

Date: 26 Aug 1999 12:44:52 GMT
From: revjack <revjack@radix.net>
Subject: Re: Perl a Black Sheep?
Message-Id: <7q3cs4$4aq$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight

Bart Lateur explains it all:

:For that reason, I'm pretty sure that Hotbot uses Microsoft servers.

~$ lynx -dump -head http://www.hotbot.com/
HTTP/1.1 200 OK
Server: Microsoft-IIS/4.0
[snip]


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

Date: Thu, 26 Aug 1999 13:30:36 +0200
From: Ralph Wiechmann <R.Wiechmann@alcatel.de>
Subject: perl versus Servlets
Message-Id: <37C5255C.B30572EF@alcatel.de>

We want to develop an server based application with Orcale DB. 
Now we are looking for pros and cons wether to take Java servlets or
perl. 
Any arguments ? 

kind regards 
Ralph


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

Date: Thu, 26 Aug 1999 12:29:33 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: perl versus Servlets
Message-Id: <Nqax3.7$RY.325@news.colt.net>

Ralph Wiechmann <R.Wiechmann@alcatel.de> wrote:
> We want to develop an server based application with Orcale DB. 
> Now we are looking for pros and cons wether to take Java servlets or
> perl. 
> Any arguments ? 

Oooh, I think you'll find plenty of arguments :-)

Java is a programming language. Servlet(s) are a programming environment.

For your kind of task, there is not a VAST distinction betweem the effective
ness of Java or Perl. Both have good database connectivity, both are 
object oriented, both have high level networking tools.

Servlets are good environment. They are much faster than CGI programs, they 
have objects for session handling, request and response handling and so forth.
They support database connection pooling, and they do or will soon support
embedded scripting (Java embedded in HTML).

These things are available for Perl, via something like mod_perl, together
with Apache::DBI, Apache::Session, ePerl, and so on. There are also commercial
applications such as velocigen that do something similar.

Both servlets and mod_perl (+ components) are somewhat immature - servlets
can be hard to set up with web servers, mod_perl ties you to apache, and there
are various annoying bits to Apache::DBI and Apache::Session.

In the end, the decision will probably rest on:
1. Do you already have Java programmers or Perl programmers? I would suggest
that the two technologies are close enough in capabilities that there is no
point re-hiring staff to fit the technology.

2. Are there ready made classes/modules that you could use? If there is an
existing component in on language that is not available for the other, and 
that would save alot fo time, I'd go with whatever lets you make use of that.

But of course - you can use both together. If you write your own Session 
class/module so that java servlets and mod_perl scripts can share session
information, you can use both quite happily in a single project. This is
something I've done and it worked very well.



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

Date: Thu, 26 Aug 1999 10:33:23 GMT
From: gary@onegoodidea.com (Gary O'Keefe)
Subject: Re: Regex Question
Message-Id: <37c5117e.5436246@news.hydro.co.uk>

A keyboard was whacked upside Samay's head and out came:

>Hi, I am looking for some simple regex solution.
>I have some files which contain multiple lines instead of 
>single lines for a single piece..
>
>ex.
>Start this 
>is 
>the ok End
>
>Start this is 
>the ok2
>End
>
>I want to have
>
>Start this is the ok End
>Start this is the ok2 End
>
>Thus I would like to remove all new lines between Start and 
>End

If you want to print all the lines in the file, joining only the lines
between 'Start' and 'End' you could use:

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

    use strict;

    while ( <DATA> ) {

        ( m/Start/ .. m/End/ ) && ( m/End/ || s/\n/ / );
        print;

    }

    __DATA__
    This
    is before the

    Start this is
    the ok
    End

    Start this is
    the ok2
    End

    and this is
    stuff after
    the end

which gives:

    This
    is before the

    Start this is the ok End

    Start this is the ok2 End

    and this is
    stuff after
    the end

Or, if you only want to print the joined up lines between 'Start' and
'End', then change the while loop to:

    while ( <DATA> ) {

        ( m/Start/ .. m/End/ ) && ( m/End/ || s/\n/ / ) && print;

    }

which gives:

    Start this is the ok End
    Start this is the ok2 End

Check out the bistable '..' operator in the perlop manual pages. I
only learnt a couple of days ago how cool this bad boy is. And I
thought it was just for slices...

HTH

Gary
--
Gary O'Keefe
gary@onegoodidea.com

You know the score - my current employer has nothing to do with what I post


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

Date: Thu, 26 Aug 1999 10:01:41 GMT
From: Jenda@Krynicky.cz (Jenda Krynicky)
Subject: Re: rename with ActivePerl
Message-Id: <1107_935661701@prague_main>

On Tue, 24 Aug 1999 21:07:15 GMT, 2002@antispam.calva.net (Christophe Oddo) wrote:
> On Wed, 25 Aug 1999 16:55:25 GMT, Jenda@Krynicky.cz (Jenda Krynicky)
> wrote:
> 
> 
> >Are you sure you have permissions to rename the file? 
> >Could the file be locked?
> >
> >I'm not aware of any special problem with rename() on Win98.
> >
> 
> 
> I only try to rename "wordlist.txt" in "wordlist.old".
> And "wordlist.txt" is a file I created myself.
> Editing its properties, there's no particular specification : it isn't
> an archive, it isn't a read-only file...
> 
> Is there something else to verify?
> I always get my 'Permission denied'... :-(

Is the file open by some program at that time?

For example if you open a file in Word it gets locked. And 

 rename "wordlist.txt", "wordlist.old" or die $!;

will print "Permission denied".
 
If something crashed, the file may have stayed locked by accident.
Are you able to rename some other files?

Jenda
http://Jenda.Krynicky.cz



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

Date: Thu, 26 Aug 1999 12:34:30 GMT
From: marius_13@my-deja.com
Subject: Servers for NT
Message-Id: <7q3c8l$k8o$1@nnrp1.deja.com>

I browsed through the past posts can couldn't find the answer.  Forgive
me if i missed it.  I am runnning NT4.0 & Win98 and downloaded the
latest ActivePerl.  What cgi server do you recommend for each OS.  I'm
looking to setup on for development purposes.  And any tips on setup
would be great.  I hoping to get one that's easy to setup.

Thanks
Brian


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


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

Date: Thu, 26 Aug 1999 07:39:50 -0400
From: Edward Sumerfield <esumerfd@poboxes.com>
Subject: Re: Shell vs Perl
Message-Id: <37C52786.B9AAB62D@poboxes.com>

Careful about arguing efficiency because the word is very subjective.

I am not a perl guru but I do write most of my script programs in perl,
not because it allows for short programs, because it certainly doesn't,
but it allows a level of OO modularity that makes my script base far more
reusable and therefore more powerful. It also gives me some level of
portability, I have a set of scripts managing a product and they run in
Solaris and on NT. Same code (OK there is one fork that has some different
code on NT but basically the same).

I would argue that the better of two scripts is the one that a maintainer
can understand most easily. The compactness/shortness of the code is
irrelevant. Did  you know that of a products development costs 70% of them
are code maintenance over the long years of that product exists. While
initial development costs may seem large the long term costs are what
destroy organizations.

kcounts@my-deja.com wrote:

> Well,
>
> I have a question to so humbly ask of all Perl compatriots.
>
> The system administrator at my workplace doesn't believe
> that a  Perl program  can be written to mimic the functionality of the
> below shell script and still keep as simple as the shell script.
>
> !#/usr/bin/ksh
>
> if [ "$1" = "" ]
>     then sort -t: +2n -3 /etc/passwd
> else
>     grep "[:/]$1[:/]" /etc/passwd | sort -t: +2n -3
> fi
>
> He says it took him a page and a half in Perl.
> I know it can be more efficient.
>
> Thanks for any input.
>
> K
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.




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

Date: Thu, 26 Aug 1999 12:04:40 GMT
From: Paul Dobbs <pdobbs@home.com>
Subject: Tough RegEx TWO - Its almost perfect BUT..
Message-Id: <37C52F80.DC196C73@home.com>

 Some great help and ideas from people here, thank-you kindly!
 I just need one more alteration to a replace function to get
 it doing just what it should, and I'm stuck on how to
 perform a NOT my operand.

(I use % sign to separate my sections)

s%(?<=">)(.{40})(\S+)(?=</a>)|(?<=href=")(\S{40})(\S+)(?=">)%$1$2%ig;

 So I am wanting to say if the text is between "> and </a>
OR  if its NOT between href=" and "> then lets split it at 40 chars.

 I tried changing the ?<= to ?!= and it didn't do what I
wanted, it split contents inside the href=" and "> section. I think 
all I need is the correct "not" format to apply and all will be roses!

 Is it a syntax error to apply the OR pipe in a replace command?

 If this text split can be made to work just as so, the
world will be a better place and s%:-(%:->%g;


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

Date: Thu, 26 Aug 1999 11:36:24 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: What are valid characters in hash keys
Message-Id: <37cb23a3.4435962@news.skynet.be>

Roger Musson wrote:

>$hash{key}='some_value';
>
>What are the valid characters for 'key'

No limits, except keys are treated as strings. Try:

    for (0 .. 255) {
        $hash{chr($_)} = $_;
    }
    ($\,$,)=("\n"," ");
    foreach (sort keys %hash) {
        print ord, $hash{$_}, length ;
    }

This prints a list that starts like

    0 1 0
    1 1 1
    2 1 2
    3 1 3
    4 1 4
 ...

and it goes on to 255. 256 lines. Note: the first value is the character
code of the hash key, the second is the length of the hash keys (should
be 1 in this example) and the third is the hash value. It should be the
same as the character code of the hash key.

	Bart.


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 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.  

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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


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