[17546] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4966 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 25 18:05:36 2000

Date: Sat, 25 Nov 2000 15:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <975193508-v9-i4966@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 25 Nov 2000     Volume: 9 Number: 4966

Today's topics:
        .htaccess automated password authentication scheme <mark-lists@webstylists.com>
    Re: .htaccess automated password authentication scheme (Randal L. Schwartz)
    Re: [Perl] Finding a file <jeffp@crusoe.net>
    Re: [Perl] Finding a file (Tad McClellan)
    Re: [Perl] Finding a file <perl@dotexpress.com>
    Re: [Perl] Finding a file <perl@dotexpress.com>
        Bus error on solaris <cris@dsnet.net>
        Can't install modules in ActiveStates v5.6.0 for Win32 <graham@letsgouk.com>
        Here is execute cmd  perl4 - perl5 <van.Ginhoven@Telia.com>
        NEWBIE- Help me retrieve and incorporate Date-Calc modu <clarityassoc@earthlink.net>
    Re: NEWBIE- Help me retrieve and incorporate Date-Calc  <jeff@vpservices.com>
    Re: NEWBIE- Help me retrieve and incorporate Date-Calc  <carvdawg@patriot.net>
    Re: perl for win 32 setup question <johngros@Spam.bigpond.net.au>
    Re: perl for win 32 setup question (Grimpoteuthis)
    Re: perl for win 32 setup question (Grimpoteuthis)
    Re: Perl-Expert need (read) <bwalton@rochester.rr.com>
    Re: Regex question about \x$1 <martinheinsdorf@codesign.net>
    Re: Regex question about \x$1 (Tad McClellan)
    Re: Simple Question :) (Energy)
        TK for Win32? <angenent@kabelfoon.nl>
    Re: TK for Win32? <johngros@Spam.bigpond.net.au>
    Re: TK for Win32? <bwalton@rochester.rr.com>
        Using Net::FTP to print a directory (Earl Mardukas)
    Re: Using Net::FTP to print a directory <tony_curtis32@yahoo.com>
    Re: Using Net::FTP to print a directory (Earl Mardukas)
    Re: Using Net::FTP to print a directory <tony_curtis32@yahoo.com>
        whats wrong with this one ? <pilsl@goldfisch.atat.at>
    Re: whats wrong with this one ? <bart.lateur@skynet.be>
    Re: whats wrong with this one ? (Martien Verbruggen)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 25 Nov 2000 10:31:18 -0800
From: Mark Thompson <mark-lists@webstylists.com>
Subject: .htaccess automated password authentication scheme
Message-Id: <ga102tc1cqg3aqcsbfj8re8t469ebp2l96@4ax.com>

Hi,

I'm being asked to write a scheme in Perl that will do the following
basic tasks:

1) Ask for basic information from a form.
2) Create a random but unique username and password (or maybe accept a
username from the user but assign the password randomly, the main
thing is that we need valid e-mail addresses.)
3) Add this username and password to .htaccess file
4) Send username and password to user submitting form via e-mail
5) Log information to a data file

Not surprisingly I found what appeared to be a program that does this
called Locked Area Pro (supposedly available at
<http://www.lockedarea.com/>) but it only seems to be available if you
sign up for their members club and the interface for getting a
membership appears to be down right now.

What I'm wondering is if anyone else knows of a program that does this
that's already complete (our budget for this is about $30-$50).  I've
already written basic programs to do all of the requirements as
separate programs so I figure I can crank out what's necessary in a
few hours but figure I'd rather buy a $50 program than create the
program myself.  

Thanks,

Mark


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

Date: 25 Nov 2000 10:58:17 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: .htaccess automated password authentication scheme
Message-Id: <m17l5rri9i.fsf@halfdome.holdit.com>

>>>>> "Mark" == Mark Thompson <mark-lists@webstylists.com> writes:

Mark> 1) Ask for basic information from a form.
Mark> 2) Create a random but unique username and password (or maybe accept a
Mark> username from the user but assign the password randomly, the main
Mark> thing is that we need valid e-mail addresses.)
Mark> 3) Add this username and password to .htaccess file
Mark> 4) Send username and password to user submitting form via e-mail
Mark> 5) Log information to a data file

<http://www.stonehenge.com/merlyn/WebTechniques/col49.html> and
<http://www.stonehenge.com/merlyn/WebTechniques/col50.html>

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Sat, 25 Nov 2000 11:07:32 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: [Perl] Finding a file
Message-Id: <Pine.GSO.4.21.0011251101170.714-100000@crusoe.crusoe.net>

On Nov 25, Tad McClellan said:

>Perhaps you are looking for "Stages of a Perl Programmer":
>
>   http://prometheus.frii.com/~gnat/yapc/2000-stages/
>
>
>Which incorporates Tom Christiansen's "Seven Levels of Perl Mastery":
>
>   http://larc.ee.nthu.edu.tw/~cfwu/perl/japh.txt

And then there's my "Seven Stages of Regex Users":

  http://www.perlmonks.org/index.pl?node_id=42330

-- 
Jeff "japhy" Pinyan     japhy@pobox.com    http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource  (my id:  PINYAN)       http://search.cpan.org/
PerlMonks - An Online Perl Community          http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc.   http://www.perlarchive.com/





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

Date: Sat, 25 Nov 2000 10:24:20 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: [Perl] Finding a file
Message-Id: <slrn91vmd4.3hc.tadmc@magna.metronet.com>

Jeff Pinyan <jeffp@crusoe.net> wrote:

>And then there's my "Seven Stages of Regex Users":
>
>  http://www.perlmonks.org/index.pl?node_id=42330


"Novice" seems to be missing one:

   mistakes = for =~

ie.   $str = /foo/   rather than   $str =~ /foo/


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


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

Date: 25 Nov 2000 16:24:58 GMT
From: "TommyAu@497179" <perl@dotexpress.com>
Subject: Re: [Perl] Finding a file
Message-Id: <8vop4q$81l$1@imsp026.netvigator.com>

>Tom Christiansen's "Seven Levels of Perl Mastery":
>
>   http://larc.ee.nthu.edu.tw/~cfwu/perl/japh.txt

Yes, it is the file that i am finding!
Thanks!


--


----------------------------------------
Sender IP : 203.76.132.93
Sender Host : 

Posted by newsgroup Xplorer : http://connect.to/newsgroup | http://homepage.hkpeoples.net/news


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

Date: 25 Nov 2000 16:29:03 GMT
From: "TommyAu@497179" <perl@dotexpress.com>
Subject: Re: [Perl] Finding a file
Message-Id: <8vopcf$8rj$1@imsp026.netvigator.com>

Thanks!


----------------------------------------
Sender IP : 203.76.132.93
Sender Host : 

Posted by newsgroup Xplorer : http://connect.to/newsgroup | http://homepage.hkpeoples.net/news


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

Date: Sat, 25 Nov 2000 17:05:56 -0500
From: "Cris Daniluk" <cris@dsnet.net>
Subject: Bus error on solaris
Message-Id: <3a20373d_2@corp.newsfeeds.com>

Running perl 5.6.0 using DBI 1.14 and DBD-Interbase 0.21.1. Machine is an
UltraSparc running Solaris 7/64bit and gcc2.95.2 (32bit of course)

For some strange reason when I try and run a script that calls DBI->connect,
Perl immediately exits with a "Bus error". No core is dumped and no other
warnings such as syntax warnings are provided. Other DBI drivers such as
MySQL do not cause this behavior. I was previously running perl 5.005_3 but
upgraded on the suggestion that it may help. Same code works fine on a
machine with identical versions running Linux. Removing the connect line
causes the script to "work". I assume the problem lies somewhere in the
instantiation of the handler as opposed to the function itself.

Thanks in advance for any suggestions/help anyone can provide

Cris Daniluk




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


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

Date: Sat, 25 Nov 2000 19:29:53 +0000
From: Graham Stow <graham@letsgouk.com>
Subject: Can't install modules in ActiveStates v5.6.0 for Win32
Message-Id: <4mNkZAAxMBI6EwFd@letsgouk.com>

When trying to install a module and running 'Makefile.pl', I get a 'Bad
command or file name' 'Unable to find a perl 5 (by these names:
C\Perl\bin\Perl.exe miniperl perl perl5 perl5.6.0, in these dirs:
C:\WINDOWS\COMMAND C:\PERL\BIN C:\Perl\bin)

I'm running ActiveState's perl v5.6.0 for Win32-x86, Binary build 616,
installed in C:\Perl

Anyone any ideas?
-- 
Graham Stow


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

Date: Sat, 25 Nov 2000 20:40:59 GMT
From: "danfan" <van.Ginhoven@Telia.com>
Subject: Here is execute cmd  perl4 - perl5
Message-Id: <vtVT5.399$O%.77010@newsc.telia.net>

Hi!

The  code below works OK in perl 4 but  it won´t  compile in perl 5.
".<< unexpected"

Is there an alternative syntax or is it just superseeded by  perlipc

Snippet:
> (@response)=<<`ENDCMD`;
> mq001 -v <<ENDCMD
> myuserid
> mypassword
> get job_status
> get schema_status
> end
> ENDCMD

/dg




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

Date: Sat, 25 Nov 2000 17:25:55 GMT
From: "Alan Mailer" <clarityassoc@earthlink.net>
Subject: NEWBIE- Help me retrieve and incorporate Date-Calc module???
Message-Id: <DCST5.2533$nh5.244103@newsread1.prod.itd.earthlink.net>

Could someone talk a major Perl newbie through the steps of retrieving the
Date::Calc module and then successfully incorporating it into my Win 98 (not
NT) environment.

I've begun working with Perl and it seems as though I may have to add my
first module (because, as far as I can tell, Date:Calc is NOT part of the
original package).  Anyway, nothing I'm doing seems to successfully
accomplish what I'm trying to do.  Frankly I think the instructions
regarding this in various books and websites is not designed for the novice
who is attempting to do this the first time.

I've tried prompting Perl (or Cpan) to take the steps itself (using
perl -MCPAN -e "shell"), but I always get a bunch of errors during the
process and the process eventually fails.

I've also tried downloading and unzipping the file myself.  After this I
tried to follow the Install.txt instructions, but as soon as I attempt to
run

perl Makefile.pl

 ...the process again fails.  Several messages come up, the most provocative
of which is "Unable to find a perl 5"; followed by error text which lists
several places the program looked for Perl INCLUDING the directory in which
I *know* Perl.exe does in fact reside!!!

Is there a simpler way to go about this?  Or do you have any idea what I
could be doing wrong?  Please keep in mind that you're talking to a Perl
(but not a programming) novice.  I'd really appreciate your help.  Thanks in
advance.






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

Date: Sat, 25 Nov 2000 09:45:09 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: NEWBIE- Help me retrieve and incorporate Date-Calc module???
Message-Id: <3A1FFAA5.FA419AB0@vpservices.com>

Alan Mailer wrote:
>
> I've also tried downloading and unzipping the file myself.  After this I
> tried to follow the Install.txt instructions, but as soon as I attempt to
> run
> 
> perl Makefile.pl
> 
> ...the process again fails.  Several messages come up, the most provocative
> of which is "Unable to find a perl 5"; followed by error text which lists
> several places the program looked for Perl INCLUDING the directory in which
> I *know* Perl.exe does in fact reside!!!

That is a bad bad bad bug in earlier versions of ActivePerl.  Upgrade
now and that problem will go away and you will be able to use nmake on
all Perl modules that do not require compilation.

-- 
Jeff


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

Date: Sat, 25 Nov 2000 13:11:28 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: NEWBIE- Help me retrieve and incorporate Date-Calc module???
Message-Id: <3A2000D0.34B0958B@patriot.net>

Well, since you never bothered to say which version of Perl you're using, I'd
suggest that
you go to http://www.activestate.com, and install the latest version of
ActivePerl for your
win98 platform.

From there, installing the module in question is a simple command line
operation...

ppm install Date-Calc

Alan Mailer wrote:

> Could someone talk a major Perl newbie through the steps of retrieving the
> Date::Calc module and then successfully incorporating it into my Win 98 (not
> NT) environment.
>
> I've begun working with Perl and it seems as though I may have to add my
> first module (because, as far as I can tell, Date:Calc is NOT part of the
> original package).  Anyway, nothing I'm doing seems to successfully
> accomplish what I'm trying to do.  Frankly I think the instructions
> regarding this in various books and websites is not designed for the novice
> who is attempting to do this the first time.
>
> I've tried prompting Perl (or Cpan) to take the steps itself (using
> perl -MCPAN -e "shell"), but I always get a bunch of errors during the
> process and the process eventually fails.
>
> I've also tried downloading and unzipping the file myself.  After this I
> tried to follow the Install.txt instructions, but as soon as I attempt to
> run
>
> perl Makefile.pl
>
> ...the process again fails.  Several messages come up, the most provocative
> of which is "Unable to find a perl 5"; followed by error text which lists
> several places the program looked for Perl INCLUDING the directory in which
> I *know* Perl.exe does in fact reside!!!
>
> Is there a simpler way to go about this?  Or do you have any idea what I
> could be doing wrong?  Please keep in mind that you're talking to a Perl
> (but not a programming) novice.  I'd really appreciate your help.  Thanks in
> advance.

--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.




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

Date: Sat, 25 Nov 2000 20:50:14 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: perl for win 32 setup question
Message-Id: <aCVT5.4324$GW5.27851@news-server.bigpond.net.au>

Sounds like Apache has not been configured properly.
Your http.conf file should have a line like this to allow your script
handling.
AddHandler cgi-script .pl
Also you might like to cahnge your driectory permissions to exec cgi.
<Directory> "d:/apache/cgi-bin/"
         AllowOverride None
         Options Exec CGI
 </Directory>
Should see you right.





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

Date: Sat, 25 Nov 2000 21:23:31 GMT
From: fish@7cs.net (Grimpoteuthis)
Subject: Re: perl for win 32 setup question
Message-Id: <3a202d9e.50827733@News>

Thanks for replying.

I now have the following lines in my httpd.conf:

ScriptAlias /cgi-bin/ "d:apache/cgi-bin"

<Directory "d:/apache/cgi-bin">
	AllowOverride None
	Options ExecCGI
</Directory>

AddHandler cgi-script .pl .cgi

Perl works from the DOS line, and Apache serves up pages.

however when I try to run  a perl file from explorer I'm still getting
the download/run otion and Netscape says I don't have permission to
access this file.

So i've evidently still got things screwed up, any more advise?

thanks

greg

On Sat, 25 Nov 2000 20:50:14 GMT, "John Boy Walton"
<johngros@Spam.bigpond.net.au> wrote:

>Sounds like Apache has not been configured properly.
>Your http.conf file should have a line like this to allow your script
>handling.
>AddHandler cgi-script .pl
>Also you might like to cahnge your driectory permissions to exec cgi.
><Directory> "d:/apache/cgi-bin/"
>         AllowOverride None
>         Options Exec CGI
> </Directory>
>Should see you right.
>
>
>



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

Date: Sat, 25 Nov 2000 21:23:38 GMT
From: fish@7cs.net (Grimpoteuthis)
Subject: Re: perl for win 32 setup question
Message-Id: <3a202b91.50302300@News>

Thanks for replying.

I now have the following lines in my httpd.conf:

ScriptAlias /cgi-bin/ "d:apache/cgi-bin"

<Directory "d:/apache/cgi-bin">
	AllowOverride None
	Options ExecCGI
</Directory>

AddHandler cgi-script .pl .cgi

Perl works from the DOS line, and Apache serves up pages.

however when I try to run  a perl file from explorer I'm still getting
the download/run otion and Netscape says I don't have permission to
access this file.

So i've evidently still got things screwed up, any more advise?

thanks

greg

On Sat, 25 Nov 2000 20:50:14 GMT, "John Boy Walton"
<johngros@Spam.bigpond.net.au> wrote:

>Sounds like Apache has not been configured properly.
>Your http.conf file should have a line like this to allow your script
>handling.
>AddHandler cgi-script .pl
>Also you might like to cahnge your driectory permissions to exec cgi.
><Directory> "d:/apache/cgi-bin/"
>         AllowOverride None
>         Options Exec CGI
> </Directory>
>Should see you right.
>
>
>



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

Date: Sat, 25 Nov 2000 21:06:15 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Perl-Expert need (read)
Message-Id: <3A202ADE.2DA4C102@rochester.rr.com>

Alexander Adam wrote:
> 
> Hello,
> 
> We need someone who can programm a gui around the perl-debugger, just like
> in ActiveState's Debugger or the Perlbuilder 2.0!
> Programming language: Delphi(OP) prefered, but C++ (Visual C++) also
> accepted!!
> 
> So, can u help us ?
> You'll be payed very good, of course, but it's very hurry, so please reply
> us very fast!
> 
> Thanks to all,
> 
> A. Adam
> --
> PCX Software
Any chance ptksh already provides what you want?
-- 
Bob Walton


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

Date: Sat, 25 Nov 2000 20:30:56 GMT
From: Martin Heinsdorf <martinheinsdorf@codesign.net>
Subject: Re: Regex question about \x$1
Message-Id: <3A20213F.19B6A270@codesign.net>

You're on the right track. Just one more step to go...

$myvar =~ s/%(..)/chr hex($1)/eg;

Martin Heindsdorf

theredviper@my-deja.com wrote:

> Oh well,
>
> So much for doing the conversion all in the regex.  I'm sure there is a
> way to do it without the extra perlcode.  I gave up searching and just
> used this.
>
> $myvar = "he says %27if it works use it%27";
> while ($myvar =~ m/%(..)/){
>         $my_temp = chr hex($1);
>         $myvar =~ s/%../$my_temp/;
> }
>
> In article <8vln9b$tj5$1@nnrp1.deja.com>,
>   theredviper@my-deja.com wrote:
> > I have what is probably a simple question.  Why will the following
> > regex not work properly in perl?
> >
> > s/%(..)/\x$1/g
> >
> > It kinda seems like this would take %1A and convert the hex 1A to its
> > ascii equivilant. Changing the substitution value to \x027 takes the
> > literal hex value 27 and replaces the matches accordingly, but I want
> > to use the value in $1.  I searched dejanews for an example and looked
> > in the Mastering Regular Expressions book, but haven't had any luck
> > finding an answer.  Thanks for any help.
> >
> > -theredviper
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Sat, 25 Nov 2000 15:47:45 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Regex question about \x$1
Message-Id: <slrn9209bh.3oc.tadmc@magna.metronet.com>

Martin Heinsdorf <martinheinsdorf@codesign.net> wrote:

>You're on the right track. 


No he isn't, nor are you.

The "right track" is using a library to decode URLs, where all
of the tiny details have already been worked out, and the
solution has been examined by many people.

Working it out yourself, with input from random Usenauts,
is a waste of time. You might miss something. Vanishingly
few people have reviewed the code.

Doing this as anything other than simply a learning exercise
where you will not be using the code in "real" programs
is the Wrong Track.


Your "solution" isn't good enough yet either.

(But experienced lurkers would have already distrusted your
 advice due to cues given by your quoting style.

 Whether Jeopardy quoting really correlates to lower-quality
 content does not matter. What matters is the perception
 of the newsgroup readers. And that perception hereabouts
 is well established.

 Don't reverse time if you don't want to be discounted.
)


>Just one more step to go...
>
>$myvar =~ s/%(..)/chr hex($1)/eg;

>> $myvar = "he says %27if it works use it%27";


Try it with this:

   my $myvar = "he says %  if it works use it%%%";

It deletes data characters that are not URL encoded.

Discarding data is most often a Bad Thing.


>> while ($myvar =~ m/%(..)/){
>>         $my_temp = chr hex($1);
>>         $myvar =~ s/%../$my_temp/;


[ snip a bunch of Jeopardy quoted text with _multiple_ time
  discontinuities.
]

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


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

Date: Sat, 25 Nov 2000 20:45:43 GMT
From: ed_energy@hotmail.com (Energy)
Subject: Re: Simple Question :)
Message-Id: <3a2024e2.38831266@news.telepac.pt>


Thank you all  :)


Em Wed, 22 Nov 2000 14:20:40 GMT, ed_energy@hotmail.com (Energy)
escreveu:

>Hello and please sorry for my bad english
>Please can someone tell me how to remove the first 3 caracteres from a
>file name in perl?
>
>I have;
>var = "tn_name.jpg";
>
>And I need to remove the first 3 caracteres "tn_" so the var will look
>like this:
>
>var = "name.jpg";
>
>Thank you very much for your help on this



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

Date: Sat, 25 Nov 2000 19:39:47 -0800
From: "GOGAR" <angenent@kabelfoon.nl>
Subject: TK for Win32?
Message-Id: <8vp0ve$2ho1$1@news.kabelfoon.nl>

Is it just me or isn't the Tk module available for Win32?
and if so, isn't there an alternative?

Gogar




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

Date: Sat, 25 Nov 2000 20:36:57 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: TK for Win32?
Message-Id: <JpVT5.4320$GW5.27859@news-server.bigpond.net.au>

Win32::GUI




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

Date: Sat, 25 Nov 2000 20:56:58 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: TK for Win32?
Message-Id: <3A2028B1.3D1C0486@rochester.rr.com>

GOGAR wrote:
> 
> Is it just me or isn't the Tk module available for Win32?
> and if so, isn't there an alternative?
> 
> Gogar
Tk is available:

    ppm install Tk

at any command prompt.
-- 
Bob Walton


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

Date: Sat, 25 Nov 2000 12:46:17 -0500 (EST)
From: The-Duke-of-URL@webtv.net (Earl Mardukas)
Subject: Using Net::FTP to print a directory
Message-Id: <14471-3A1FFAE9-8@storefull-114.iap.bryant.webtv.net>

I am attempting unsuccessfully to get and print a website's directory
using the Net::FTP module.

I *am* able to accomplish *other* functions, so I know that I must be
doing *something* right.  

The expressions that work are:

>use Net::FTP;

>$ftp=Net::FTP->new($server);

>$ftp->login($id,$pass);

>$ftp->mkdir($directory);

>$ftp->cwd($directory);

>$ftp->get($filename, $save_as);

>$ftp->put($save_as, $filename);

The expressions that do *not* work to print a directory are:

>$ftp->pwd($directory);

>$ftp->list($directory);

>$ftp->list;

>$ftp->ls;

I *am* able to get somewhat of a directory with this:

>print $ftp->ls;

but it is squished together.  I want to be able to extract each
individual filename and also each file's size.

"print $ftp->message;" prints something, but not directory information.
What am I doing wrong?



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

Date: 25 Nov 2000 12:25:38 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Using Net::FTP to print a directory
Message-Id: <87lmu7nc2l.fsf@limey.hpcc.uh.edu>

>> On Sat, 25 Nov 2000 12:46:17 -0500 (EST),
>> The-Duke-of-URL@webtv.net (Earl Mardukas) said:

> I am attempting unsuccessfully to get and print a
> website's directory using the Net::FTP module.

> The expressions that do *not* work to print a directory
> are:

>> $ftp->pwd($directory);
>> $ftp->list($directory);
>> $ftp->list;
>> $ftp->ls;

"perldoc Net::FTP" says, e.g. for ls:

    In an array context, returns a list of lines returned
    from the server. In a scalar context, returns a
    reference to a list.

So it doesn't "print" anything, it returns the values to
the caller.  Which you can then do whatever with,
including printing and formatting.

> I *am* able to get somewhat of a directory with this:
>> print $ftp->ls;
> but it is squished together.

Well, that's just how arrays print by default.  Just
iterate over the elements returned by ls() and
format/process them as you will.

    my @listing = $ftp->ls();
    do_something($_) for @listing;  # which you can collapse
                                    # into 1 line of course

hth
t
-- 
Eih bennek, eih blavek.


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

Date: Sat, 25 Nov 2000 14:55:52 -0500 (EST)
From: The-Duke-of-URL@webtv.net (Earl Mardukas)
Subject: Re: Using Net::FTP to print a directory
Message-Id: <8056-3A201948-40@storefull-115.iap.bryant.webtv.net>

My original problem:

>>I am attempting unsuccessfully to get and
>> print a website's directory using the
>> Net::FTP module.  "$ftp->ls;" does not work.

tony_curtis32@yahoo.com (Tony=A0Curtis) replied:

>........@listing =3D $ftp->ls(); .....

Thank you, Tony.  I see my mistake.  I was not treating it as an array.

I also, as you pointed out, misused the term "print."  I meant to say
"return."

Now, I feel kind of brain dead today and I'm almost embarrassed to ask,
but...

To get the *long* version of the directory, I know it's "ls -l" but
"$ftp->ls-l()" and "$ftp->ls(-l)" don't work.  What am I doing wrong
now?



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

Date: 25 Nov 2000 15:11:40 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Using Net::FTP to print a directory
Message-Id: <87itpbn4dv.fsf@limey.hpcc.uh.edu>

>> On Sat, 25 Nov 2000 14:55:52 -0500 (EST),
>> The-Duke-of-URL@webtv.net (Earl Mardukas) said:

> Now, I feel kind of brain dead today and I'm almost
> embarrassed to ask, but...

> To get the *long* version of the directory, I know it's
> "ls -l" but "$ftp->ls-l()" and "$ftp->ls(-l)" don't
> work.  What am I doing wrong now?

The argument to ls() is the directory to list, not
something to be passed to "ls".   "ls -l" is one
particular implementation at the remote end.

Net::FTP provides the dir() method.

hth
t
-- 
Eih bennek, eih blavek.


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

Date: Sat, 25 Nov 2000 16:41:58 GMT
From: peter pilsl <pilsl@goldfisch.atat.at>
Subject: whats wrong with this one ?
Message-Id: <MPG.148a0b7055e2c6598994f@news.chello.at>


In a perl-script I produce some file and I want to output via a browser.
The plan is to add a 1s-expirationheader later, cause the picture changes 
frequently, so its merely a wrapper around a image that will be called 
like 
print '<img src="wrapper.pl?file=s.png">';

However the picture itself is fine, the wrapperoutput is not recognized as 
picture. I tried to use the CGI-header and to write my own header: no 
difference. When running on commandline the output seems quite fine: the 
header and then the binary stuff. However when opening in a browser or a 
picture-tool I this 'no file'-symbols of ie and opera or the message "not 
a known picture".
What am I doing wrong ???

thanx,
peter


#!/usr/bin/perl -w

use CGI qw/:standard/;

#print header({-type=>'image/png'});   #,-expires=>'+1s'});

$f=param('file');

syswrite STDOUT, "Content-Disposition: attachment; filename=bar.png\n";
syswrite STDOUT, "Content-Type: image/png\n\n";   

open(FH,"< $f") or die 'nix';
while (<FH>) {syswrite STDOUT, $_}
close FH;



-- 
pilsl@
goldfisch.at


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

Date: Sat, 25 Nov 2000 20:28:32 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: whats wrong with this one ?
Message-Id: <i7802t8bhl4suispihp1d6d6d38vt010ls@4ax.com>

peter pilsl wrote:

>However when opening in a browser or a 
>picture-tool I this 'no file'-symbols of ie and opera or the message "not 
>a known picture".
>What am I doing wrong ???

Maybe you've forgotten to apply binmode() on both your file and output
handle.

-- 
	Bart.


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

Date: Sun, 26 Nov 2000 09:50:21 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: whats wrong with this one ?
Message-Id: <slrn920ghd.imr.mgjv@martien.heliotrope.home>

On Sat, 25 Nov 2000 16:41:58 GMT,
	peter pilsl <pilsl@goldfisch.atat.at> wrote:
> 
> #!/usr/bin/perl -w
> 
> use CGI qw/:standard/;

binmode STDOUT;

> #print header({-type=>'image/png'});   #,-expires=>'+1s'});

This would be fine, and preferable above this:

> syswrite STDOUT, "Content-Disposition: attachment; filename=bar.png\n";
> syswrite STDOUT, "Content-Type: image/png\n\n";   

You don't actually need syswrite, and probably shouldn't use it. I can't
comment on the validity of the first header you send.

> open(FH,"< $f") or die 'nix';

binmode FH;

> while (<FH>) {syswrite STDOUT, $_}
> close FH;

Martien
-- 
Martien Verbruggen              | The Second Law of Thermodenial: In
Interactive Media Division      | any closed mind the quantity of
Commercial Dynamics Pty. Ltd.   | ignorance remains constant or
NSW, Australia                  | increases.


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

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


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