[10717] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4316 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 29 04:07:30 1998

Date: Sun, 29 Nov 98 01:00:22 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 29 Nov 1998     Volume: 8 Number: 4316

Today's topics:
        Awk to Perl <ndatta@bright.net>
    Re: copy a file - How? <r28629@email.sps.mot.com>
    Re: Crontab and "require" Lee.Lindley@bigfoot.com
    Re: embedded while loop problem <r28629@email.sps.mot.com>
        Handling the last line of a file differently (123) (Nick Halloway)
    Re: How does one get an SSL? <custservice@bengal-grp.com>
        html mail imchat@ionet.net
    Re: I have a question about Perl and CgI? (brian d foy)
        Makefile.PL problem - "make install" doesn't install (Ken Williams)
    Re: Newbie: Search Engine (Tad McClellan)
        Please help me solve three CGI problem: Make Dir, Creat <msl1997@yahoo.com>
        Recursion jstrike@execpc.com
    Re: Recursion (David Huggins)
        Redirecting STDERR to STDOUT? <dejahvu@erols.com>
    Re: Redirecting STDERR to STDOUT? (brian d foy)
    Re: Redirecting STDERR to STDOUT? (Ken Williams)
    Re: Rename on NT-server <mats@webhandel.nu>
    Re: Rename on NT-server (Ethan H. Poole)
    Re: rename() on NT (Tim Peter)
    Re: Running Perl scripts as NT services galbavy@stuttgart.nospam.de
        sysread question <bmaillet@mindspring.com>
    Re: sysread question (Larry Rosler)
    Re: Writing to password protected directory (brian d foy)
    Re: Y2K thoughts - from someone who works on it (Igor)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Sun, 29 Nov 1998 00:44:27 -0500
From: "Neil Datta" <ndatta@bright.net>
Subject: Awk to Perl
Message-Id: <73qn81$qt3$1@cletus.bright.net>

I am currently reviewing learning Perl for Win32.  I was wondering if
someone could please give me an idea how the awk script shown below would be
implemented in Perl.

$awk '{system("DOS COMMAND "$1 $2);print $1" Done"}' FILE.TXT

I have been eyeing the O'Reilly book on Learning Perl at the local store and
would like an idea as to what kind of learning curve Perl entails.  I am
looking for some scripting language in common between Win32 and Unix.  I
currently have a little knowledge of ksh,awk,C.

Many thanks - Neil




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

Date: Sat, 28 Nov 1998 20:52:10 -0500
From: Tk Soh <r28629@email.sps.mot.com>
To: Sander Jonkers <snif@xs4all.no.spam.nl>
Subject: Re: copy a file - How?
Message-Id: <3660A89E.E0A2F865@email.sps.mot.com>

[posted to c.l.p.m and copy emailed]

Sander Jonkers wrote:
[...] 
> Solution: use something linke system("copy myfile.gif otherfile.gif");
                                        ^^^^ 
I presume this is on the Windoze systems, which will be 'cp' in Unix. For a
more portable solution, checkout standard module File::Copy

HTH.

-TK


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

Date: 29 Nov 1998 03:41:52 GMT
From: Lee.Lindley@bigfoot.com
Subject: Re: Crontab and "require"
Message-Id: <73qfq0$25l$1@rguxd.viasystems.com>

Lee.Lindley@bigfoot.com wrote:
:>David Coppit <dwc3q@mamba.cs.virginia.edu> wrote:

:>:>What's the best way to let a script know that it can find a "require"'d
:>:>file in the directory in which the script is run?

:>Cron does not necessarily provide you with an environment that you
:>would expect.  Don't depend on anything in the environment being
:>available or on the current working directory being where you
:>expect.  Use the full path of the directory when you specify it with
:>either the "-I" command line switch or the BEGIN block.  Or use the
:>full path when you require the file.  If you want to be able to
:>move the whole kit around, then the "-I" switch would seem to be
:>best.

I stand corrected.  The standard module FindBin.pm would appear
to be the best way to do this.

:>:>From what I understand, $0 doesn't always give the full directory.

:>You have some control over what goes into $0, but I don't know that
:>it is portable.  I don't think it would be a very good method for
:>specifying the location of include files.

[snip several tests of $0]

My tests were misleading.  It turns out that you CAN get to the full
path of the script file from a combination of $0 and getcwd().
FindBin.pm does it (and more).

:>:>The University of Virginia             http://www.cs.virginia.edu/~dwc3q
:>Go Hokies!

They choked on me again.  Congratulations on another year of bragging rights.

-- 
// Lee.Lindley   | There was a time when I thought that "being right"
// @bigfoot.com  | was everything.  Then I realized that getting along
//    | was more important.  Still, being right is more fun!
//    | And if I'm wrong, somebody will get some joy out of telling me!


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

Date: Sat, 28 Nov 1998 21:11:08 -0500
From: Tk Soh <r28629@email.sps.mot.com>
To: Felix Maurer <maurerf@post.ch>
Subject: Re: embedded while loop problem
Message-Id: <3660AD0F.93ED5D1D@email.sps.mot.com>

[posted to c.l.p.m and copy emailed]

Felix Maurer wrote:
> 
> Thanks a lot to both of you.
> 
> I'm not so familiar with hash, so I have to go to read the books to figure
> out what you are meaning. I did modifiyed my previous program as follow;
> 
> @infile=sort <INFILE>;
> @x500=sort <X500>;
> 
> LINE: foreach $x500(@x500) {
                 ^^^^  ^^^^
although Perl is smart enough to differentiate between these two, you should
avoid duplicating the variable names for readability, hence maintainability.

>   chomp $x500;
>   $uid=substr($x500,26,12);
>   $_=$uid;
>   s/ //g;
>   $uid=$_;

a bove three lines simplies to:
    $uid =~ s/ //g;

>   $oe=substr($x500,332,40);
>   foreach $line(@infile) {
>     chomp $line;
>     @key=split/;/,$line;
      ^^^^^^^^^^^^^^^^^^^^
since you are only using the first element, this may help gain a little more
speed (assuming you have more than one ';' in $line:
     ($key) = split /;/, $line, 2;
      
>     if ($uid eq @key[0]) {
                  ^
you probably meant $key[0], right?

>        print ($line,";",$oe,"\n");
>        print (OUTFILE  $line,";",$oe,"\n");
>        next LINE;
>     }
>   }
> }
>


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

Date: 29 Nov 1998 06:14:11 GMT
From: snowe@rain.org (Nick Halloway)
Subject: Handling the last line of a file differently (123)
Message-Id: <73qonj$47d$1@news.rain.org>

How can I tell if it's the last line of a file, when reading 
lines from it?  Thanks.




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

Date: 28 Nov 1998 20:52:57 PST
From: "The Bengal Group, Inc." <custservice@bengal-grp.com>
Subject: Re: How does one get an SSL?
Message-Id: <3660D3A4.F9D06003@bengal-grp.com>

Testy bunch this group... but I love'em anyway.  I too had this same
question a couple years ago and found the answer here. Payback time...

Most ISP's these days can help you set up an SSL site.  You don't
necessarily need Perl or any programming experience.  Many sites have
programs you can simply refer to or 'include' in your HTML. Hence, the
testy attitude of the purists here.

For example, you could create a form thusly which uses form processing
code (ususally Perl) provided by the ISP:

   <FORM METHOD=post
ACTION="http://www.mysite.com/cgi-bin/my_isps_form-processor.pl">

If the ISP provides a SSL server for your use you can make the same form
secure by simply pointing to the secure server:

   <FORM METHOD=post
ACTION="https://www.my_isps-secure-server.com/cgi-bin/my_isps_form-processor.pl">

So..   Start checking for an ISP that provides SSL server access.  BTW,
they should provide it free, not as an additional cost. You should be able
to find an ISP host for less than $30/mo that provides everything you'll
need.

I've been using Trident at  http://www.trident.org  without any problems
-- $24.95 mo.

Good Luck,

-- Al
http://www.bengal-grp.com
al@bengal-grp[nospam].com

Diane McManus wrote:

> Hi,
>
> From this post you can probably tell I'm a newbie here  -- along with
> the fact I don't spell that well..  :-)
>
> I have a credit card merchant account, but no SSL secure site to
> receive orders at.  I would like to set one up.
>
> Could anyone give me assistance by teelling me how to do this?  If you
> know how one would go about doing this, or can answer any of the
> questions below please reply.
>
> If one needs to get an SSL (for processing credit cards, etc) how do
> they get one?
>
> Are there any free SSL's?
>
> Are there places that let you use their SSL's?
>
> Do any of these let you use theirs for free?
>
> If not, what costs are involved in setting up one of these? (I ask as
> I shudder with fear it will be a fortune.)  :-)
>
> What would YOUrecomment?
>
> Thank You Very Kindly,
>
> -Diane
>
> PS:  I'd  "love you to death"  :-)   if when you post you could also
> cc a reply to
> Diane McManus <gback@teleport.com>








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

Date: Sun, 29 Nov 1998 04:00:02 GMT
From: imchat@ionet.net
Subject: html mail
Message-Id: <3660c596.222746372@news.ionet.net>

	Hi, I was wondering if their is a simple way to send html mail
from the server. I've been looking over the MIME:Lite package and it
doesn't want to install correctly on my server, or I'm doing something
wrong. My server doesn't recognize the .pl extension and mime lite
seems to look for it. 
	Anyway isn't there an interface to procmail which will do the
same thing? Anyone want to point me in the right direction?


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

Date: Sat, 28 Nov 1998 21:11:21 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: I have a question about Perl and CgI?
Message-Id: <comdog-ya02408000R2811982111210001@news.panix.com>

In article <36609D6E.CD9A7B4B@zerolimits.com>, doug@zerolimits.com posted:

> First off, cgi-bin is a folder.

it could be, but with the miracles of mod_rewrite, perl handlers,
and other server hacks, it might not exist at all, even though
it's in the address.

> You do need to run some type of server to use CGI,

not really.  Lincoln was pretty cagey about that.  it's an interface
that doesn't really care what's on either side of it. :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Sun, 29 Nov 1998 01:22:12 -0600
From: ken@forum.swarthmore.edu (Ken Williams)
Subject: Makefile.PL problem - "make install" doesn't install
Message-Id: <ken-2911980122120001@min-mn4-15.ix.netcom.com>

Hi,

I've had a few people tell me that with version 0.05 of my Apache::Filter
module (in CPAN), "make install" doesn't copy the module to the perl lib
directory.  I can't figure out why not - it works for me.  

Here's my Makefile.PL:
 WriteMakefile(
    'NAME'  => 'Apache::Filter',
    'VERSION_FROM' => 'Filter.pm', # finds $VERSION
    'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" },
 );

I'm also using a MANIFEST.SKIP file, here it is:
 ^MANIFEST\.
 ^Makefile$
 ^blib/

I think the MANIFEST.SKIP file may have something to do with the problem,
since I started using it in version 0.05.  But I can't figure out what's
going wrong.

I'll post relevant sections of my generated Makefile if someone will tell
me what sections are relevant.


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

Date: Sat, 28 Nov 1998 22:17:28 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Newbie: Search Engine
Message-Id: <oshq37.c3m.ln@flash.net>

Matthias Wiehl (hp-katalog@t-online.de) wrote:

: I desperately need help with a search script written in perl.  I want to
: use a script called "Search_Engine Script", available for download from
: http://www.extropia.com/, to make it possible for visitors to my site to
: search some of the files of my web site.

: How do I get this script installed?  


   That depends on the http server that you are using.

   The setup is basically the same whether your CGI program 
   is written in sh, or C, or Perl, or some other language.

   So you don't have a Perl question.

   So you should ask your question in another newsgroup.


: I thought it would be possible to
: run it on my local Win95 system, so I inserted the correct directories
: into the script files and a searching form into a temporary search.html
: file.  But now, if I enter anything into the form, my browser just
: displays the script itself, not the results!  If I run the perl compiler
: on the .pl files, (with Perl 5 correctly installed), nothing happens.


   I don't see any mention of installing a server there...


: What can I do to solve this problem?  


   Install a server.


: What file format do the script
: files have to be to run properly?


   Plain text will do (probably), but it depends on, you guessed it,
   your server.


: I would like to test the script on my local system before looking for a
: free CGI hosting service.  (My ISP doesn't provide me with CGI.)


   Change ISPs.


: Or are there even better solutions than this script?  Thanks in advance
: for your replies,


   Perl FAQ, part 9 suggests these resources for getting started
   with CGI:

-------------------
The useful FAQs and related documents are:

    CGI FAQ
        http://www.webthing.com/page.cgi/cgifaq

    Web FAQ
        http://www.boutell.com/faq/

    WWW Security FAQ
        http://www.w3.org/Security/Faq/

    HTTP Spec
        http://www.w3.org/pub/WWW/Protocols/HTTP/

    HTML Spec
        http://www.w3.org/TR/REC-html40/
        http://www.w3.org/pub/WWW/MarkUp/

    CGI Spec
        http://www.w3.org/CGI/

    CGI Security FAQ
        http://www.go2net.com/people/paulp/cgi-security/safe-cgi.txt
-------------------


   These newsgroups would be appropriate places to ask about 
   CGI programming:

      comp.infosystems.www.authoring.cgi

   or about servers for PoBs:

      comp.infosystems.www.servers.ms-windows


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


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

Date: Sun, 29 Nov 1998 15:41:41 +0800
From: William <msl1997@yahoo.com>
Subject: Please help me solve three CGI problem: Make Dir, Create file and frameset
Message-Id: <3660FAB5.3B8@yahoo.com>

Dear All,

Please help me solve following problems. I am a hypermart.net user.
The following script can't to work.I don't understand.
Sorry ! Some script can't to use <...> .So I use ...> to replace <...>.

1)Make directory:
#!/usr/local/bin/perl

$Make="/data1/hypermart.net/username/newdir";
mkdir("$Make", 0777);

Error statement:Premature end of script headers.

2)Create the new file

#!/usr/local/bin/perl


$file_name="data1/hypermart.net/username/test.txt";
open(newone, ">$file_name");
print newone " Hello,World\n";
close (newone);
The right is set to 777.
Error code is:Premature end of script headers.

The other one is:
 print "Content-type: text/html\n\n";
   open (newname, " >$going");
    print newname " HTML>\n";
    print newname " body>\n;
    print nename "hello";
    print newname "<\body>\n";
    print newname "<\html>\n";
    close(newname);
Error code is:Premature end of script headers.

3) Can't to build a frame
#!/usr/local/bin/perl
 print "Content-type: text/html\n\n";
 print "<html>\n";
 print "<head>\n";
 print "frameset rows="100%,*" border="0" frameborder="0"
framespacing="0">\n";
 print "frame src="http://www.xxx.com name=page">\n;
 print "/frameset>\n";
 print "/html>\n";

Error code: Many error are in here.

Please help me!!

Best Regards
William


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

Date: Sun, 29 Nov 1998 05:12:17 GMT
From: jstrike@execpc.com
Subject: Recursion
Message-Id: <73qkk9$gn5@newsops.execpc.com>

I have a subroutine that opens a file based on some parameters passed
in, when it finds a particular line in the file it calls itself and
opens another file.  The problem is that I'm somewhat new to Perl and
I cannot find out how to localize the filehandle so that when it
returns it picks up on the first file where it left off.

Here's a bit of the code.  Like I said, I'm new to Perl so forgive me
if the code is not as optimal as it could be.  I'm open to suggestions
though.

sub processfile {
    local ($bm, $bt, $sl) = @_;
    local (@items) = '';

    open (f, $bm) ||die "Can't find the file. ($bm - $!)";
    while (<f>) {
        ## check the line...
        if (/^@@@(.*)/) {
            @items = split(/,/,$1);
            if ( ($bt eq '*') || ($items[0] =~ /^$bt/) ) {
                &processfile (@items[1], @mtoken[$sl++], $sl++);
            }
        }
        else { 
        ...
        }
    }
close(f);
}

Thanks for any suggestions.
-Jeff


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

Date: 29 Nov 1998 03:06:32 -0500
From: bn711@freenet.carleton.ca (David Huggins)
Subject: Re: Recursion
Message-Id: <87vhjy6hyv.fsf@freenet.carleton.ca>

jstrike@execpc.com writes:
> Here's a bit of the code.  Like I said, I'm new to Perl so forgive me
> if the code is not as optimal as it could be.  I'm open to suggestions
> though.

First:

use FileHandle;

Next, as we like to say, "s/local/my/". (And that's a FAQ... Please
read 'man perlsub' as well...)

Then, replace this:

>     open (f, $bm) ||die "Can't find the file. ($bm - $!)";

With something like this:

  my $fh = new FileHandle $bm;
  die "Can't open $bm: $!" unless defined $fh;

You can use $fh like a normal filehandle, and it won't clobber itself
when you recurse, since it's a lexical variable that refers to an
anonymous glob.  (Whatever that means :-)

HTH.

-- 
perl -Mstrict -l0we'print&{sub{my(@q)=@_;&{sub{my($q)=@_;&$q($q,@q)}}(sub{my
($p,$q,@q,$r)=@_;$q&&(($q,$r)=@$q)&&qq@$\$q: ${\(ref$r?$/.eval q:local$\.=qq
; ;;&$p($p,\@$r)::$r)}$/@.(&$p($p,@q)||q$$);});}}([name=>"David Huggins-Dain".
q[es]],[work=>[[school=>"linguist"],[elsewhere=>"Linux hacker (for hire)"]]])'


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

Date: Sun, 29 Nov 1998 00:19:31 -0600
From: Mary E Tyler <dejahvu@erols.com>
Subject: Redirecting STDERR to STDOUT?
Message-Id: <3660E770.2D59@erols.com>

This is somewhat of a CGI problem also, but I am working in Perl, so
perl specific info would be helpful.

Basically, I do not have access to the error logs, or at least i cannot
get tech support at my web host to respond with their *location.*

Is there a way to redirect the error messages generated by die and such
to STDOUT? I thought I came across this once, but I can't remember
where!

If this has been discussed before, or there is a pertinent FAQ that I
have missed, would someone be kind enough to direct me a bit more
specifically?

Thanks,

Dejah
-- 
i trust i make myself obscure, i have need of obscurity now- robert bolt

a heated exchange of unread mail would be welcomed by all- christensen

Skating Fiction. Featuring the  highly acclaimed serial On The Edge!
http://www.DejahsPrivateIce.com



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

Date: Sun, 29 Nov 1998 02:32:47 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Redirecting STDERR to STDOUT?
Message-Id: <comdog-ya02408000R2911980232470001@news.panix.com>

In article <3660E770.2D59@erols.com>, dejahvu@erols.com posted:

> Basically, I do not have access to the error logs, or at least i cannot
> get tech support at my web host to respond with their *location.*

find the server configuration file, or use Find::File.  my guess is they 
don't know where they are either.  at least that's been my experience
with those sorts :)

> Is there a way to redirect the error messages generated by die and such
> to STDOUT? I thought I came across this once, but I can't remember
> where!

find the magic line in the script below.  it's also in the FAQ
somewhere.  of course, if you test with CGI.pm and you are hooked
up to a tty, you'll get the STDERR on your screen.
 
> If this has been discussed before, or there is a pertinent FAQ that I
> have missed, would someone be kind enough to direct me a bit more
> specifically?

you probably want to see the several ways that i presented in 
The Perl Journal #9.  in synopsis, see CGI::Carp for ready to
use functions.

here's what i've been doing in development scripts lately (with
a few bits snipped):

BEGIN 
   {
   my $old_W = $^W;
   
   $VERSION = '19981125.001';
   
   $^W = 0;
   
   $ENV{'PATH'} = '';

   $debug = 0;

   sub debug
      {
      $debug = 1;
      
      $| = 1;
      
      print "Content-type: text/plain\n\n";
      print "YOU ARE IN DEBUGGING MODE - thanks, the management\n";
      print "This is process $$\nReal user is $<\nEffective user is $>\n";
      print "This is VERSION $VERSION\n\n";
      
      open STDERR, ">&STDOUT";

      $^W = 1;
      }  
      
   debug if $debug or $ENV{'CGI_DEBUG'} eq '1';

   my $who = 'name_of_script';
   
   $^W = $old_W unless $debug > 0;
   }

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Sun, 29 Nov 1998 02:49:34 -0600
From: ken@forum.swarthmore.edu (Ken Williams)
Subject: Re: Redirecting STDERR to STDOUT?
Message-Id: <ken-2911980249340001@min-mn4-15.ix.netcom.com>

Hi Mary,

An easier solution might be to create your own error_log.  You can make a
new file wherever you want, and redirect all the STDERR to that file. 
I've had to do this before because of exactly your situation.

This code should do it:

open (STDERR, ">>/some/dir/error_log") or die $!;


I think some servers make you be more careful about how you open or close
STDERR, but my experience is with Apache, and the above should work fine
with it.




In article <3660E770.2D59@erols.com>, dejahvu@erols.com wrote:
>This is somewhat of a CGI problem also, but I am working in Perl, so
>perl specific info would be helpful.
>
>Basically, I do not have access to the error logs, or at least i cannot
>get tech support at my web host to respond with their *location.*
>
>Is there a way to redirect the error messages generated by die and such
>to STDOUT? I thought I came across this once, but I can't remember
>where!
>
>If this has been discussed before, or there is a pertinent FAQ that I
>have missed, would someone be kind enough to direct me a bit more
>specifically?
>
>Thanks,
>
>Dejah
>-- 
>i trust i make myself obscure, i have need of obscurity now- robert bolt
>
>a heated exchange of unread mail would be welcomed by all- christensen
>
>Skating Fiction. Featuring the  highly acclaimed serial On The Edge!
>http://www.DejahsPrivateIce.com


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

Date: Sun, 29 Nov 1998 08:34:32 +0100
From: Mats Westholm <mats@webhandel.nu>
Subject: Re: Rename on NT-server
Message-Id: <3660F906.1BEF65D0@webhandel.nu>

No, I don't understand! Is unlink a command that deletes files?

Mats

Matthew Bafford wrote:

> [Followups set]
>
> In article <365F4495.4B104ADB@webhandel.nu>, mats@webhandel.nu says...
> => Yes Steven. That's exactly my problem. On a UNIX system you can do that and the new file
> => replaces the old one. But it doesn't work on the NT server I'm working on now.
> =>
> => So how do one solve the problem? Delete the old file first? How?
>
> unlink
>
> =>
> [snip]
>
> HTH!
>
> --Matthew
> --
> # clp is no longer a valid newsgroup.  For a much better chance of
> # getting your question or comments noticed, please move your
> # discussions to either comp.lang.perl.moderated, or comp.lang.perl.misc.






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

Date: Sun, 29 Nov 1998 08:10:23 GMT
From: ehpoole@ingress.com (Ethan H. Poole)
Subject: Re: Rename on NT-server
Message-Id: <Pj782.671$rW5.1227@news3.ispnews.com>

unlink() is the command to delete a file.

What I don't understand is the statement that rename() does not work under 
NT.  I've written a good many Perl apps for NT which use the rename() 
function w/o difficulty, exactly what error message is generated when 
rename() fails?

[Posted and Emailed]  In article <3660F906.1BEF65D0@webhandel.nu>, 
mats@webhandel.nu says...
>
>No, I don't understand! Is unlink a command that deletes files?
>
>Mats
>
>Matthew Bafford wrote:
>
>> [Followups set]
>>
>> In article <365F4495.4B104ADB@webhandel.nu>, mats@webhandel.nu says...
>> => Yes Steven. That's exactly my problem. On a UNIX system you can do that 
and
> the new file
>> => replaces the old one. But it doesn't work on the NT server I'm working 
on n
>ow.
>> =>
>> => So how do one solve the problem? Delete the old file first? How?
>>
>> unlink

-- 
Ethan H. Poole              | Website Design and Hosting,
                            | CGI Programming (Perl & C)..
========Personal=========== | ============================
* ehpoole @ ingress . com * | --Interact2Day--
                            | http://www.interact2day.com/



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

Date: Sun, 29 Nov 1998 02:58:51 GMT
From: tcpeter@iname.com (Tim Peter)
Subject: Re: rename() on NT
Message-Id: <3660b6e7.4096483@news.primenet.com>

Here's a script I run on NT all the time to ensure lowercase filenames
in directiories.  I've never had a problem with it.  What version of
Perl are you running?  

#! /usr/bin/perl -w

# lcall.pl
# Renames all files in a directory to lowercase.  Very fast, very
efficient.

foreach $file(<*>) {
$lcfile = $file;
$lcfile =~ tr/A-Z/a-z/;
rename($file,$lcfile);
}


>On Sat, 28 Nov 1998 17:47:58 +0100 Mats Westholm <mats@webhandel.nu> wrote:
>> I have moved a fully functioning perl-program from UNIX to
>> NT and the
>> rename() funktion is not working. It gives the error-code
>> "File exists" (in
>> $!). I'm renaming the new file to an existing filename.
>> 
>> 1. Anyone knows how to handle rename() in NT?
>> 
>> 2. Where can I read about the file commands in NT? (for
>> example how to
>> delete a file, rename or move it)
>> 
>
>I think you'll find that because of the way that the NT filesystem works
>you will need to remove the existing file with the unlink() function.
>
>You might also find that there is a more Win32 specific way of doing this
>through some Win32::* module.
>
>/J\
>-- 
>Jonathan Stowe <jns@btinternet.com>
>Some of your questions answered:
><URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>

Never let your schooling get in the way of your education. - Mark Twain


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

Date: Sun, 29 Nov 1998 08:23:48 GMT
From: galbavy@stuttgart.nospam.de
Subject: Re: Running Perl scripts as NT services
Message-Id: <36610296.4418954@news.lf.net>

On Fri, 27 Nov 1998 09:30:52 +0000, Marquis de Carvdawg
<carvdawg@patriot.net> wrote:

>Could someone point me to a FAQ that tells me how
>to run my scripts as NT services?

There is a little program named ServiceIt which is said to be able to
make every program a NT service. It should be available from
www.basta.com (it was about 4 weeks ago). You don't need anything else
to use it.

Daniel


-----------------------
Daniel Galbavy
galbavy@stuttgart.nospam.de
-----------------------
nospam -> netsurf


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

Date: Sat, 28 Nov 1998 21:38:59 -0500
From: Bob Maillet <bmaillet@mindspring.com>
Subject: sysread question
Message-Id: <3660B3C3.571CAF3A@mindspring.com>

 I have a server script and would like to add a logging function where
the input of a user and output of a remote server get displayed on the
client side while simultaneously logging everything into a file.

I have experimented with various ways of writing this but still stuck.
currently the output line which prints the data is:

print while sysread($remote_server, $_, 50);

This works great but void of a logging function.  An example of what I
would like to do in Pseudo code is:

print while sysread($remote_server, $_, 50) | >FILE;

Is there a way to do this?

Bob


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

Date: Sat, 28 Nov 1998 19:06:43 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: sysread question
Message-Id: <MPG.10ca5a20c0c08849989931@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <3660B3C3.571CAF3A@mindspring.com> on Sat, 28 Nov 1998 
21:38:59 -0500, Bob Maillet <bmaillet@mindspring.com> says...
>  I have a server script and would like to add a logging function where
> the input of a user and output of a remote server get displayed on the
> client side while simultaneously logging everything into a file.
 ... 
> print while sysread($remote_server, $_, 50) | >FILE;

Retaining your minimalist one-liner no-brackets style, how about this:

  print(), print FILE while sysread($remote_server, $_, 50);

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


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

Date: Sat, 28 Nov 1998 21:07:20 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Writing to password protected directory
Message-Id: <comdog-ya02408000R2811982107200001@news.panix.com>

In article <73psvg$l6v$1@dragon.infopro.spb.su>, "Sergey Denisov" <sdenisov@chat.ru> posted:

> May be someone knows, how can I create and write to files in password
> protected directory on my server. And is it truly, that I can freely read
> from files in this protected directory without any password ?

which operating system are you using?

if i were wondering this, i would just try it.  if you can, you can :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Sat, 28 Nov 1998 22:00:35 -0600
From: igor@Algebra.Com (Igor)
Subject: Re: Y2K thoughts - from someone who works on it
Message-Id: <slrn761hn3.q6r.igor@manifold.algebra.com>

In misc.survivalism, Kool Breeze <koolb@hotmail.com> wrote:
* On 27 Nov 1998 22:18:35 GMT, Citizen Joe <no@spam.org> wrote:
* >I usually work as a Unix system administrator. However, my current job does
* >not involve the usual system support. It is still on the Unix platform and
* >it involves Y2K. I work for a major corporation and my exact role in this
* >is finding out how many software components there are and which ones are
* >Y2K compliant and which ones are not Y2K compliant. 
* *snip*
* 
* BBZZZZZT wrong...
* 
* Im a UNIX/C programmer/Net/Sys Admin for over 10 years. You say perl
* is compliant? Doesn't perl call the unix time(2) sytem call
* ultimately?

Unix time(2) system call returns number of SECONDS since 1/1/1970.

It has nothing to do with Y2K as it does not involve the year in any way.

* It's all other systems (embedded, non-unix, etc...), ie., majority
* that i'm worried about. You know the stuff that was written, stamped
* onto a chip, mass produced and now the source and/or the programmer is
* unobtainable.

Again, I suspect that most chips do not need a year.

* Anyway, even if the domino effect does not take place (small failures
* here and there lead to the big ones), we still have to deal with the
* inevitable hysteria that's going to happen. All this based on pure
* common human emotion. So that's the one i'm worried about.

True.
----------------------------------------------------------------------------
char*p="char*p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}

                \=/,         _-===-_-====-_-===-_-==========-_-====-_
                |  @___oo   (                                        )_
      /\  /\   / (___,,,}_--=                                          )
     ) /^\) ^\/ _)        =__       Anything is good and useful if    )
     )   /^\/   _)          (_                                        )
     )   _ /  / _)            (         it's made of chocolate.        )
 /\  )/\/ ||  | )_)            (_                                     )
<  >      |(,,) )__)             (   http://www.algebra.com/~ichudov   )
 ||      /    \)___)\             (_                                  _)
 | \____(      )___) )___           -==-_____-=====-_____-=====-___==
  \______(_______;;; __;;;



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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

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

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

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 4316
**************************************

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