[15841] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3254 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 5 14:05:49 2000

Date: Mon, 5 Jun 2000 11:05:23 -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: <960228322-v9-i3254@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 5 Jun 2000     Volume: 9 Number: 3254

Today's topics:
    Re: "system" and output flush (Peter Lowe)
    Re: "system" and output flush (M.J.T. Guy)
    Re: "system" and output flush (M.J.T. Guy)
    Re: 3 questions about perl (Villy Kruse)
    Re: Annoying message when opening files (Abigail)
    Re: Annoying message when opening files <stan@tempest.ocis.temple.edu>
        Array Help <lee.stoddart@wcl.fi>
    Re: Array Help (jason)
        Call file.htm and pass it a parameter?? <steve@gte.net>
    Re: Call file.htm and pass it a parameter?? <blah@nospam.com>
    Re: Call file.htm and pass it a parameter?? <tina@streetmail.com>
    Re: Call file.htm and pass it a parameter?? <red_orc@my-deja.com>
    Re: Can anyone help create this regular expresssion? <npecca@yahoo.com>
        Compiling 64-Bit perl under solaris 2.7 <cth@point4.com>
    Re: create Hash from two arrays? (Abigail)
        Daylight savings time? <campbell@coaps.fsu.edu>
    Re: Daylight savings time? (Abigail)
    Re: Daylight savings time? <red_orc@my-deja.com>
    Re: DBI and MS Access (Joe Broz)
    Re: delete file in Perl (Abigail)
        error messages w/perl on winnt <gorgano@altavista.com>
    Re: Execute perl code in a variable (Abigail)
    Re: execute/include script from another <jraff@home.com>
        File Locking with Perl for Win32 <bradjenn@nf.sympatico.ca>
    Re: File Locking with Perl for Win32 <randy@theoryx5.uwinnipeg.ca>
        Ftp using Net::FTP or LWP::Simple <shaid@yellowpages.co.il>
    Re: Ftp using Net::FTP or LWP::Simple <campbell@coaps.fsu.edu>
    Re: Getting time & date from DOS <mikula@students.uiuc.edu>
    Re: global chown ?? (Abigail)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 05 Jun 2000 14:25:22 GMT
From: pgl@random.noc.clara.net (Peter Lowe)
Subject: Re: "system" and output flush
Message-Id: <slrn8jne52.i14.pgl@random.noc.clara.net>

In article <h66kjs87p580h7jt6ibqdho6q1k6tlk0ld@4ax.com>, Abe Timmerman wrote:
>now why would you want to do that? Isn't one perl enough?
>just put:
>	require 'p1.pl';
>and if you want to pass (commandline) arguments to it (mind the
>curlies):
>	{
>	  local @ARGV = qw(arg1 arg2); #set arguments;
>	  require 'p1.pl';
>	}

you can also just put:

	do 'required.pl <arg>'

-- 
This is not the signature you are looking for. Move along now.


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

Date: 5 Jun 2000 17:31:04 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: "system" and output flush
Message-Id: <8hgo4o$s9g$1@pegasus.csx.cam.ac.uk>

Abe Timmerman  <abe@ztreet.demon.nl> wrote:
>On 3 Jun 2000 15:25:36 GMT, feng chen <fchen@fas.harvard.edu> wrote:
>> I have a perl script which uses several "system" calls
>> to run other perl script such as:
>> 	system "perl p1.pl ......";
>                ^^^^^^^^^^
>now why would you want to do that? Isn't one perl enough?
>just put:
>	require 'p1.pl';
>and if you want to pass (commandline) arguments to it (mind the
>curlies):
>	{
>	  local @ARGV = qw(arg1 arg2); #set arguments;
>	  require 'p1.pl';
>	}

Make that "require" a "do".    Else you'll be surprised the second time
you run it.


Mike Guy


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

Date: 5 Jun 2000 17:32:28 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: "system" and output flush
Message-Id: <8hgo7c$sao$1@pegasus.csx.cam.ac.uk>

In article <slrn8jne52.i14.pgl@random.noc.clara.net>,
Peter Lowe <pgl@clara.net> wrote:
>In article <h66kjs87p580h7jt6ibqdho6q1k6tlk0ld@4ax.com>, Abe Timmerman wrote:
>>now why would you want to do that? Isn't one perl enough?
>>just put:
>>	require 'p1.pl';
>>and if you want to pass (commandline) arguments to it (mind the
>>curlies):
>>	{
>>	  local @ARGV = qw(arg1 arg2); #set arguments;
>>	  require 'p1.pl';
>>	}
>
>you can also just put:
>
>	do 'required.pl <arg>'

You didn't test that, did you?

You can't put arguments on do.    At least, not like that.


Mike Guy


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

Date: 5 Jun 2000 14:26:37 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: 3 questions about perl
Message-Id: <slrn8jne4t.oeq.vek@pharmnl.ohout.pharmapartners.nl>

On Mon, 05 Jun 2000 12:21:55 GMT, Bart Lateur <bart.lateur@skynet.be> wrote:
>Villy Kruse wrote:
>
>[a nice example of last in a bare block inside a loop]
>
>Two remarks:
>
> * Your comment is not a Perl comment: change
>
>  /* last returnes to here */
>




>into
>
>  # last returnes to here
>

If course, syntax error in my example.  Done to many years on C code,
but that is not a valid excuse.


> * It would be nice if the value of $abc was printed out in the final
>statement:
>
>  print "returning, \$abc = $abc\n";
>
>(which prints '51' for $abc).
>


You are free to change to anything you like, for example adding some
print statements to confirm excatly where last jumped to.


-- 
Villy


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

Date: 5 Jun 2000 16:17:36 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Annoying message when opening files
Message-Id: <8hgjr0$2m9$1@news.panix.com>

On 3 Jun 2000 18:29:46 GMT, Stan Horwitz <stan@typhoon.ocis.temple.edu> wrote:
++ 
++ The message I am talking about looks like:
++ 
++ Value of <HANDLE> construct can be "0";
++ test with defined() at ./xxx line 65535.

Perhaps you should upgrade to a version of Perl that isn't 3 years old.
Get 5.005 or 5.6.0.



Abigail


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

Date: 5 Jun 2000 17:39:49 GMT
From: Stan Horwitz <stan@tempest.ocis.temple.edu>
Subject: Re: Annoying message when opening files
Message-Id: <8hgol5$rcr$1@cronkite.temple.edu>

Tony Curtis <tony_curtis32@yahoo.com> wrote:
>>> On 3 Jun 2000 18:29:46 GMT,
>>> Stan Horwitz <stan@typhoon.ocis.temple.edu> said:

>> Value of <HANDLE> construct can be "0"; test with
>> defined() at ./xxx line 65535.

>> So does anyone know what this error means and how I can
>> get rid of it? If so, please let me know.

> You're doing something like:

>     while ($line = <FILEHANDLE>) {
>       ...
>     }

> when you mean

>     while (defined ($line = <FILEHANDLE>)) {
>       ...
>     }

Thanks! This makes a lot of sense and it solved the problem. As someone
else pointed out, upgrading to the current version of Perl makes sense and
it is something I intend to do as soon as I get some more time. 



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

Date: Mon, 05 Jun 2000 14:24:46 GMT
From: "Lee" <lee.stoddart@wcl.fi>
Subject: Array Help
Message-Id: <OKO_4.224$S01.11589@read2.inet.fi>

I am trying to populate a drop down list on a HTML Page with a "LOCATION"
field from a database. I can get the field contents  easily enough and
populate the list, but if the field contents are the same, I want it to be
disregarded, the continue looping.

The only thing I could come up with was to read the field first put that
into the drop down menu (<option>), then push it onto an @array. Then when
the next field contants are read, it checks to see if it already in the
list, if not adds it to the drop down as an option, if it is, just
disregards it, so I don't get duplicate drop down items. This is when I hit
the problem, I have no idea how to string match within @arrays, only within
$strings, using the m// pattern matching.

After all that ranting: I would like to know if you can add new words onto
$strings (string concatenation) or if someone could tell me how to pattern
match within an @array.

Thanks in advance...

Lee




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

Date: Mon, 05 Jun 2000 14:59:38 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Array Help
Message-Id: <MPG.13a65d7e46648ab9989711@news>

Lee writes ..
>I am trying to populate a drop down list on a HTML Page with a "LOCATION"
>field from a database. I can get the field contents  easily enough and
>populate the list, but if the field contents are the same, I want it to be
>disregarded, the continue looping.

use a hash storing the values as keys .. then you can either test to see 
whether that hash element is defined before adding it in .. or just loop 
through an unconditionally adding elements to the hash - then populate 
the "drop down list" once you have all your values in your hash

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Mon, 05 Jun 2000 16:45:01 GMT
From: "SteveSingletary" <steve@gte.net>
Subject: Call file.htm and pass it a parameter??
Message-Id: <gOQ_4.304$Hs5.80101@dfiatx1-snr1.gtei.net>

I'm trying to pass a parameter from one page.htm to another page.htm.  I was
told I need to run a perl script (I'm on unix) in order to pass the
parameter.  Does anybody have the correct syntax for this??
Thanks ...

--

Steve




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

Date: Mon, 05 Jun 2000 18:49:23 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: Call file.htm and pass it a parameter??
Message-Id: <393BDA13.82048459@nospam.com>

Steve,

SteveSingletary wrote:
> I'm trying to pass a parameter from one page.htm to another 
> page.htm.  I was told I need to run a perl script (I'm on unix) 
> in order to pass the parameter.  Does anybody have the correct 
> syntax for this??

  Not so easy as it can seem.  If you do not know anything of PERL and
CGI, I suggest you to avoid a probable blood-bath reading some documents
or book about those arguments.


	Best regards,
		Marco


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

Date: 5 Jun 2000 16:52:17 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Call file.htm and pass it a parameter??
Message-Id: <8hgls0$31qvm$5@fu-berlin.de>

hi,

SteveSingletary <steve@gte.net> wrote:
> I'm trying to pass a parameter from one page.htm to another page.htm.  I was
> told I need to run a perl script (I'm on unix) in order to pass the
> parameter.  Does anybody have the correct syntax for this??

how can you pass parameters to HTML-pages?

give us a little more information

tina



-- 
http://www.tinita.de \  enter__| |__the___ _ _ ___
tina's moviedatabase  \     / _` / _ \/ _ \ '_(_-< of
search & add comments  \    \ _,_\ __/\ __/_| /__/ perception


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

Date: Mon, 05 Jun 2000 17:27:39 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Call file.htm and pass it a parameter??
Message-Id: <8hgntk$an4$1@nnrp1.deja.com>

In article <gOQ_4.304$Hs5.80101@dfiatx1-snr1.gtei.net>,
  "SteveSingletary" <steve@gte.net> wrote:
> I'm trying to pass a parameter from one page.htm to another page.htm.
I was
> told I need to run a perl script (I'm on unix) in order to pass the
> parameter.  Does anybody have the correct syntax for this??
> Thanks ...
>
> --

if you go to almost any script archive, you should be able to find
several examples of form-processing scripts.


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


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

Date: Mon, 5 Jun 2000 18:15:26 +0400
From: "HB" <npecca@yahoo.com>
Subject: Re: Can anyone help create this regular expresssion?
Message-Id: <393bbe0e@news.telekom.ru>

Michael Schlueter wrote...

>> - minimum of 2 :alpha characters, and maximum of 15 -> [:alpha]{2,15}
>> - the first character must be a letter, as must be the last
>> - in the middle, dashes, spaces, and apostrophes are allowed
>> - there can be no consecutive spaces, dashes or apostrophes

I have no ideas what ':alpha characters' are. But if they are
[0-9A-Za-z_] (i. e. \w), my code below does what you (==bRiAn) wanted.
And if they aren't, \w must be replaced with neccessary chars (e. g.
[0-9a-z] without '_')

$_ = $What_I_want_To_Check;

if ( /\A[a-z](\w|-(?!-)| (?! )|'(?!')){0,13}[a-z]\z/i )
     { OK() }
     else { oops() }

> I'd perform the matches one after the other
> instead of creating a giant regex-monster ;-)

So would I:

$_ = $What_I_want_To_Check;

if ( /\A[a-z][- '\w]{0,13}[a-z]\z/i   # your first 3 conditions
     and not /--|  |''/ )             # and the 4th
     { OK() }
     else { oops() }

because this second variant is mush clearer, I suppose.





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

Date: Mon, 5 Jun 2000 14:54:08 +0100
From: "Chris Henson" <cth@point4.com>
Subject: Compiling 64-Bit perl under solaris 2.7
Message-Id: <8hgbc7$kdt$1@starburst.uk.insnet.net>

I'm having a bit of trouble compiling 64-Bit perl under Solaris 2.7.

During the 'Configure'  I get to the 64-Bit options (use 64 Bit Integers
etc.) and get the following Error:

You may also choose to try maximal 64-bitness.  It means using as much
64-bitness as possible on the platform.  This in turn means even more
binary incompatibilities.  On the other hand, your platform may not
have any more 64-bitness available than what you already have chosen.

If this doesn't make any sense to you, just accept the default 'n'.
Try to use maximal 64-bit support, if available? [n] y
Your platform has some specific hints for 64-bit integers, using them...
Your platform has some specific hints for 64-bit builds, using them...
 ./Configure: ./UU/workshoplibpth.cbu: not found

As far as I can see, the file './UU/workshoplibpth.cbu' is in the correct
directory and contains the following information (which I assume is
correct):

case "$workshoplibpth_done" in
'')     case "$use64bitall" in
        "$define"|true|[yY]*)
            loclibpth="$loclibpth /usr/lib/sparcv9"
            if test -n "$workshoplibs"; then
                loclibpth=`echo $loclibpth | sed -e "s% $workshoplibs%%" `
                for lib in $workshoplibs; do
                    # Logically, it should be sparcv9.
                    # But the reality fights back, it's v9.
                    loclibpth="$loclibpth $lib/sparcv9 $lib/v9"
                done
            fi
            ;;
        *)  loclibpth="$loclibpth $workshoplibs"
            ;;
        esac
        workshoplibpth_done="$define"
        ;;
esac

I have chosen the default options up to this point (except the use of 64-Bit
integers).

Adding -xarch=v9 or -xarch=v9a to the compiler flags presents the same
problem (although just accepting the Maximal 64-Bitness has the same
effect).

Any ideas on why this is happening would be very useful.

Chris H

Chris Henson
Internet Application Developer
Point4 (nettec plc)
Forge House 66 High
Street Kingston-upon-Thames
KT1 1HN
Phone: +44 (0)20 8255 4004
Fax: +44 (0)20 8255 4044
E-Mail: cth@point4.com




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

Date: 5 Jun 2000 17:06:03 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: create Hash from two arrays?
Message-Id: <8hgmlr$2m9$7@news.panix.com>

On Sat, 03 Jun 2000 13:26:10 -0400, MC <mc@backwoods.org> wrote:
++ I need to create a hash from two arrays, one containing the keys, the other
++ containing the data.
++ 
++ I have the following code, but is there a simpler/faster way....
++ 
++ my (@keys, @data, %hash);
++ 
++ ... code which populates @keys and @data from a file ...
++ 
++ for ($f=0;$f<=$#keys;$f++) { $hash{$keys[$f]} = $data[$f] };
++ 
++ any suggestions anyone ?

    @hash {@keys} = @data;


Obnoxious 16 line signature deleted.


Abigail


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

Date: Mon, 05 Jun 2000 13:01:10 -0400
From: Stacey Campbell <campbell@coaps.fsu.edu>
Subject: Daylight savings time?
Message-Id: <393BDCD6.CF2DEE01@coaps.fsu.edu>

Hi,
I have a perl program that retrieves files from an FTP server by the
hour.  The files are names by the hour, so I get files according to what
time it is now.  The bi-annual time change is a problem, though.
Instead of changing my program twice a year, can anyone give me a
routine that will tell if it is EDT or EST?  The following only prints
out EDT about every two times I run it:

$out = "DST.txt";
system "date >$out &";

open (IN, "DST.txt");
while ($date = <IN>) {
   #Thu Jun  1 17:28:01 EDT 2000
   chomp $date;
#   print "$date \n";
   ($blah1, $blah2, $blah3, $blah4, $d, $blah5) = split /\s+/, $date;
}
close (IN);

if ($d eq "EST") {
 print "EST yay!\n";
 print "$d\n";  # THIS LINE ONLY PRINTS SOMETIMES
}

elsif ($d == "EDT") {
 print "EDT yay!\n";
 print "$d\n";  # THIS LINE ONLY PRINTS SOMETIMES
}


EXAMPLE OUTPUT FROM ABOVE:
> ./JD_test.pl
EDT yay!
> ./JD_test.pl
EDT yay!
> ./JD_test.pl
EDT yay!
EDT           <-------------Notice this
> ./JD_test.pl
EDT yay!



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

Date: 5 Jun 2000 17:44:54 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Daylight savings time?
Message-Id: <8hgoum$41m$2@news.panix.com>

On Mon, 05 Jun 2000 13:01:10 -0400,
Stacey Campbell <campbell@coaps.fsu.edu> wrote:
++ Hi,
++ I have a perl program that retrieves files from an FTP server by the
++ hour.  The files are names by the hour, so I get files according to what
++ time it is now.  The bi-annual time change is a problem, though.
++ Instead of changing my program twice a year, can anyone give me a
++ routine that will tell if it is EDT or EST?

    print +(localtime)[8];

++                                              The following only prints
++ out EDT about every two times I run it:
++ 
++ $out = "DST.txt";
++ system "date >$out &";
++ 
++ open (IN, "DST.txt");

You don't test for failure of the open, and more seriously, since you
are doing the date in the background, you don't know whether it has
finished writing the file or not.

++ while ($date = <IN>) {

while? How many lines do you expect in the file?

++    #Thu Jun  1 17:28:01 EDT 2000
++    chomp $date;
++ #   print "$date \n";
++    ($blah1, $blah2, $blah3, $blah4, $d, $blah5) = split /\s+/, $date;
++ }
++ close (IN);
++ 
++ if ($d eq "EST") {
++  print "EST yay!\n";
++  print "$d\n";  # THIS LINE ONLY PRINTS SOMETIMES
++ }
++ 
++ elsif ($d == "EDT") {

Well, $d is a string, that may, or may not begin with a number.
"EDT" in numerical context is 0. I guess you didn't use -w, did you?

++  print "EDT yay!\n";
++  print "$d\n";  # THIS LINE ONLY PRINTS SOMETIMES
++ }



Abigail


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

Date: Mon, 05 Jun 2000 17:49:38 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Daylight savings time?
Message-Id: <8hgp7b$bna$1@nnrp1.deja.com>

In article <393BDCD6.CF2DEE01@coaps.fsu.edu>,
  Stacey Campbell <campbell@coaps.fsu.edu> wrote:
> Hi,
> I have a perl program that retrieves files from an FTP server by the
> hour.  The files are names by the hour, so I get files according to
what
> time it is now.  The bi-annual time change is a problem, though.
> Instead of changing my program twice a year, can anyone give me a
> routine that will tell if it is EDT or EST?

you could check for first sunday in april and last sunday in october,
when the changes happen, unless your code runs where DST does not.

Daylight Saving Time, for the U.S. and its territories, is NOT observed
in Hawaii, American Samoa, Guam, Puerto Rico, the Virgin Islands, the
Eastern Time Zone portion of the State of Indiana, and the state of
Arizona (not the Navajo Indian Reservation, which DOES observe). Navajo
Nation participates in the Daylight Saving Time policy, due to its large
size and location in three states.)


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


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

Date: Mon, 05 Jun 2000 17:54:29 GMT
From: jb@yperite.demon.co.uk (Joe Broz)
Subject: Re: DBI and MS Access
Message-Id: <slrn8jnti8.94.jb@yperite.demon.co.uk>

On Sun, 04 Jun 2000 09:36:14 +0200, Karl-Heinz Brenzinger 
<Karl-Heinz.Brenzinger@t-online.de> wrote:
>Hallo.
>
>How can I use functions, which are defined within MS Access through the
>DBI package?
>
>I defined a function eg. calcsomething(a,b) within the DB and I like to
>use the result of this calulation in the
>where-clause of the SELECT. eg.
>
>SELECT tab.*  WHERE (calcsomething(tab.a, tab.b))
>
>This doesn't work. Can someone give me a hint?
>Do I have to define the function calcsomething() from Perl?
>

I know very little about Access but I think you'll need to install
DBD::ODBC in order to do this. You don't mention if you've installed
it or not. Check CPAN for it. This link [1] (which appears to be the
from the DBD::ODBC) says:

For Access use version "Access ODBC driver 3.40.2111 
27/03/96" or later."

http://theoryx5.uwinnipeg.ca/CPAN/data/DBD-ODBC/README.html

Tschuess
joe


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

Date: 5 Jun 2000 16:54:52 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: delete file in Perl
Message-Id: <8hgm0s$2m9$5@news.panix.com>

On Sat, 3 Jun 2000 10:30:11 +0800, JL <ltlau@yahoo.com> wrote:
++ Hi,
++ 
++ Can anyone please help me?
++ How to write a perl program which can delete files in a directory.  And I
++ only want to delete those files which is more than one day old(I mean the
++ last modify is more than 24hrs).


No use in using Perl:

    find . -mtime +1 | xargs rm


Abigail


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

Date: Mon, 05 Jun 2000 17:14:09 GMT
From: Jason Hurst <gorgano@altavista.com>
Subject: error messages w/perl on winnt
Message-Id: <8hgn4g$a52$1@nnrp1.deja.com>

Hello, i've been running ActivePerl-5.6.0.613 on windows nt server 4
w/sp 6.  Problem is i keep getting this dr. watson errors that come up
telling me that perl died. It says that it is creating a log entry
about it but nothing ever shows up in the error log.  I've tried using
perlis, which helps, however these things keep popping up when i run
something with perl.exe.  And when these scripts pop up some of my
scripts will stop working until i reboot the server.  I was just
wondering if anyone else has had this problem and if so, do you have
any idea how to fix it.  Thank you very much for any help you can
provide, i've been trying to figure this one out for a few weeks now..

-jason


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


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

Date: 5 Jun 2000 16:26:41 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Execute perl code in a variable
Message-Id: <8hgkc1$2m9$3@news.panix.com>

On Sat, 03 Jun 2000 19:29:00 +0200,
Ole Christian Eidheim <eidheim@hivolda.no> wrote:
++ I want to execute code that resides in a variable. The code is fetched
++ into the variable from a database. How do I execute this code and still
++ have access to the resources in my script(the script that runs the code
++ in the variable).

eval;

++ Another question:
++ In C you have #define statements. Is there a similiar data type in perl?

No, C does not have #define statements. And they aren't data types either.
#defines are directive for the C preprocessor.

The perlrun man page will tell you how to use the C preprocessor for your
Perl programs - although it's unclear why you would want to.



Abigail


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

Date: Mon, 05 Jun 2000 15:16:44 GMT
From: "jraff" <jraff@home.com>
Subject: Re: execute/include script from another
Message-Id: <wvP_4.112309$R4.666247@news1.rdc1.nj.home.com>

You need to get familiar with modules:
http://www.perl.com/pub/doc/manual/html/pod/perlmod.html
Does everything you're asking.
-----------------------------------------------------------------
"nils grimsmo" <dragon@online.no> wrote in message
news:393B99CC.76F3EC8F@online.no...
> how do i execute one perl script from another? i am building a web page,
> and found out how perl could make my life easier (making me type fewer
> characters). what i want is for '/dir/dir/jalla.cgi' to execute
> '/main.cgi', which will output the top and bottom of all the pages
> (which is the same).
>
> can i then use variables from 'jalla.cgi' in 'main.cgi'? let say i want
> to write a page hit counter to the file "counter_$dir1_$dir2_$page.dat".
> i don't know if this is correct syntax or at all possible. tell me
> better ways if you want to.
>
> how do i include a file, containing i.e. just variables? could i have
> the entire top of my web-pages as a variable in '/main.data', like
> "<html>\n<head>\n<title>$name_of_curr_page</title>\n", with
> $name_of_curr_page taken from '/dir/dir/jalla.cgi'?
>
> is it possible to search through the entire content of perldoc? can i in
> some way install it as html locally?
>
> what great book should i buy? i am a perl newbie, but have written som c
> and stuff. i plan to use perl for web mainly.
>
>
>
> nils grimsmo
> dragon@online.no




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

Date: Mon, 05 Jun 2000 17:16:26 GMT
From: "Brad Sheppard & Jennifer Kettle" <bradjenn@nf.sympatico.ca>
Subject: File Locking with Perl for Win32
Message-Id: <393bdfb7.0@209.128.1.3>

Hi,

Please respond to this message via my e-mail address: vo1xa@rac.ca

I was wondering if anyone can tell me how I can lock files using
Activestate's Perl for Win32 version 5.6.0.  I have a small guestbook script
set up and need to now how to lock the file for obvious reasons.  I have
noticed that 'flock()' and 'lockf()' are not available and I do not know
where or how to find a module that might contain similar commands to these.
I have found UNIX modules for these commands but cannot make them on my
machine (Windows 98 SE).

Also I was wondering if there is anyway to use mod_perl with Apache server
for Windows.  If so, where can I get it?

Thanks in advance,
Brad Sheppard




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

Date: 5 Jun 2000 18:00:50 GMT
From: Randy Kobes <randy@theoryx5.uwinnipeg.ca>
Subject: Re: File Locking with Perl for Win32
Message-Id: <8hgpsi$kl1$1@canopus.cc.umanitoba.ca>

In comp.lang.perl.misc, 
    Brad Sheppard & Jennifer Kettle <bradjenn@nf.sympatico.ca> wrote:

> Please respond to this message via my e-mail address: vo1xa@rac.ca

One of the great advantages of newsgroups is that others who
may have the same questions can see the posted answers. And still 
others who disagree with the posted answers can post corrections. 
More often than not this exchange is pretty productive ....

> I was wondering if anyone can tell me how I can lock files using
> Activestate's Perl for Win32 version 5.6.0.  I have a small guestbook script
> set up and need to now how to lock the file for obvious reasons.  I have
> noticed that 'flock()' and 'lockf()' are not available and I do not know
> where or how to find a module that might contain similar commands to these.
> I have found UNIX modules for these commands but cannot make them on my
> machine (Windows 98 SE).

Did you try the LockFile-Simple distribution, available at
http://www.perl.com/CPAN/authors/id/R/RA/RAM/? See, for example,
http://theoryx5.uwinnipeg.ca/CPAN/data/LockFile-Simple/Simple.html
for a description on its use.

> Also I was wondering if there is anyway to use mod_perl with Apache server
> for Windows.  If so, where can I get it?

You could either try building your own, if you have a C compiler,
or go to http://perl.apache.org/distributions.html and follow 
the links to the Win32 mod_perl binary distributions.

best regards,
randy kobes


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

Date: Mon, 05 Jun 2000 15:31:07 GMT
From: shai1234 <shaid@yellowpages.co.il>
Subject: Ftp using Net::FTP or LWP::Simple
Message-Id: <sjnhtruj5ri123@corp.supernews.com>

Hi all

I need to write a perl's script that ftp to a server and reads a dir and then
gets (download) all the *.txt files on the server into the local server.

I tried reading LWP and NET pods , but couldn't find any answer...

can someone help me please?

thanks

shai 

--
Posted via CNET Help.com
http://www.help.com/


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

Date: Mon, 05 Jun 2000 12:51:08 -0400
From: Stacey Campbell <campbell@coaps.fsu.edu>
Subject: Re: Ftp using Net::FTP or LWP::Simple
Message-Id: <393BDA7C.D481560C@coaps.fsu.edu>

Here is an example of  code I use.  I didn't write it all, though.  It shows the
creation and use of a log file, which might be a good idea to keep track of how
the file transfer went. Of course I left out passwords and specific directories.

-Stacey Campbell-

#!/usr/local/bin/perl

use Net::FTP;

sub logmsg {
  open(LOG,">> $log");
  print LOG "$0 $$: @_ at ", scalar localtime, "\n";
  print "$0 $$: @_ at ", scalar localtime, "\n";
  close LOG;
}

sub parse_dir {
  ($line) = (@_);
#Example of line: rw-r--r--   1 dataman  users      476174 Mar  6 17:16
qscat_ds21.txt
    ($mode, $links, $owner, $group, $size, @rest) = split / /, $line;
    $name = pop @rest;
    $mtime = join " ", @rest;
    $time = pop @rest;
    $day = pop @rest;
    $type = unpack "A", $mode;
    $type = "f" if $type eq "-";
    @thing = ($name, $type, $size, $mtime, $day, $mode);
    @thing;
}

# check to make sure we have a thingy to work with...
$u = umask 0002;

$ftp = Net::FTP->new("ftpsite.org");
$ftp->login("<password>");
$ftp->binary();

$ftp->cwd("<remote directory>");
    @files = ();
    @ls_files = grep /$file_hour\.txt$/, $ftp->ls('-l');
    @lines = ();

    foreach $entry (@ls_files) {
      my($name, $type, $size, $mtime, $day, $mode) = parse_dir($entry);
        if (($name && $name !~ /^\./) && ($day == $mday)) {
         push @files, $name;
#         logmsg("a file: $name");
      }
    }

#Get the latest files
    foreach $file (@files) {
      # we shall ignore everything but real files
      next unless($type eq 'f');

      $size = $ftp->size($file);
      if (-e $file) {
        $local_size=-s $file;
        if ($size == $local_size) {
          logmsg("'$file' is good; won't re-fetch.");
          next;
        } else {
          logmsg("'$file' is incomplete");
        }
      }

      logmsg("Retrieving $file - $size bytes");
#      logmsg("FTP: ", $ftp->pwd(), "; PWD: ", `pwd`);

      if ( !$ftp->get($file,$file) ) {
          logmsg("Could not get '$file', skipped: $!");
      }

      $lsize=-s "$file";
      if ($size == $lsize) {
        logmsg("Successfully downloaded '$file'");
      } else {
        logmsg("problem with $file: Size Mismatch (local $lsize != $size)");
      }

shai1234 wrote:

> Hi all
>
> I need to write a perl's script that ftp to a server and reads a dir and then
> gets (download) all the *.txt files on the server into the local server.
>
> I tried reading LWP and NET pods , but couldn't find any answer...
>
> can someone help me please?
>
> thanks
>
> shai
>
> --
> Posted via CNET Help.com
> http://www.help.com/



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

Date: Mon, 5 Jun 2000 09:56:06 -0500
From: Scott Mikula <mikula@students.uiuc.edu>
Subject: Re: Getting time & date from DOS
Message-Id: <Pine.GSO.4.10.10006050955170.28244-100000@ux13.cso.uiuc.edu>

Thanks for the help - I didn't know about those commands.  Still getting
the hang of this perl thing!

On 5 Jun 2000, Tina Mueller wrote:

> hi,
> 
> Scott Mikula <mikula@students.uiuc.edu> wrote:
> > I am trying to get the time and date within a perl script, on my Windows
> > machine.  I can use the "time" and "date" commands, which display the
> > information, but these commands also expect an input so the script freezes
> > until I hit enter.  Is there any way to access the time and date without
> > going through those DOS commands?
> 
> have you tried out the perl functions "time" and "localtime"?
> perldoc -f localtime
> 
> tina
> 
> -- 
> http://www.tinita.de \  enter__| |__the___ _ _ ___
> tina's moviedatabase  \     / _` / _ \/ _ \ '_(_-< of
> search & add comments  \    \ _,_\ __/\ __/_| /__/ perception
> 
> 



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

Date: 5 Jun 2000 16:22:45 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: global chown ??
Message-Id: <8hgk4l$2m9$2@news.panix.com>

On Sun, 04 Jun 2000 15:15:23 +0200, frank <frank@french-connexion.com> wrote:
++ I (linux newbie) am trying to write a script that chowns all the files
++ and directories belonging to "sam" in the current directory  to "joe" ?

No use for Perl here:

    find . -user sam | xargs chown joe


Abigail


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

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


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