[15611] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3024 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 12 06:08:54 2000

Date: Fri, 12 May 2000 03:05:12 -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: <958125911-v9-i3024@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 12 May 2000     Volume: 9 Number: 3024

Today's topics:
    Re: 'use integer' causes strange output.. <nospam@devnull.com>
    Re: 'use integer' causes strange output.. <lr@hpl.hp.com>
    Re: 'use integer' causes strange output.. <nospam@devnull.com>
    Re: A question from Dynamic Whistler (Tad McClellan)
    Re: Accidental Creation of Static Variable nobull@mail.com
    Re: Anyone got ideas? How could Perl coorporate with a  <damon_jebb@nai.com>
    Re: Beginner: 8bit-regexp <ck@ix.heise.de>
    Re: Beginner: 8bit-regexp ocromm@my-deja.com
        Fast on 95 - Slow on NT intman@my-deja.com
    Re: gethostbyaddr (Roman Putyatin)
    Re: Getting System call return data <nospam@devnull.com>
    Re: Getting System call return data <jeff@vpservices.com>
    Re: Getting System call return data (Tad McClellan)
    Re: Getting System call return data <nospam@devnull.com>
    Re: Help Needed  - Perl Matching Operator <fosterd@hartwick.edu>
        home PC talking to webserver <totally@bogus.com>
    Re: How do you create a module and pass variables into  <billy@arnis-bsl.com>
    Re: How to use Perl script in Windows Logon <carvdawg@patriot.net>
    Re: How to use system and "cd" command? (Tad McClellan)
    Re: if file already exists then remove... (Craig Berry)
    Re: internal variables <jeff@vpservices.com>
    Re: linked list in perl <blah@nospam.com>
    Re: Literate Programming and Perl (Andrew Johnson)
    Re: MUCH better DATA file formatting :) (THANK YOU) <nospam@devnull.com>
        page access dependant on $ENV{HTTP_REFERER} <bill@billcampbell.com>
        PERL exe? <bilmcchr@uswest.net>
        Perl for Windows - I'm confused... (Lobo)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 12 May 2000 04:06:43 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: 'use integer' causes strange output..
Message-Id: <8fg00j$ct9$0@216.155.33.118>

In article <slrn8hleg9.k1b.tadmc@magna.metronet.com>, tadmc@metronet.com (Tad McClellan) 
wrote:

 | >print $q->hidden('-name'=>'hol', '-default'=>'', '-override'=>1);

you have to do it like this (works much better)

#!perl -w
use strict;
use CGI qw( :standard :html3 ); # lets you use OO form instead of Function form
use CGI::Carp qw(fatalsToBrowser); #reports diagnostic msgs to the client
use CGI::Pretty qw( :html3 ); # formats nicer

print hidden({-name=>'hol', -default=>'', -override=>1});

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Thu, 11 May 2000 22:57:25 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: 'use integer' causes strange output..
Message-Id: <MPG.13853d2139e090e298aa63@nntp.hpl.hp.com>

In article <8fg00j$ct9$0@216.155.33.118> on 12 May 2000 04:06:43 GMT, 
The WebDragon <nospam@devnull.com> says...
> In article <slrn8hleg9.k1b.tadmc@magna.metronet.com>, tadmc@metronet.com (Tad McClellan) 
> wrote:
> 
>  | >print $q->hidden('-name'=>'hol', '-default'=>'', '-override'=>1);
> 
> you have to do it like this (works much better)
> 
> #!perl -w
> use strict;
> use CGI qw( :standard :html3 ); # lets you use OO form instead of Function form

Your comment is backwards -- Function form instead of OO form

> use CGI::Carp qw(fatalsToBrowser); #reports diagnostic msgs to the client
> use CGI::Pretty qw( :html3 ); # formats nicer
> 
> print hidden({-name=>'hol', -default=>'', -override=>1});

That's not what the documentation says.

        print $query->hidden(-name=>'hidden_name',
                             -default=>['value1','value2'...]);
                -or-
        print $query->hidden('hidden_name','value1','value2'...);

Whether you use the function or OO interface shouldn't matter.

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


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

Date: 12 May 2000 09:14:23 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: 'use integer' causes strange output..
Message-Id: <8fgi1f$sih$0@216.155.32.232>

In article <MPG.13853d2139e090e298aa63@nntp.hpl.hp.com>, Larry Rosler <lr@hpl.hp.com> 
wrote:

 | In article <8fg00j$ct9$0@216.155.33.118> on 12 May 2000 04:06:43 GMT, 
 | The WebDragon <nospam@devnull.com> says...
 | > In article <slrn8hleg9.k1b.tadmc@magna.metronet.com>, tadmc@metronet.com 
 | > (Tad McClellan) 
 | > wrote:
 | > 
 | >  | >print $q->hidden('-name'=>'hol', '-default'=>'', '-override'=>1);
 | > 
 | > you have to do it like this (works much better)
 | > 
 | > #!perl -w
 | > use strict;
 | > use CGI qw( :standard :html3 ); # lets you use OO form instead of 
 | > Function form
 | 
 | Your comment is backwards -- Function form instead of OO form
 | 
 | > use CGI::Carp qw(fatalsToBrowser); #reports diagnostic msgs to the 
 | > client
 | > use CGI::Pretty qw( :html3 ); # formats nicer
 | > 
 | > print hidden({-name=>'hol', -default=>'', -override=>1});
 | 
 | That's not what the documentation says.
 | 
 |         print $query->hidden(-name=>'hidden_name',
 |                              -default=>['value1','value2'...]);
 |                 -or-
 |         print $query->hidden('hidden_name','value1','value2'...);
 | 
 | Whether you use the function or OO interface shouldn't matter.

doh. thanks for the corrections.. I fear I've fried my brain attempting to wrap it around 
all those complex hashes I was working with :)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Fri, 12 May 2000 02:28:37 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: A question from Dynamic Whistler
Message-Id: <slrn8hn94l.n6k.tadmc@magna.metronet.com>

On Fri, 12 May 2000 01:18:13 GMT, bzooty@my-deja.com <bzooty@my-deja.com> wrote:

>What would be the most important resource that an PERL developer would
>hope to find on our site?


How to correctly spell the name of the language would be a good start.


Perl FAQ, part 1:

   What's the difference between "perl" and "Perl"?


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 12 May 2000 10:28:26 +0100
From: nobull@mail.com
Subject: Re: Accidental Creation of Static Variable
Message-Id: <u94s84dsn9.fsf@wcl-l.bham.ac.uk>

abigail@foad.org (Abigail) writes:

> On 11 May 2000 19:14:27 +0100, nobull@mail.com <nobull@mail.com> wrote:
>
> ++ Well _I_ would expect an error as you get if you try to put a if
> ++ qualifier on use() in 5.5 and as happens if you write the analagous
> ++ code in C++.
> 
> my() isn't 'use', and Perl isn't C++.

No, but where correct behaviour is not formally defined an intelegent
being will infer the the correct behaviour from related experiences.

my() isn't use() but both are statements that have compile-time effects.

Perl isn't C++ but both are programming languages.

> ++ Failing that I'd expect it to do:
> ++ 
> ++   my $foo; $foo = 3 if $bar == 16
> 
> Really? 'my $foo = 3 if $bar == 16' contains one statement that does
> an assignment to $foo, while 'my $foo; $foo = 3 if $bar == 16'
> contain 2. I would not call that at all reasonable.

So is the actual behaviour any more reasonable?  Using equally bogus
analysis it contains two assignments the first time it is encountered
and one thereafter!

> ++   variables declared with C<my> are totally hidden from the outside
> ++   world, including any called subroutines.  This is true if it's the
> ++   same subroutine called from itself or elsewhere--every call gets
> ++   its own copy.

> ++ It is a bug.  Code bug or documention bug - take your pick.

> Where's the bug?

See the original example at the beginning of this thread and the
documentation extract quoted above.

> Could you show an example where 'my $foo = 3 if $bar == 16'
> causes $foo to be visible outside of the block? 

No, of course I can't show you that.  This is, however, irrelevant.

> From the documentation:
>      A `my' has both a compile-time and a run-time effect.  At
>      compile time, the compiler takes notice of it.  The
>      principle usefulness of this is to quiet `use strict
>      'vars'', but it is also essential for generation of closures
>      as detailed in the perlref manpage.  Actual initialization
>      is delayed until run time, though, so it gets executed at
>      the appropriate time, such as each time through a loop, for
>      example.
> 
> And that, for me, explains *exactly* what 'my $foo = 3 if $bar == 16'
> does. 

The "for me" is very significant here.  You are inferring information
that isn't actually there based, as I said above, on your previous
experiences of how programming languages act.  Your experiences are
not the same as mine so your inferrences are not the same as mine.  If
your experiences include lots of digging in the guts of Perl then it
is, of course, likely that your inferrences will be more accurate -
this is however irrelevant.

> Once you understand the above paragraph, it's clear as crystal.

That's the crux of the matter.  "understand" in this context means
"correctly infer the missing information".  Of course if the above
paragraph were disambiguated so that the current behaviour was
explicity defined then you'd have two contaditary statements in the
documentation.

> No bug - not in the code, and not in de documentation either.

I have shown you a categorical statement in the documentation and a
behaviour that violates that categorical statement.  You can't simply
pick another bit of the documentation and say "the behaviour doesn't
also violate this statement so there is no bug".

BTW: can you present a logical argument as to how the semantics that I
would consider intuative are in conflict with the documentation you
quote?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 12 May 2000 08:53:33 +0100
From: "Damon Jebb" <damon_jebb@nai.com>
Subject: Re: Anyone got ideas? How could Perl coorporate with a DLL
Message-Id: <8fgda5$lm5$1@new-news.na.nai.com>

I am certain it can be done, though not sure how perfectly as I have never
needed to yet.  Look for the Windows API modules and read the manuals on
them.

Damon

wstsoi <wstsoi@hongkong.com> wrote in message
news:8ffo8n$5qn$1@justice.csc.cuhk.edu.hk...
> As title, do anybody know How could Perl coorporate with a DLL?
> mostly I need to call a DLL from a Perl script
>
> or it is just impossible to do it?
>
> thanks to evryone looking into my problem!!!
>
>
>
>




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

Date: Thu, 11 May 2000 17:02:17 +0200
From: Christian Kirsch <ck@ix.heise.de>
Subject: Re: Beginner: 8bit-regexp
Message-Id: <391ACB79.657135C9@ix.heise.de>

ocromm@my-deja.com wrote:
> 
> Hello,
> 
> I'm using regexps to find similar strings in a dictionary (to describe
> it easily), but they're all in German, and perl doesn't like my
> non-7bit-characters in regexps (fine with strings, though).
> 
> A quick search shows me that it has to do with uing the locale, but how
> do I do it? Where can I find example code?
> 
> The standard locale on my computer is Japanese, and should remain so.
> 
> Many thanks for any advice.
> 

perldoc perllocale

-- 
Christian Kirsch
ck@held.mind.de       ck@ix.heise.de
Tel +49-30-78702288   +49-511-5352-590   
Fax +49-30-78702289


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

Date: Fri, 12 May 2000 08:46:26 GMT
From: ocromm@my-deja.com
Subject: Re: Beginner: 8bit-regexp
Message-Id: <8fggcu$av0$1@nnrp1.deja.com>

In article <Pine.GSO.4.10.10005110647040.16364-
100000@user2.teleport.com>,
  Tom Phoenix <rootbeer@redcat.com> wrote:
> On Wed, 10 May 2000 ocromm@my-deja.com wrote:
>
> > I'm using regexps to find similar strings in a dictionary (to
describe
> > it easily), but they're all in German, and perl doesn't like my
> > non-7bit-characters in regexps (fine with strings, though).
>
> I don't see why it would. Could you make a small example which should


Thanks to you, and to Christian Kirsch.

Actually the non-ASCII-characters didn't matter. The problem was that I
messed up the encoding at some points.
I had to correct a few small errors in some of the files, and I did so
with mule, which garbled some of my characters, probably because I
disn't specify the code upon loading, and mule's auto-recognition
failed.

You can't imagine how many time I spend with errors stemming from that
kind of code-problems. Try using sources from Japanese Windows (SJIS)
and Mac-coded German, incompletely exported into Windows format, and
then use these under UNIX...

Oliver


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


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

Date: Fri, 12 May 2000 04:40:09 GMT
From: intman@my-deja.com
Subject: Fast on 95 - Slow on NT
Message-Id: <8fg1v7$qtg$1@nnrp1.deja.com>

I have a Perl script that I am using with
ActivePerl to provide access to SQL Server and
Access DBs from machines running VMS and Unix.  I
wrote the protocol between the client side and
the middleware perl script and then I am using
DBI::ODBC to connect to the database.  The
problem is that I have been using the script on a
machine that runs Win95 and it runs great.  On a
single column many row select I have gotten rates
of 470 rows per second retrieved.  I need to make
this work on Windows NT and the script just
crawls when I run it on NT Workstation.  I am
using the "inetd.exe" program written by Steve
Freyder and Bruce Lightner to launch the perl
script.  I have also tried it using a demo
version of the internet daemon service from
Ockham Technology.  When I run the script
interactively on the NT machine it seems to run
fine.  I would appreciate any thoughts on the
subject.


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


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

Date: 12 May 2000 06:38:43 GMT
From: roman@jet.msk.su  (Roman Putyatin)
Subject: Re: gethostbyaddr
Message-Id: <958113522.895657@tiger>

Roman Putyatin <roman@jet.msk.su> wrote:
RP>  Hi all!
RP>  
RP>  i have 4 nameservers ('name1','name2','name3','name4') in my net. how i can get
RP>  any hostname directly from nameserver 'name3'?
RP>  

Thank all, has understood.


			roman

-- 
---
"General Protection Fault - Invalid user". Yes/No?


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

Date: 12 May 2000 04:11:37 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Getting System call return data
Message-Id: <8fg09p$ct9$1@216.155.33.118>

In article <slrn8hllq6.kgo.tadmc@magna.metronet.com>, tadmc@metronet.com (Tad McClellan) 
wrote:

 | [snip jeopardist quoting of entire damn article including even .sigs ]

I must have missed something while I was away from usenet for a while.. why do they call 
it Jeapordy quoting? :)

I mean, I know the gameshow, but I don't follow the reference.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Thu, 11 May 2000 21:34:02 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Getting System call return data
Message-Id: <391B89BA.3C99AFF5@vpservices.com>

The WebDragon wrote:
> 
> In article <slrn8hllq6.kgo.tadmc@magna.metronet.com>, tadmc@metronet.com (Tad McClellan)
> wrote:
> 
>  | [snip jeopardist quoting of entire damn article including even .sigs ]
> 
> I must have missed something while I was away from usenet for a while.. why do they call
> it Jeapordy quoting? :)
> 
> I mean, I know the gameshow, but I don't follow the reference.


Normal conversation:  

      Q.  What color is an orange?
      A.  Orange

Jeopardy conversation

      A. Orange
      Q. What color is an orange?

Jeopardy posting:

      A.  response to a posting
      Q.  > the original posting

Capiche?

-- 
Jeff


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

Date: Fri, 12 May 2000 02:23:18 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Getting System call return data
Message-Id: <slrn8hn8qm.n6k.tadmc@magna.metronet.com>

On 12 May 2000 04:11:37 GMT, The WebDragon <nospam@devnull.com> wrote:
>In article <slrn8hllq6.kgo.tadmc@magna.metronet.com>, tadmc@metronet.com (Tad McClellan) 
>wrote:
>
> | [snip jeopardist quoting of entire damn article including even .sigs ]
>
>I must have missed something while I was away from usenet for a while.. why do they call 
>it Jeapordy quoting? :)
>
>I mean, I know the gameshow, but I don't follow the reference.


Because it it backwards chronology.

The Answer comes _before_ the Question.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 12 May 2000 09:36:35 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Getting System call return data
Message-Id: <8fgjb3$ii$0@216.155.32.232>

In article <391B89BA.3C99AFF5@vpservices.com>, Jeff Zucker <jeff@vpservices.com> wrote:


 | > I must have missed something while I was away from usenet for a while.. 
 | > why do they call
 | > it Jeapordy quoting? :)
 | > 
 | > I mean, I know the gameshow, but I don't follow the reference.
 | 
 | 
 | Normal conversation:  
 | 
 |       Q.  What color is an orange?
 |       A.  Orange
 | 
 | Jeopardy conversation
 | 
 |       A. Orange
 |       Q. What color is an orange?
 | 
 | Jeopardy posting:
 | 
 |       A.  response to a posting
 |       Q.  > the original posting
 | 
 | Capiche?

LMAO yeah I do.. man that's quite an original way of referring to that annoying[1] 
practice of responding at the top of postings instead of the bottom. 

I'll have to remember that one. Thanks for the clue. (wait, that's a different gameshow).

-Scott


[1] Annoying doesn't even BEGIN to describe it.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Fri, 12 May 2000 01:07:12 -0400
From: Decklin Foster <fosterd@hartwick.edu>
Subject: Re: Help Needed  - Perl Matching Operator
Message-Id: <20000512010712.A16331@photek.dhs.org>

Abigail <abigail@foad.org> writes:

> According to RFC 822, the following are valid addresses:
> 
>          Foo:;
>          :;
>          (This) "is" (valid) : (really!) ;

Actually, the second one is not (don't worry, RFC::RFC822::Address
does reject it). But you have a point.

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)



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

Date: Fri, 12 May 2000 06:04:34 +0100
From: mopi <totally@bogus.com>
Subject: home PC talking to webserver
Message-Id: <8n3nhs0cjs55ua3pr3airujfc0d0mqpnfj@4ax.com>

Excuse subject I'm not certain how to ask question.

Do you know of a something I can install on my home PC that will
automatically talk to online webserver and fill in details I specify.

I want to use email client to mail my mailserver/linux gateway and
have that PC type in details (username/password and more) on an online
webserver [ www.quios.com to be specific ] end result will be email to
mobile phone sms message.

tia
Paul




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

Date: Fri, 12 May 2000 08:28:08 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: How do you create a module and pass variables into and out of it?
Message-Id: <8fgfab$9o2$1@nnrp1.deja.com>

In article <8fbmie$d4u$1@pumba.class.udg.mx>,
  "David Shapiro" <david.shapiro@wcom.com> wrote:
> I have seen a brief description of pakcage Some:Module that was posted to
> daily_perl@yoak.com.  But I do not understand it.  I have a bunch of
> functions that are common to many of my programs that I want to put in a
> module that I can use in new programs.  I think you put use package_name in
> the new progrm, but perhaps it is just require package_name.  I have not
> understood the explainations of the differences between require and use.
> After I do this, you can call the functions with
> &package_name::function_name, but it is not clear to me how to allow the
> package_name module to have access to variables that exist in the new
> program and vice-versa.  For example, if you had a function called mailinfo
> that all programs use, I want to be able to do something like
> &package_name::mailinfo($address,$attachment), where $address and
> $attachment are defined in the new program.  I see all kinds of things in
> the packagee Some::Module example I do not understand:  use Exporter ();,
> @ISA, @EXPORT, %EXPORT_TAGS, etc.  Any help on this and direction to good
> reading resources for this would be greatly appreciated.
>

I'd suggest to start with 'perldoc perlfaq7', it contains a nice FAQ: "How do
I create a module?".

To get an idea about all these @EXPORT etc. variables, consult 'perldoc
Exporter'.

And read 'perldoc perlmod', 'perldoc perlmodlib'.

If you haven't all these manuals locally with you perl distribution,
then visit CPAN (http://www.cpan.org/doc/manual/html/pod/index.html).

Good luck.

Ilja.



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


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

Date: Fri, 12 May 2000 05:49:36 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: How to use Perl script in Windows Logon
Message-Id: <391BD3B0.119D864F@patriot.net>

To Rich and Chuck,

Gents,

Would you two care to take a few minutes to help me out?  I'm not a sysadmin,
I'm a security consultant.  I work on NT and do a LOT of Perl programming.  One of the

questions I have run across is how to automate some tasks w/o loading Perl on every
workstation.  I have my own methods, but you developed yours.

Could you document what you did, in fairly exact terms, so that other sysadmins would
be able to replicate it?  I'd like to post it on the Perl-NTAdmins listserver, as well
as at
other places where NT-Perl code is kept.

I will ensure that the proper credit is given.  I'd just like to see it up on the web
someplace.
If it's already there, fine...can you send me a URL?  Otherwise, I'd like to at least
post if off
of my web page...at an absolute minimum.

Thanks,

Carv





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

Date: Fri, 12 May 2000 01:39:26 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to use system and "cd" command?
Message-Id: <slrn8hn68e.mnq.tadmc@magna.metronet.com>


[ Please put your comments *following* the quoted text that
  you are commenting on.

  Please quote only the text that you are going to comment on.

  Please do not quote .sigs

  Please see    news.announce.newusers

  Now, expecting flames for *this* post would have been appropriate...

  Jeopardectomy performed.
]


On 11 May 2000 23:39:15 GMT, mcnuttj@missouri.edu <mcnuttj@missouri.edu> wrote:
>jgtrujillo@my-deja.com wrote:

>: Problem description: I want to update the "modified" time for all files
>: in a directory (i.e. /home/usr/data).

>: I have been using this from command line (some users have "trouble"
>: using this command):
>: % find . -type f touch {}\;
>
>: I want to write a cgi interface that allows the user to specify the
>: directory and all of the files will be updated.

[ snip changing cwd in system() call ]

>: thanks, gurus!



>I'm no guru, but here's what I'd do (kludgy, I think):
>
>$dir = (user's specified dir); # However you get this.
>$temp = `pwd`;
>chop $temp;
 ^^^^


People have been spelling that "chomp" for about 5 years now.


>$destdir=$temp.$dir;
              ^^^

Don't you need a directory separator in there?

How do you know that the user-entered dir is relative to the cwd?



>$outcome = `touch $destdir *`;
  ^^^^^^^


That's a pretty poor name since it gets the _output_ from
touch, not its exit value (which is what indicates
the outcome).


>That's a particularly tedious and ugly way to do it, but it'll work.
                                                          ^^^^^^^^^^

I am skeptical.


>One difference between 'find' and the above way, though, is that with find
>you specified that it must be a file, and find works recursively...  so
>how about this:


How about using the already invented recursive dir searching wheel?

   perldoc File::Find


># If $dir is not an absolute path, use something like this:

I think you need that qualification on your code above too...


># @temp = `pwd';
   ^
   ^

Why an array?

Are you expecting pwd to output multiple lines?


>Keep in mind that I *know* there's a system call in perl that will get you
                   ^^^^^^^^           ^^^^^^^^^^^
>the current directory.  


Please share that with us.

I know of a module that does that, but not a system call
(you realize that "system call" does not mean Perl's
 system() function? It means Perl's syscall() function.
)


>What's above is a kludge.  Also, the syntax for
>the `find...` is going to be tricky.  Using system() might be a better way
>to go.  Personally, I prefer:


Using system() nor find(1) will be "better".

Using File::Find will be better.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 12 May 2000 04:10:48 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: if file already exists then remove...
Message-Id: <shn128nkcp7@corp.supernews.com>

Abigail (abigail@foad.org) wrote:
: ++ Merely doing an error check on unlink makes it hard to discriminate
: ++ between cases 1 and 2.  As a result, it is difficult to determine if the
: ++ file does or does not exist following the unlink.
: 
: I disagree. Doing a -e followed by an unlink isn't an atomic action.
: What if some other process deletes the file after you did the -e,
: but before you did the unlink? But checking the return value of
: unlink, and if false, the value of $!, makes it trivial to distinguish
: between 1), 2) and 3). And since -e followed by unlink isn't atomic,
: you need to do that anyway, so why bother with the -e?

Okay, you got me there.  This is an important consideration if multiple
processes are involved.  But it is (moderately) harder to analyze $! than
to do it in two steps, *if* you can count on your file not being touched
by other processes.

Welcome back to clpm, by the way.

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "The road of Excess leads to the Palace
      of Wisdom" - William Blake


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

Date: Thu, 11 May 2000 21:26:23 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: internal variables
Message-Id: <391B87EF.6E05D6FC@vpservices.com>

Bill wrote:
> 
> I found some of what I was looking for at
> http://www.qb45.com/perl/tutorial.htm 

Oh dear.  I just had a look at that tutorial.  Please do yourself a
giant favor and erase your bookmark to it.  It is *not* a good
introduction to Perl.  Among other problems: no -w, no use strict,
confusing escaping of quotes ( "\"" instead of qq{"} ), a hand-rolled
CGI parse routine that ignores security, an email "validator" that
simply looks for the presence or absence of a splat, and many other
problems.  If that page is a tutorial of anything, it is a classic
example of what not to do when you learn Perl.  If you are really
interested in learning Perl, buy a book by Randal Schwartz or Andrew
Johnson or Simon Cozens.

BTW, I am setting followups to comp.lang.perl.misc since general
questions about Perl belong there rather than in the modules newsgroup.

-- 
Jeff


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

Date: Fri, 12 May 2000 09:57:49 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: linked list in perl
Message-Id: <391BB97D.5F8A474E@nospam.com>

Hi Perl,

Perl Discussion wrote:
> is it possible to have a linked list in perl?

  Surely, take a look to the perlref man page:

	perldoc perlref


	Best regards,
		Marco


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

Date: Fri, 12 May 2000 04:48:37 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Literate Programming and Perl
Message-Id: <F2MS4.12136$95.155799@news1.rdc1.mb.home.com>

In article <391B79B7.1C1E4B2C@mindspring.com>,
 A. R. Goldman <argoldman@mindspring.com> wrote:
> Greetings:
> I am fairly new both to programming in general, and to Perl in
> particular, but I feel that the earlier I create good habits the
> better. To that end, I have become intrigued by the ideas of
> Literate Programming (I am an editor by trade), and was hoping
> that I might be pointed to any resources for Literate Programming
> 
> using Perl, or any resources for a beginner to get some initial
> training in Literate Programming in general...]

You can find the literate programming FAQ at:

    http://shelob.ce.ttu.edu/daves/lpfaq/faq.html

and the noweb homepage (noweb is a language independent LP tool) at:

    http://www.eecs.harvard.edu/~nr/noweb/

There is a webring of LP sites, the list of which can be found at:


    http://www.webring.org/cgi-bin/webring?ring=litprog;list

And, as another poster mentioned, MJD has an article discussing LP on
perl.com:

    http://www.perl.com/pub/tchrist/litprog.html

Finally, my book (see .sig) uses LP in parts to present example
programs, two of which are available for download from the
publisher's website.

regards,
andrew

-- 
Andrew L. Johnson   http://members.home.net/andrew-johnson/epwp.html
      Some days you are the bug, 
      some days you are the windshield.


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

Date: 12 May 2000 09:45:18 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: MUCH better DATA file formatting :) (THANK YOU)
Message-Id: <8fgjre$ii$1@216.155.32.232>

In article <Pine.A41.4.10.10005112322010.14222-100000@ginger.libs.uga.edu>, Brad Baxter 
<bmb@ginger.libs.uga.edu> wrote:

 |  1  #!/usr/local/bin/perl -w
 |  2  use strict;
 |  3
 |  4  my $input_File = "xxx";  # input_File...oh, so close! :-)

heh. keeps me happy, keeps everyone else happy. :>

 |  5  my @data;
 |  6
 |  7  #open(IN, "<$input_File");
 |  8  #This must have been a typo, because of course you meant this:
 |  9  open(IN, "<$input_File") || die "Can't open $input_File: $!";

doh! thanks :)

 | 11  chomp( @data = <IN> );  # you need those parens

now THIS is interesting. (making a note) Thanks :D 

 | 13  close IN;
 | 14
 | 15  print join "\n", @data, "\n";
 | 
 | Output:
 | 
 | Capture your desire
 | Mold its clay into a vase
 | Fill the vase with love
 | 
 | 
 | See also perldoc -f chomp (or whatever is the Mac equivalent).

it's actually in perlfunc. The Mac version of perl comes with a rather nice pod file 
reader called Shuck (looks like a corncob). I can pretty much toss anything with pod-style 
documentation at it.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Fri, 12 May 2000 06:55:53 GMT
From: "Bill" <bill@billcampbell.com>
Subject: page access dependant on $ENV{HTTP_REFERER}
Message-Id: <ZVNS4.24991$55.532943@news2.rdc1.on.home.com>

FILE-A uses a form that sends a hidden field "safe" with a value of "1" in
order to prevent FILE-B from being bookmarked.

Below is the code I use in FILE-B. How would I change it so that instead of
relying on the passed variable from FILE-A, it would be dependant on
$ENV{HTTP_REFERER} being FILE-A ?

#----------------------------------------
require "cgi-lib.pl";    # library with readparse and printheader routines
&ReadParse(*input);
print &PrintHeader;

($text = $input{'text'}) =~ s/\n/\n<BR>/g;
if ($input{'safe'}eq "1"){
print "correct page access";
} else {
print "improper page access";
}






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

Date: Fri, 12 May 2000 01:37:17 -0700
From: Bill <bilmcchr@uswest.net>
Subject: PERL exe?
Message-Id: <958120702.653952922@news.uswest.net>

I am curious if anyone can point  me ot some information about compiling PERL
scripts to excutables. Thanks.


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

Date: Fri, 12 May 2000 07:50:15 GMT
From: er@matrix.com.br (Lobo)
Subject: Perl for Windows - I'm confused...
Message-Id: <391bb375.33547464@news.matrix.com.br>

Hello there.

I guess many people must ask and want this, so please if anybody can
give me some information about...

I want to install Perl on my computer. I'm currently running Windows
98 and this are my questions - things that I'm really worried about:

1) Wich one is the best webserver to run perl on windows (free, if
possible)?

2) Do I HAVE to get ActiveState? I've heard a lot of criticism about
ActiveState, so I'm really scared. Is there any other kind of Perl for
Windows?

3) I've installed Perl Builder here, wich seems to have a Perl
interpreter. How is that? If it really have a Perl interpreter, how
can I update it? If I install this ActiveState it will conflict with
Perl Builder's interpreter?

Please, any comments, insights and tips will be very appreciated.

Best regards,




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

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


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