[7455] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1080 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 25 18:17:58 1997

Date: Thu, 25 Sep 97 15:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 25 Sep 1997     Volume: 8 Number: 1080

Today's topics:
     Re: "exp1 ? exp2 : exp" same as " if (exp1) { exp2; } e <Jan.Krynicky@st.mff.cuni.cz>
     a2p (newbie question) samdie@ibm.net
     Can anonymous subroutines also be anonymous methods? (Mark Nielsen)
     Re: Can anonymous subroutines also be anonymous methods (Greg Bacon)
     CGI, Losing query parameters. HELP! <"George Torres<no.gtorres.spam"@nortel.com)>
     CGI, Losing query parameters. HELP! <"George Torres<no.gtorres.spam"@nortel.com)>
     CGI, Losing query parameters. HELP! <"George Torres<no.gtorres.spam"@nortel.com)>
     Re: CGI, Losing query parameters. HELP! (Mike Stok)
     Re: Date Algorithm needed <Alan_Poindexter@bmc.com>
     Re: Date Algorithm needed (Ed.Q.Bridges)
     Re: How does perl guess $( ? speed@racer.cartoon.spam.address
     How Filter work ! <abcunme@cc.dd>
     re: how to write HTML form data to a text file??? (Ed.Q.Bridges)
     Re: Is Perl Year2000 compliant? lvirden@cas.org
     mmap? (Stuart McDow)
     Net::FTP doesn't seem to work... <bbrown2@lindy.stanford.edu>
     NT Change Password Script? <les@sscl.uwo.ca>
     Re: perl find (?) (Mike Stok)
     Re: perl find (?) (Jeremy D. Zawodny)
     perl lib version vs. executable <taurus@frontiernet.net>
     Re: Perl's pointer speed@racer.cartoon.spam.address
     perl5.004_01 compilation errors on Solaris 2.4 (Ronald E. Fortin)
     Read AND WRITE dBASE files from Perl (David Grove)
     Searching a directory <ephillips@starhosting.com>
     Re: Searching a directory (Mike Stok)
     Tab Delimiter character -- Unix to Mac (Darren Hayes)
     Terminal Output <bkennedy@haverford.edu>
     Re: Terminal Output (Mike Stok)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 25 Sep 1997 22:54:13 -0700
From: Jan Krynicky <Jan.Krynicky@st.mff.cuni.cz>
To: "Rui S. Pedro" <rpedro@pga.pt>
Subject: Re: "exp1 ? exp2 : exp" same as " if (exp1) { exp2; } else { exp3; }"?
Message-Id: <342B4E05.287C@st.mff.cuni.cz>

Rui S. Pedro wrote:
> 
> I've started some perl programming two weeks ago and I cannot see what is
> causing this problem. I whould appreciate some help.
> 
> These two scripts get different outputs:
> 
> script1:
> 1 ? $true+=100 : $false+=100; print "$true\n";
> output:
> 200
> 
> script1:
> 1 ? $true+=100 : ($false+=100); print "$true\n";
> output:
> 100
> 
> I'm using version 5.002
> 
> Rui S. Pedro

OPERATOR PRIORITY

See perlop

The first is

(1 ? ($true+=100) : $false)+=100; print "$true\n";

I know it looks strange but it's true.

Also notice that the value of  $var+=5 is a lvalue,
the variable itself. 

$var=0;
($var+=5) +=5;

will left 10 in $var.

The same holds for ?: .

Jenda

Jenda


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

Date: Thu, 25 Sep 97 16:55:27 -0400
From: samdie@ibm.net
Subject: a2p (newbie question)
Message-Id: <342ada8d$1$fnzqvr$mr2ice@news-s01.ny.us.ibm.net>

I installed 5.004_01 under OS/2 last week. Everything seemed to go smoothly
and an example script from the camel book works fine. To get started, I wanted
to convert a bunch of my AWK scripts to Perl and experiment with them but I
don't get any output. I tried with a number of AWK scripts and in all cases,
after a second or so, I'm back at the command prompt; no error messages, no
new files in the directory, nothing to the screen.

As a specific example, I took a script that I would usually run by \awk\gawk32
-f reorg.awk < images.fmt and entered: \perl\emx\bin\a2p reorg.awk

If I mangle the name, I get a legitimate 'Awk script "ceorg.awk" doesn't seem
to exist.' error message, so I have to assume that a2p is normally
seeing/finding the real script.

Any help would be appreciated.

-- 
-----------------------------------------------------------
samdie@ibm.net
-----------------------------------------------------------



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

Date: 25 Sep 1997 15:49:37 -0400
From: men2@auto.med.ohio-state.edu (Mark Nielsen)
Subject: Can anonymous subroutines also be anonymous methods?
Message-Id: <60ef8h$oqi$1@auto.med.ohio-state.edu>

I currenty have a method executing like this

$Object -> Method ("$Variable");

With an anonymous subroutine, I can do something like this,
&{$ReferenceToSubroutine}; 

I would like ot be able to do the following 
$Object -> {$ReferenceToMethod} ("$Variable");
But I cannot. Can you use a reference to a method that is not anonymous?
If so, how? Can you use anonymous methods?  

The reason is, I would like to be able to make a reference be able to point
to whatever method I want to point it to.

I only just started to heavily use references and object oriented 
programming, so there is still a lot I have to learn! 

Mark
-- 
---------------------------------------------------------------------------
Mark Nielsen	men2@auto.med.ohio-state.edu or gytres+@osu.edu
Systems Specialist
The Ohio State University


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

Date: 25 Sep 1997 21:15:45 GMT
From: gbacon@adtran.com (Greg Bacon)
To: men2@auto.med.ohio-state.edu (Mark Nielsen)
Subject: Re: Can anonymous subroutines also be anonymous methods?
Message-Id: <60eka1$q6i$1@info.uah.edu>

[Posted and mailed]

In article <60ef8h$oqi$1@auto.med.ohio-state.edu>,
	men2@auto.med.ohio-state.edu (Mark Nielsen) writes:
: I would like ot be able to do the following 
: $Object -> {$ReferenceToMethod} ("$Variable");
: But I cannot.

Sure you can, you're just not using the right syntax.

    $Object->{$subref}->(@args);  # needs 5.004

: Can you use a reference to a method that is not anonymous?
: If so, how? Can you use anonymous methods?  

I parse "anonymous method" as an oxymoron.  The whole point of having
objects and methods is having a well defined protocol for performing
the operations you want to on a given object.  You can play funny games
like

    $meth = "name_of_a_real_method";
    $obj->$meth(@args);

but that's not an anonymous method.

: The reason is, I would like to be able to make a reference be able to point
: to whatever method I want to point it to.

You can use a "soft reference" as above.  I believe there's also a
patch that's come out of the depths of the Salt Mines that allows you
to incant something like

    $subref = \&Class::sub;
    $obj->$subref(@args);

That doesn't feel very OOly correct, though. :-)

: I only just started to heavily use references and object oriented 
: programming, so there is still a lot I have to learn! 

Keep with it!

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Thu, 25 Sep 1997 15:23:50 -0500
From: George Torres <"George Torres<no.gtorres.spam"@nortel.com)>
Subject: CGI, Losing query parameters. HELP!
Message-Id: <60eh6e$dt2@crchh327.rich.bnr.ca>

I have a problem with losing query parameters when performing a button
action.

The first thing I do is let the user select from two radio buttons which
are stored in the query. They click a button to continue.

The user then gets to choose some information from popup_menus according
to the previous radio button information that was chosen.
I can access the query parameters that were entered at the radio buttons
fine at this 
point since I can display it on the page. 

The problem is, I then have the user submit the new popup_menu
information by clicking
yet another action button but this causes me to lose the query
information input from 
the radio button.

Any help is greatly appreciated!

Thanks,
George


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

Date: Thu, 25 Sep 1997 15:30:39 -0500
From: George Torres <"George Torres<no.gtorres.spam"@nortel.com)>
Subject: CGI, Losing query parameters. HELP!
Message-Id: <60eher$e1n@crchh327.rich.bnr.ca>

I have a problem with losing query parameters when performing a button
action.

The first thing I do is let the user select from two radio buttons which
are stored in the query. They click a button to continue.

The user then gets to choose some information from popup_menus according
to the previous radio button information that was chosen.
I can access the query parameters that were entered at the radio buttons
fine at this 
point since I can display it on the page. 

The problem is, I then have the user submit the new popup_menu
information by clicking
yet another action button but this causes me to lose the query
information input from 
the radio button.

What the heck has happened to the data?!?!

Any help is greatly appreciated!

Thanks,
George


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

Date: Thu, 25 Sep 1997 15:34:05 -0500
From: George Torres <"George Torres<no.gtorres.spam"@nortel.com)>
Subject: CGI, Losing query parameters. HELP!
Message-Id: <60ehla$e4t@crchh327.rich.bnr.ca>

I have a problem with losing query parameters when performing a button
action.

The first thing I do is let the user select from two radio buttons which
are stored in the query. They click a button to continue.

The user then gets to choose some information from popup_menus according
to the previous radio button information that was chosen.
I can access the query parameters that were entered at the radio buttons
fine at this 
point since I can display it on the page. 

The problem is, I then have the user submit the new popup_menu
information by clicking
yet another action button but this causes me to lose the query
information input from 
the radio button.

What the heck has happened to the data?!?!

Any help is greatly appreciated!

Thanks,
George


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

Date: 25 Sep 1997 20:54:38 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: CGI, Losing query parameters. HELP!
Message-Id: <60ej2e$cjh@news-central.tiac.net>

When you're generating the page with the menus you can propagate the radio
button information as a hidden field, so when the menu form is submitted
you'll be able to retrieve it.

Hope this helps,

Mike


In article <60eher$e1n@crchh327.rich.bnr.ca>,
George Torres  <"George Torres<no.gtorres.spam"@nortel.com)> wrote:
>I have a problem with losing query parameters when performing a button
>action.
>
>The first thing I do is let the user select from two radio buttons which
>are stored in the query. They click a button to continue.
>
>The user then gets to choose some information from popup_menus according
>to the previous radio button information that was chosen.
>I can access the query parameters that were entered at the radio buttons
>fine at this 
>point since I can display it on the page. 
>
>The problem is, I then have the user submit the new popup_menu
>information by clicking
>yet another action button but this causes me to lose the query
>information input from 
>the radio button.
>
>What the heck has happened to the data?!?!
>
>Any help is greatly appreciated!
>
>Thanks,
>George


-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Thu, 25 Sep 1997 14:14:57 -0500
From: "A. Poindexter" <Alan_Poindexter@bmc.com>
To: "Ed.Q.Bridges" <eqbridges@cbs.com>
Subject: Re: Date Algorithm needed
Message-Id: <342AB831.6027DE83@bmc.com>

Ed.Q.Bridges wrote:
> 
> hi i've been struggling with this pblm for a few days now.  it seems
> simple, but has been an awfully gnarly task.
> 
> given GMT and a +/- integer offset from GMT and a +/- integer offset
> correction for DST, i need to be able to determine the current date
> for several different timezones around the world.
> 
> what i need is a function equivalent to localtime() that takes a
> parameter for a timezone and returns the localtime *at that timezone*
> (rather than the machine that the localtime function is running on).
> 
> i've explored a couple of different things:
> + running as a cron job hourly, using gmtime(), i obtain the number of
> hours since midnite, i then add this to the offset getting the
> localtime in hours.  i then check the resulting value: if it's equal
> to zero, and the offset is negative, it's a new day.  else if it's
> equal to 24, and the offset is positive, it's also a new day.
> The issue with this, though, is that i don't have a record of the
> actual date in the local timezone, to check whether or not it's
> already been updated (do i even need this???).
> 
> + (this is a speculative question) i'm working on Solaris 2.5, which
> has an environment variable TZ.  If i can reset this value to another
> timezone, then call localtime() will this return the value for that
> locale?
> 
> anybody have to deal with this sort of thing before?  it seems like
> such an obvious problem to contend with, and surely there must be a
> solution that i can be more confident in.
> 
> if possible please cc: your response to eqbridges@cbs.com

This looks like a good time to plug one of my favorite modules!

check out
Time::ParseDate

ParseDate is awesome, here are some of the things it can do:
        $seconds = parsedate("Mon Jan  2 04:24:27 1995");
        $seconds = parsedate("Tue Apr 4 00:22:12 PDT 1995");
        $seconds = parsedate("04.04.95 00:22", ZONE => PDT);
        $seconds = parsedate("122212 950404", ZONE => PDT, TIMEFIRST =>
1);
        $seconds = parsedate("+3 secs", NOW => 796978800);
        $seconds = parsedate("2 months", NOW => 796720932);
        $seconds = parsedate("last Tuesday");

I have the doc at my site:
http://nettown.com/perl/site_perl/Time/ParseDate.pm.html

You can get this at
ftp://ftp.sedl.org/pub/mirrors/CPAN/modules/by-module/Time/
get the latest Time-modules...

or check http://www.perl.com/CPAN-local/README.html for more CPAN info

There is also a Timezone module in this package, see the doc at
http://nettown.com/perl/site_perl/Time/Timezone.pm.html

Hope this does what you need.

> 
> many thanks
> --ed.bridges--
> eqbridges@cbs.com


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

Date: Thu, 25 Sep 1997 21:08:19 GMT
From: eqbridges@cbs.com (Ed.Q.Bridges)
Subject: Re: Date Algorithm needed
Message-Id: <342ad282.286644533@news.spry.com>





thanks for getting back to me so quickly.  

this looks useful, but it doesn't seem to convert from epoch time (in
ms) to an array of date values like the localtime function does.

basically i'm looking for somehting like this:

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time,tz);

which, as you can see, is identical to the perl library function
"localtime" except it takes an additional parameter for a timezone
offset.  the library function converts what ever time value passed to
the time of the machine on which the function is running.

will the module you describe do this stuff?

thanks
--ed--


______________________________ Reply Separator
_________________________________ Subject: Re: Date Algorithm needed
Author:  "A. Poindexter" <Alan_Poindexter@bmc.com> at Internet Date:
9/25/97 2:14 PM


On Thu, 25 Sep 1997 14:14:57 -0500, "A. Poindexter"
<Alan_Poindexter@bmc.com> wrote:

>Ed.Q.Bridges wrote:
>> 
>> hi i've been struggling with this pblm for a few days now.  it seems
>> simple, but has been an awfully gnarly task.
>> 
 .
 .
 .
>> anybody have to deal with this sort of thing before?  it seems like
>> such an obvious problem to contend with, and surely there must be a
>> solution that i can be more confident in.
>> 
>> if possible please cc: your response to eqbridges@cbs.com
>
>This looks like a good time to plug one of my favorite modules!
>
>check out
>Time::ParseDate
>
>ParseDate is awesome, here are some of the things it can do:
>        $seconds = parsedate("Mon Jan  2 04:24:27 1995");
>        $seconds = parsedate("Tue Apr 4 00:22:12 PDT 1995");
>        $seconds = parsedate("04.04.95 00:22", ZONE => PDT);
>        $seconds = parsedate("122212 950404", ZONE => PDT, TIMEFIRST =>
>1);
>        $seconds = parsedate("+3 secs", NOW => 796978800);
>        $seconds = parsedate("2 months", NOW => 796720932);
>        $seconds = parsedate("last Tuesday");
>
>I have the doc at my site:
>http://nettown.com/perl/site_perl/Time/ParseDate.pm.html
>
>You can get this at
>ftp://ftp.sedl.org/pub/mirrors/CPAN/modules/by-module/Time/
>get the latest Time-modules...
>
>or check http://www.perl.com/CPAN-local/README.html for more CPAN info
>
>There is also a Timezone module in this package, see the doc at
>http://nettown.com/perl/site_perl/Time/Timezone.pm.html
>
>Hope this does what you need.
>
>> 
>> many thanks
>> --ed.bridges--
>> eqbridges@cbs.com



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

Date: 25 Sep 1997 13:58:30 -0600
From: speed@racer.cartoon.spam.address
Subject: Re: How does perl guess $( ?
Message-Id: <yz2d8lxnp21.fsf@advtech.uswest.com>

### "Marek" == Marek Rouchal <Marek.Rouchal@-nospam-hl.siemens.de> writes:
Marek> 
Marek> I've browsed through the perl source code, but only found occurrences
Marek> of (set|get|end)grent. Can someone please give me a hint, which part of
Marek> the code fills $( with the groups the current user is member of? I have
Marek> the 5.004 sources. TIA for your time!
Marek> 

The getgid(1) and getroups(2) system calls are used for setting the
$REAL_GROUP_ID value.  That is, of course, it this is set in config.h.

-- 
  Bruce W. Hoylman (303/541-6557) -- bhoylma@advtech.USWest.COM ._ 0  
   -     __0    Speaking for myself...        /\/\    /\       /  //\.
-  - - _-\<,_   "Please saw my legs off".    /~/~~\/\/~~\     '  \>> |
 -  __(_)/_(_)_____________________________/\ /    \ \/\ \________\\ `_


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

Date: Thu, 25 Sep 1997 17:03:24 -0500
From: "abcunme" <abcunme@cc.dd>
Subject: How Filter work !
Message-Id: <60enl0$36c@news.cuny.edu>

 hi :
    I am new to perl , and I come across a script with "Filter" .
Can anyone give me an brift(a detail one will be even better) explaination.


thank you
Kin
E-mail : Kin@mec.cuny.edu





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

Date: Thu, 25 Sep 1997 21:20:44 GMT
From: eqbridges@cbs.com (Ed.Q.Bridges)
Subject: re: how to write HTML form data to a text file???
Message-Id: <342ad33a.286828477@news.spry.com>


this is a set of functions i wrote to do the same thing you're looking
at.  basically put these in a text file, declare an array of the names
in your html form, get a standard readparse routine that reads the
values into an array named %in.  

call &FormatRow with the array of names as a parameter,
then pass the results to &FileAppend, thusly:
if( (&FileAppend( $Filename, (&FormatRow(@NameList)) ) ) < 0 )
{
	print "Error appending to file;";
}

if you need the readparse routine, let me know and i'll forward it.

--ed--




sub FileAppend ###$INT = FileAppend( $FILENAME, $DATA );
{
    local($FILE,$DATA) = @_;
    open DATAFILE, ">>$FILE" or return -1;
    &Lock( DATAFILE );
    print DATAFILE $DATA;
    &UnLock( DATAFILE );
    close DATAFILE;
}
#@

sub FormatRow 
### $PIPE_DELIM_USER/FORM_INFO_ROW = &FormatRow(@NAMELIST);
{
### TAKES A LIST OF NAMES FOR FORM VALUES, AND PRINTS THE VALUES
### IN A PIPE DELIMITED STRING IN THE ORDER GIVEN IN THE NAMELIST
### FOLLOWED BY STANDARD USER INFO.
###
### DOES NOT VALIDATE THE DATA COMING IN FROM THE FORM!
### ACCEPTS UNDEFINED FIELDS WITH A WARNING

    local(@Names) = @_;
    local(%UserInfo,$out);

    %UserInfo = &GetUserStamp;
    $out = "";

    foreach(<@Names>)
    {
        warn "Undefined field for $_." unless defined( $in{$_} );
        $out .= $in{$_};
        $out .= "|";
    }

    $out .= $UserInfo{"CUR_TIME"};
    $out .= "|";
    $out .= $UserInfo{"HTTP_USER_AGENT"};
    $out .= "|";
    $out .= $UserInfo{"REMOTE_ADDR"};
    $out .= "|";
    $out .= $UserInfo{"REMOTE_HOST"};
    $out .= "|";
    $out .= $UserInfo{"TZ"};
    $out .= "\n";
    return $out;
}
#@


sub Lock ### Lock( FILEHANDLE );
{
    local($LOCK_EX) = 2;

    ### PLACE EXCLUSIVE LOCK ON FILE
    flock($_[0], $LOCK_EX);
    ### SEEK TO END OF FILE IN CASE SOMEONE
    ### APPENDED WHILE WAITING FOR LOCK
    seek($_[0],0,2);
}
#@

sub UnLock ### UnLock( FILEHANDLE );
{
    local($LOCAL_UN) = 8;

    flock($_[0],$LOCK_UN);
}
#@

sub GetUserStamp ### %USERSTAMP = GetUserStamp();
{
    local( %User );
    $User{"CUR_TIME"} = localtime();
    $User{"HTTP_USER_AGENT"} = $ENV{"HTTP_USER_AGENT"};
    $User{"REMOTE_ADDR"} = $ENV{"REMOTE_ADDR"};
    $User{"REMOTE_HOST"} = $ENV{"REMOTE_HOST"};
    $User{"TZ"} = $ENV{"TZ"};
    return %User;
}
#@




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

Date: 25 Sep 1997 19:29:02 GMT
From: lvirden@cas.org
Subject: Re: Is Perl Year2000 compliant?
Message-Id: <60ee1u$9o3$1@srv38s4u.cas.org>


According to Doug Seay  <seay@absyss.fr>:
:hint: "perldoc perlfaq4".  If you don't have a properly installed
:version of Perl, go to http://www.perl.com/ and look around a bit.


Is there a command parallel to perldoc perhaps called perlgrep someone
might have written which allows you to say

perlgrep 2000

which searches all the docs installed to find references to year 2000
for instance?
-- 
Larry W. Virden                 INET: lvirden@cas.org
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.


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

Date: 25 Sep 1997 21:07:27 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: mmap?
Message-Id: <60ejqf$83c@ns1.arlut.utexas.edu>


Pardon me if this is a FAQ.

Has anyone tried to play around with mmap(2) and get it working?  I
like to use it for reading files and also for poor man's IPC. It'd be
nice if there was a module for it.

Is there any reason *not* to do a mmap via the syscall function?

Thanks.

--
Stuart McDow                                      Applied Research Laboratories
smcdow@arlut.utexas.edu                       The University of Texas at Austin


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

Date: 25 Sep 1997 13:20:09 -0700
From: Bob Brown <bbrown2@lindy.stanford.edu>
Subject: Net::FTP doesn't seem to work...
Message-Id: <uulg1qt87t2.fsf@lindy.stanford.edu>



I'm writing a script to ftp files to my current file system from
several different file systems. It doesn't seem to be working and
there are no error reports.

I'm not especially familiar with using packages like Net:FTP, but
it seems like this should work.

If someone could point out the errors of my ways-- I'd appreciate it.



#!/usr/local/bin/perl

use Net::FTP;
use File::Basename;
use File::Path;
use File::Copy;

if (!open(FILELIST, "FileNameWithListofHostandFiles")){
    print "Unable to Open the file\n";
    exit;
}

while($ListOfFiles = <FILELIST>){

    next if $ListOfFiles =~ /^#.*/;
    chop($ListOfFiles);

    $ListOfFiles =~ s/\s\s*:/:/g;
    $ListOfFiles =~ s/:\s\s*$/:/g;

    ($host, $fullfile)= split(/:/, $ListOfFiles);

    ## We have Multiple Hosts so that's why the associative array
    unless (exists $ftp{$host}){
	$ftp{$host} = Net::FTP->new($host");
	$ftp{$host}->login("LoginName","LoginPassword");
	$ftp{$host}->type("binary");
	}

    ## Get the component parts of the file.
    ($file, $fullpath, $suffix) = fileparse($fullfile);

    $ftp{$host}->get($fullfile, "./$file");

}


I think each file should show up in the current directory. The program
runs but I have not output to tell me when an error happens and the
files simply are not in the directory.

I did ftp the files over by hand using the same name and password and
that seemed to work.

Any ideas?!

Thanks in Advance.

Bob

P.S. Maybe if someone has a sample program using the FTP module?!





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

Date: Thu, 25 Sep 1997 16:55:40 -0400
From: Les Flodrowski <les@sscl.uwo.ca>
Subject: NT Change Password Script?
Message-Id: <342ACFCC.5F9546ED@sscl.uwo.ca>

Does anyone know of a Perl CGI script that would allow NT users to
change their account password via a web form?
-- 
Les Flodrowski,<les@sscl.uwo.ca>    Social Science Computing Laboratory
Assistant Director                  University of Western Ontario
User & Information Systems          London,  Ontario,  Canada,  N6A 5C2
                                    Ph: 519 661-3595   Fx: 519 661-3231


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

Date: 25 Sep 1997 19:14:51 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: perl find (?)
Message-Id: <60ed7b$81e@news-central.tiac.net>

if you're running a reasonably modern perl then

  perldoc File::Find


should give you details of a useful module, if you're using an *old* perl
then there are libraries find.pl and finddepth.pl which should be in your
library directory and do much the same thing.  The docs start out:

NAME
     find - traverse a file tree

     finddepth - traverse a directory structure depth-first

SYNOPSIS
         use File::Find;
         find(\&wanted, '/foo','/bar');
         sub wanted { ... }

         use File::Find;
         finddepth(\&wanted, '/foo','/bar');
         sub wanted { ... }

DESCRIPTION
     The wanted() function does whatever verifications you want.
     $File::Find::dir contains the current directory name, and $_
     the current filename within that directory.
     $File::Find::name contains "$File::Find::dir/$_".  You are
     chdir()'d to $File::Find::dir when the function is called.
     The function may set $File::Find::prune to prune the tree.

     This library is primarily for the find2perl tool, which when
     fed,

         find2perl / -name .nfs\* -mtime +7 \
             -exec rm -f {} \; -o -fstype nfs -prune

     produces something like:

[...]

Hope this helps,

Mike


In article <342A9F5F.D9E90EB0@amoco.com>,
Andrew W. Robinson <awrobinson@amoco.com> wrote:
>Hi all,
>
>I have an application where I need to generate a list of 
>files with fully qualified paths. The files are scattered 
>through many subdirectories within the directory tree and 
>at varying levels. I know how to generate the list using 
>the UNIX find command:
>
>     find $startdir -name \*.RAS -print
>
>In my perl application, I actually used this find command to 
>generate the list:
>
>     open( FPIPE, "find $startdir -name \*.RAS -print |" );
>
>Is there a built-in perl way to accomplish this? I looked at 
>the glob function, but I could not find an example or guess 
>the syntax to make it work.
>
>Thanks!
>
>Andrew Robinson
>-- 
>Offshore Business Unit           email: awrobinson@amoco.com
>Amoco Corporation                      phone: (504) 586-6888
>New Orleans, LA                          fax: (504) 586-2637
>-----
>The events depicted herein are fictional. Any similarity to 
>persons living or dead is entirely...oops, wrong disclaimer


-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Thu, 25 Sep 1997 19:39:16 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: perl find (?)
Message-Id: <342abdc8.87548598@igate.hst.moc.com>

[cc'd automagically to original author]

On Thu, 25 Sep 1997 12:29:03 -0500, "Andrew W. Robinson"
<awrobinson@amoco.com> wrote:

>Hi all,
>
>I have an application where I need to generate a list of 
>files with fully qualified paths. The files are scattered 
>through many subdirectories within the directory tree and 
>at varying levels. I know how to generate the list using 
>the UNIX find command:
>
>     find $startdir -name \*.RAS -print
>
>In my perl application, I actually used this find command to 
>generate the list:
>
>     open( FPIPE, "find $startdir -name \*.RAS -print |" );
>
>Is there a built-in perl way to accomplish this? I looked at 
>the glob function, but I could not find an example or guess 
>the syntax to make it work.

File::Find on CPAN.

This comes up several times a week. *sigh*

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: 25 Sep 1997 21:19:13 GMT
From: "Anthony R. Whyte" <taurus@frontiernet.net>
Subject: perl lib version vs. executable
Message-Id: <342AD9CA.1F4A8AD5@frontiernet.net>

I  built the latest perl into  a local area on my system
(-Dprefix=/home/me) 
When I invoke perl it says perl library version (5.001) does not match
executable version (5.004). How does one make perl look in
"/home/ME/lib" 
instead of /usr/local/lib for example.  I tried tweeking $PERL5LIB but
that
doesnt seem to do it. 

Thanks.


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

Date: 25 Sep 1997 13:51:16 -0600
From: speed@racer.cartoon.spam.address
Subject: Re: Perl's pointer
Message-Id: <yz2en6dnpe3.fsf@advtech.uswest.com>

### "Sijun" == Sijun Zeng <sijun@nortel.ca> writes:
Sijun> 
Sijun> Hi,
Sijun> Is there any "pointer" in Perl. Like
Sijun> 
Sijun> 	$a= $b;
Sijun> 	$b=1;
Sijun> 	print "$a";
Sijun> 

$a=\$b;
$b=1;
print "$$a";

This is an example of references.  Check out perlref and co.

Peace.

-- 
  Bruce W. Hoylman (303/541-6557) -- bhoylma@advtech.USWest.COM ._ 0  
   -     __0    Speaking for myself...        /\/\    /\       /  //\.
-  - - _-\<,_   "Please saw my legs off".    /~/~~\/\/~~\     '  \>> |
 -  __(_)/_(_)_____________________________/\ /    \ \/\ \________\\ `_


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

Date: Thu, 25 Sep 1997 20:45:58 GMT
From: ref@mesasys.com (Ronald E. Fortin)
Subject: perl5.004_01 compilation errors on Solaris 2.4
Message-Id: <60eihg$1ve$1@hal.brainiac.com>

I'm trying to compile perl5.004_01 on Solaris 2.4 using all the
defaults and am getting problems with binding Fnctl.

Here's the bottom of the output.  Any ideas?

Perl_stack_base                     0xa80       Fcntl.o
Perl_stack_sp                       0xa84       Fcntl.o
Perl_stack_sp                       0xa8c       Fcntl.o
ld: fatal: relocations remain against allocatable but non-writable sections
*** Error code 1
make: Fatal error: Command failed for target `../../lib/auto/Fcntl/Fcntl.so'
Current working directory 
/sos/web/tools/Languages/perl/src/perl5.004_01/ext/Fcl
*** Error code 1
make: Fatal error: Command failed for target `lib/auto/Fcntl/Fcntl.so'




---
Ronald E. Fortin
Senior Engineer
ref@mesasys.com
Mesa Systems Guild, Inc.
60 Quaker Lane
Warwick, RI 02886
401-828-8500
www.mesasys.com


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

Date: Thu, 25 Sep 1997 21:18:01 GMT
From: pete@dave-world.net (David Grove)
Subject: Read AND WRITE dBASE files from Perl
Message-Id: <342ad4c1.10581998@news.dave-world.net>

Does anyone know of a module, or whatever, or any way whatsover, to
read AND WRITE dBASE files from Perl. Xbase.pm won't write.

I'm using Perl 5.004 on Windows 95 B.


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

Date: Wed, 24 Sep 1997 15:50:47 -0700
From: Eric Phillips <ephillips@starhosting.com>
Subject: Searching a directory
Message-Id: <34299946.F9E8395A@starhosting.com>

Could someone please tell me how to search using Perl?  I am fairly new
at this, but I do know some of the basics of Perl.  Please tell me by
E-mailing me at e.phillips@mindspring.com. Thanks!


--
Eric Phillips
e.phillips@mindspring.com


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

Date: 25 Sep 1997 19:52:07 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Searching a directory
Message-Id: <60efd7$9ea@news-central.tiac.net>

In article <34299946.F9E8395A@starhosting.com>,
Eric Phillips  <ephillips@starhosting.com> wrote:
>Could someone please tell me how to search using Perl?  I am fairly new
>at this, but I do know some of the basics of Perl.  Please tell me by
>E-mailing me at e.phillips@mindspring.com. Thanks!

You can use opendir, readdir and closedir to open, read entries from and
close a directory.  They are covered the in perlfunc man page and any good
book on perl.  If you're using perl 5.xxx you can use the DirHandle module
whose documentation says

NAME
       DirHandle - supply object methods for directory handles

SYNOPSIS
           use DirHandle;
           $d = new DirHandle ".";
           if (defined $d) {
               while (defined($_ = $d->read)) { something($_); }
               $d->rewind;
               while (defined($_ = $d->read)) { something_else($_); }
               undef $d;
           }


DESCRIPTION
       The DirHandle method provide an alternative interface to
       the opendir(), closedir(), readdir(), and rewinddir()
       functions.

       The only objective benefit to using DirHandle is that it
       avoids namespace pollution by creating globs to hold
       directory handles.

Note that these only give youthe directory entries, so if you are trying
to scan directories other than the working directory you need to remember
to prepend some path information to the entry.  The reason for using
defined in the test to see if you've finished is that a directory entry of
'0' is quite legal but is considered false by perl.

Hope this helps,

Mike
 

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Thu, 25 Sep 1997 21:08:37 GMT
From: darrenh@efn.org (Darren Hayes)
Subject: Tab Delimiter character -- Unix to Mac
Message-Id: <342cd2cb.40681936@news.efn.org>

Hey there again,

I have a script which takes info from an html form and writes to a 
database record. The following portion of the script pulls the values 
from the associative array, replaces newline markers with ~nl~, glues 
the values together in a list with separating delimiter characters 
between each value, and chops off the last delimiter at the end 
of the record.

$database_delimiter="\^t";

if (-w $location_of_database)
  {
  foreach $variable (@form_variables)
    {
    $form_data{$variable} =~s/\n/~nl~/g;
    $database_row .=*$form_data{$variable}$database_delimiter";
    }
    chop $database_row;


The CGI script is being run on SunOS and then the resulting database 
textfile is downloaded to a Mac and appended to a Macintosh 
FileMakerPro database. Unfortunately (I am told) FMPro for the Mac 
supports Tab or comma delimiters only. Commas are out (as users 
need to enter many commas in the large text fields). So I need 
to use the tab character as the delimiter. However \t as the Unix Tab 
character is not converting correctly to the tab character for the 
Mac.

Is there a special ASCII Escape or [ESC]## character or some 
other character which I can use to emulate a Tab delimiter and which 
will also be identified as a delimiter in Filemaker Pro for the 
Mac. Is there such a thing as a universal TAB character?

Thanks for any ideas.
Please email if you can as my news service has been flaky of late.

Darren
darrenh@efn.org



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

Date: Thu, 25 Sep 1997 15:36:03 -0400
From: Ben Kennedy <bkennedy@haverford.edu>
Subject: Terminal Output
Message-Id: <342ABD23.EA939D84@haverford.edu>

Is there a way I can have my output to the terminal go to the second or
third to last line on the screen, keeping the last line availiable for
input?  I want incoming text to start at the top of the screen and
continue downwards until the next to bottom line, and then start
scrolling.

I checked the llama to no avail -- it doesn't seem to be able to be done
with formats.

Thanks!

Ben Kennedy
bkennedy@haverford.edu


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

Date: 25 Sep 1997 20:01:39 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Terminal Output
Message-Id: <60efv3$9vp@news-central.tiac.net>

Have you looked at the Curses module which can be found in the

  CPAN/modules/by-category/08_User_Interfaces/Curses

directory at any CPAN site?  You can get to the comprehensive perl archive
network (CPAN) via http://www.perl.com/CPAN/ or bt ftp to ftp.funet.fi
under /pub/languages/perl/CPAN

Hope this helps,

Mike

In article <342ABD23.EA939D84@haverford.edu>,
Ben Kennedy  <bkennedy@haverford.edu> wrote:
>Is there a way I can have my output to the terminal go to the second or
>third to last line on the screen, keeping the last line availiable for
>input?  I want incoming text to start at the top of the screen and
>continue downwards until the next to bottom line, and then start
>scrolling.
>
>I checked the llama to no avail -- it doesn't seem to be able to be done
>with formats.
>
>Thanks!
>
>Ben Kennedy
>bkennedy@haverford.edu


-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". 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 1080
**************************************

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