[12714] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 124 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 13 19:37:20 1999

Date: Tue, 13 Jul 1999 16:27:38 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 13 Jul 1999     Volume: 9 Number: 124

Today's topics:
        Determining the filesize of a given file (Stephan Budach)
    Re: Determining the filesize of a given file <swiftkid@bigfoot.com>
    Re: Determining the filesize of a given file (Larry Rosler)
    Re: Determining the filesize of a given file (Mike Bristow)
    Re: die or print (Tad McClellan)
    Re: die or print <hiller@email.com>
    Re: die or print (Larry Rosler)
    Re: die or print (Bart Lateur)
    Re: die or print (Tony Greenwood)
    Re: Diff tools? <kairys@mi.sl.com>
        Dumping variables in Activestate's debugger? <bivey@teamdev.com>
    Re: export excel file <c4jgurney@my-deja.com>
    Re: export excel file <swiftkid@bigfoot.com>
    Re: FAQ 5.7: How can I use a filehandle indirectly? <m.summerfield@ieee.org>
    Re: FAQ 5.7: How can I use a filehandle indirectly? (Jerome O'Neil)
    Re: FAQ 5.7: How can I use a filehandle indirectly? (Michael Rubenstein)
        file i/o in perlscript cramey@my-deja.com
    Re: file i/o in perlscript (elephant)
    Re: file i/o in perlscript <matt@sergeant.org>
    Re: file i/o in perlscript <gellyfish@gellyfish.com>
    Re: Filter Websides Under WIN95/98/NT (Abigail)
    Re: form elements and Perl (David Efflandt)
        Format Oracle Stdout margfud@my-deja.com
    Re: Format Oracle Stdout (Tad McClellan)
        Free Web Chat Program (Perl CGI) Available For Download <wyndo@cxo.com>
    Re: from a pipe <dgrogan@erols.com>
    Re: from a pipe (Bart Lateur)
    Re: from a pipe (Bart Lateur)
    Re: from a pipe <dgrogan@erols.com>
        FTP fetch with LWP::Simple wired2000@my-deja.com
    Re: FTP fetch with LWP::Simple <emschwar@rmi.net>
    Re: FTP fetch with LWP::Simple <gransoe@antispam.get2net.dk>
    Re: FTP fetch with LWP::Simple wired2000@my-deja.com
        FTP with LWP <gransoe@antispam.get2net.dk>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Tue, 13 Jul 1999 17:24:27 +0200
From: stephan.budach@knsk-bbdo.de (Stephan Budach)
Subject: Determining the filesize of a given file
Message-Id: <stephan.budach-1307991724270001@budach-stephan.intern.knsk-bbdo.de>

Hi all,

i have tried to determine the filesize for a given file with the stat
function like this:

@stats = stat(<path to file>);
$size = $stats[7];

Alas, for every real file i get the message of using an uninitialized value.

What´s wrong with it?

Thanks,
Stephan Budach


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

Date: Tue, 13 Jul 1999 21:01:33 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Determining the filesize of a given file
Message-Id: <7mgr69$2a04@news.cyber.net.pk>

: i have tried to determine the filesize for a given file with the stat
: function like this:
:
: @stats = stat(<path to file>);
: $size = $stats[7];

$size = -s '/blah/filename.txt';





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

Date: Tue, 13 Jul 1999 10:04:47 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Determining the filesize of a given file
Message-Id: <MPG.11f5118483f79aaf989cb9@nntp.hpl.hp.com>

In article <7mgr69$2a04@news.cyber.net.pk> on Tue, 13 Jul 1999 21:01:33 
+0500, Faisal Nasim <swiftkid@bigfoot.com> says...
> : i have tried to determine the filesize for a given file with the stat
> : function like this:
> :
> : @stats = stat(<path to file>);
> : $size = $stats[7];
> 
> $size = -s '/blah/filename.txt';

That is certainly good shorthand for the first attempt.  But I can't 
think of a circumstance in which the '-s' would succeed when the 'stat' 
would fail.  So I don't think this helps the questioner at all.

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


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

Date: Tue, 13 Jul 1999 18:00:51 GMT
From: mike@fat.dotat.at (Mike Bristow)
Subject: Re: Determining the filesize of a given file
Message-Id: <slrn7omvmj.ump.mike@lindt.fat.dotat.at>

On Tue, 13 Jul 1999 17:24:27 +0200, Stephan Budach <stephan.budach@knsk-bbdo.de> wrote:
>@stats = stat(<path to file>);
>$size = $stats[7];

You're not doing any error checking; try:

@stats = stat($filename) or die "Oh, my god!  I can't stat $filename: $!";
$size = $stats[7];

-- 
Mike Bristow, Geek-At-Large.                GK/RM0501
one tequila - two tequila - three tequila - FLOOR !!!


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

Date: Mon, 12 Jul 1999 10:13:55 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: die or print
Message-Id: <37tcm7.gce.ln@magna.metronet.com>

Tony Greenwood (tony@webscripts.org) wrote:
: Hey!  tadmc@metronet.com (Tad McClellan) 

: >: I presume "die" is preferable to "print" but produces nothing for me.
: >
: >
: >   I doubt that.

: I only presumed the above because 90% of the answers or posts that I
: read in this and other related newsgroups seem to quote "die" and not
: "print".However I am here to learn so if you would like to illiterate
: on the subject ?


   I did already.

   I said that die() outputs to STDERR.


: The above will show the error message in the browser, If I replace
: with "die" it shows nothing.

: >   You are probably not looking in the right place to see the die()
: >   output...

: Yes that does sound logical as surely it produces something.


   In a CGI environment, STDERR usually goes to some server log
   or something.

   Where it goes is a function of how your server is set up.

   We do not know how your server has been setup, and server
   configuration is off-topic in this Perl newsgroup anyway.


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


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

Date: Mon, 12 Jul 1999 19:38:11 GMT
From: Jordan Hiller <hiller@email.com>
Subject: Re: die or print
Message-Id: <378A4428.8FDE90A9@email.com>

Jonathan Stowe wrote:
> 
> Or alter the flow of control in your program with something like:
> 
> if(open(FILE,"blah"))
>   {
>     # thats ok
>   }
> else
>   {
>     # Ooh no file
>   }


For my CGI Perl scripts, I use a little subroutine to handle errors:

sub fatal_error {
  print $_[0];
  exit;
}

Then: open(FILE, "blah") or fatal_error("Can't open file blah: $!");

This works similarily to "fatalsToBrowser" but I don't have to worry about any
external modules. It is better than just print because it also does the exit,
and better than die because you can see the errors right away for debugging. 

-- 
Jordan Hiller (hiller@email.com)

JavaScript and Perl programs for
 making online tests and quizzes:
http://web-shack.hypermart.net/quiz.html


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

Date: Mon, 12 Jul 1999 16:59:13 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: die or print
Message-Id: <MPG.11f4212ca55a3be4989cab@nntp.hpl.hp.com>

In article <378A4428.8FDE90A9@email.com> on Mon, 12 Jul 1999 19:38:11 
GMT, Jordan Hiller <hiller@email.com> says...
 ...
> For my CGI Perl scripts, I use a little subroutine to handle errors:
> 
> sub fatal_error {
>   print $_[0];
>   exit;
> }
> 
> Then: open(FILE, "blah") or fatal_error("Can't open file blah: $!");
> 
> This works similarily to "fatalsToBrowser" but I don't have to worry about any
> external modules. It is better than just print because it also does the exit,
> and better than die because you can see the errors right away for debugging. 

The following lets you use 'die':

  $SIG{'__DIE__'} = sub { # Intercept fatal errors and report.
    print $_[0];
    exit;
  }

The quotes around '__DIE__' are to satify old versions of perl.

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


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

Date: Tue, 13 Jul 1999 07:31:52 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: die or print
Message-Id: <378be426.1348408@news.skynet.be>

Jordan Hiller wrote:

>For my CGI Perl scripts, I use a little subroutine to handle errors:
>
>sub fatal_error {
>  print $_[0];
>  exit;
>}

That's elaborate. Can't you just do:

	opend STDERR,'>&STDOUT';

to send the STDERR output to STDOUT also? (= duplicate a file handle) 

That's the road that CGI::Carp takes, too. See the code for carpout().
It does some things more, like making sure that a content/type header
has been printed, and wrapping it into a page.

	Bart.


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

Date: Tue, 13 Jul 1999 12:09:23 GMT
From: tony@webscripts.org (Tony Greenwood)
Subject: Re: die or print
Message-Id: <379029db.15787875@news.freeserve.co.uk>

Hey!  tadmc@metronet.com (Tad McClellan) 

>   In a CGI environment, STDERR usually goes to some server log
>   or something.

OK now I know that.. I looked and found it Many thanks! 

>   Where it goes is a function of how your server is set up.

Obviously.

>   We do not know how your server has been setup, and server
>   configuration is off-topic in this Perl newsgroup anyway.

It's OK I won't tell Abigail if you don't. Anyway I doubt anyone will
mind you taking the thread off topic for one sentence to help someone
out. I am just glad it wasn't me that did it. ;-)

Thanks, question now fully answered thanks to everyones help...








--
Tony Greenwood
PORTFOLIO www.webscripts.org


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

Date: Tue, 13 Jul 1999 10:19:28 -0400
From: "Michael Kairys" <kairys@mi.sl.com>
Subject: Re: Diff tools?
Message-Id: <931874915.49194@newnfs.ic.net>

>     Don't you hate being cursed to exist in a tool deficient environment?

While I don't wish to disagree with that opinion I would like to point out
that NT does have a file difference tool, 'fc'.




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

Date: 12 Jul 1999 22:02:02 GMT
From: "William" <bivey@teamdev.com>
Subject: Dumping variables in Activestate's debugger?
Message-Id: <01beccb2$40164980$583c08cf@bill.jump.net>

We've been trying to get the Dump Variable window in
the Activestate debugger to work and so far, no luck.
Is there some subtlety that we're overlooking? The
docs seem silent on this issue. (At least, I didn't
see anything helpful when it just doesn't do anything
at all.) -Wm


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

Date: Tue, 13 Jul 1999 08:25:16 GMT
From: Jeremy Gurney <c4jgurney@my-deja.com>
Subject: Re: export excel file
Message-Id: <7met55$dal$1@nnrp1.deja.com>

In article <378A2E85.5C5CFCC4@bbn.com>,
  Yu Fang <yfang@bbn.com> wrote:
> Guys:
>   Is there a module in perl that creates an MS excel file? Thanks.

The excel file format is quite complicated, however excel is quite happy
to read a variety of different file formats.

Personally as a quick fix I save a tab delimited file as .xls and then
excel is quite happy to open it with the minimum of fuss.

Other supported formats include csv files, dbase, and html files (very
useful).

HTH,

Jeremy Gurney
SAS Programmer  |  Proteus Molecular Design Ltd.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 13 Jul 1999 13:03:49 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: export excel file
Message-Id: <7mfv6t$ldn9@news.cyber.net.pk>

Yu Fang <yfang@bbn.com> wrote in message news:378A3C50.9BDC5AD3@bbn.com...
: I have a database (Oracle) on a Unix box. One report I generate from
: this database needs to be in an Excel file. Is there any perl module for
: Unix can do this? Thanks.

Win32::OLE
DBI
DBD-oracle





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

Date: Tue, 13 Jul 1999 08:46:45 +1000
From: Mark Summerfield <m.summerfield@ieee.org>
Subject: Re: FAQ 5.7: How can I use a filehandle indirectly?
Message-Id: <378A7055.57A63860@ieee.org>

Tom Christiansen wrote:

> I don't meant to be judgmaticalistical and call it super invalidy
> in vurry ripped and clipped jargon, but it's just not a decentish or
> statusy thing to be writing thusly in the bettermost fora.  Sure, that
> kind of phrasey lingo might thusly sound more come-at-able to some of
> the more swellish kiddies, but it's a ratherish shambolic stunt that
> thusly leaves the vurry, vurry nicey reader in search of something, well,
> moreish; you know, something a tad more primmy and prestigey.  It's hard
> to avoid getting an ucky taste all-overish when thusly stumbling through
> twistical turns of tongue.  Yes indeedy, Bob!

This is English translated into Hugh-Grant-ese, right?!


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

Date: 12 Jul 1999 23:10:10 GMT
From: jeromeo@atrieva.com (Jerome O'Neil)
Subject: Re: FAQ 5.7: How can I use a filehandle indirectly?
Message-Id: <7mdski$k21$1@brokaw.wa.com>

> My, my.  All this foofaraw about two little letters:  'thus' => 
> 'thusly'.  (Note ObPerl content in => :-)

Indeed.  Had I known the the pedant factor of *this* particular ditty,
I would have spaken thusly:

"The docs say this..."

I guess thats what I get for being perspicious.  


-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.i-filezone.com


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

Date: Tue, 13 Jul 1999 02:23:13 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: FAQ 5.7: How can I use a filehandle indirectly?
Message-Id: <378e9d97.50852321@nntp.ix.netcom.com>

On 12 Jul 1999 15:00:01 GMT, gbacon@itsc.uah.edu (Greg Bacon)
wrote:

>In article <37886376.57218315@nntp.ix.netcom.com>,
>	miker3@ix.netcom.com (Michael Rubenstein) writes:
>: Ordinary, conversational, English is, I believe, the appropriate
>: standard for Usenet discussion.
>
>Itid take me damn near ten minnits fer me t'post in conv'sational
>Suth'n.  Itid take you 'bout just as long t'read 'em.
>
>Let's stick to Standard English (as opposed to, say, nonstandard
>variations like the Queen's English :-) :-) for the English
>hierarchies.

Come on now.  I never suggested we should write in dialects here.
In fact, I said later in that article.

	Clearly one should not use [a form showing dialect[ 
	except where one intends to onvey the pronunciation as 
	well as the meaning of the word

Colloquialisms are proper English in conversation and that is, I
believe, the appropriate standard here.  Dialects are appropriate
when the pronunciation adds to the point.  There's a very limited
application for that in a programming newsgroup.

The objective should be to make oneself understood and I cannot
see an occasional "thusly" as being a problem.

The Perl documentation was written by "Larry Wall
<larry@wall.org>, with the help of oodles of other folks."  Did
you have difficulty in understanding that because of the
colloquialism?
-- 
Michael M Rubenstein


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

Date: Mon, 12 Jul 1999 22:27:35 GMT
From: cramey@my-deja.com
Subject: file i/o in perlscript
Message-Id: <7mdq48$16p$1@nnrp1.deja.com>

is it possible with perlscript to write a file on
the server.. and if so, how do i accomplish
this...

the file would be just a simple ascii text file.



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 13 Jul 1999 12:36:45 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: file i/o in perlscript
Message-Id: <MPG.11f5514489e0a664989b2f@news-server>

cramey@my-deja.com writes ..
>is it possible with perlscript to write a file on
>the server..

no .. perlscript is a client side scripting language executed in your 
browser

-- 
 jason - remove all hyphens for email reply -


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

Date: Tue, 13 Jul 1999 09:25:33 +0100
From: Matt Sergeant <matt@sergeant.org>
Subject: Re: file i/o in perlscript
Message-Id: <378AF7FD.FA56D40E@sergeant.org>

elephant wrote:
> 
> cramey@my-deja.com writes ..
> >is it possible with perlscript to write a file on
> >the server..
> 
> no .. perlscript is a client side scripting language executed in your
> browser

No, perlscript is an Active Scripting Engine, executed in an active
scripting environment, such as IE or IIS. Both allow you to write files,
provided you have permissions to do so.

Matt.


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

Date: 13 Jul 1999 09:44:22 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: file i/o in perlscript
Message-Id: <378afc66@newsread3.dircon.co.uk>

elephant <e-lephant@b-igpond.com> wrote:
> cramey@my-deja.com writes ..
>>is it possible with perlscript to write a file on
>>the server..
> 
> no .. perlscript is a client side scripting language executed in your 
> browser
> 

Not necessarily - it can also be used for ASP.

/J\
-- 
"It's times like this I wish I had a penis" - Duckman


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

Date: 12 Jul 1999 23:03:40 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Filter Websides Under WIN95/98/NT
Message-Id: <slrn7olek3.h7.abigail@alexandra.delanet.com>

anton.kramer.erlenmoos@t-online.de (anton.kramer.erlenmoos@t-online.de)
wrote on MMCXLI September MCMXCIII in <URL:news:7mccis$1gv$1@newsread.f.de.uu.net>:
** 
** Who can help me?
** I should filter websides before they are displayed
** by the browser.
** For excample:  
** URL:  www.yahoo.de
** filtering:   'shopping'
** if the webside contains -shopping- I should
** change the URL f.e. to 'www.wal-mart.com'
** Do you know a solution ?


Well, you fetch the document, search for your trigger phrases, and if
found, you generate the appropriate HTTP magic.

Do you have a specific question, or are you just looking for a programmer
to hire?



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 13 Jul 1999 05:54:52 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: form elements and Perl
Message-Id: <slrn7oll0l.fr.efflandt@efflandt.xnet.com>

On Tue, 06 Jul 1999 13:47:16 +0200, tan ses <tan.ses@Sun.COM> wrote:
>Hi there,
>
>i have written script which processes formular data entries and writes
>them to an email.
>I have also included an option that the user can revise his/her data by
>pressing the "Back button". Is there a way to get the referring page URL
>without all the form data which has been entered will be deleted.
(snip)
>Maybe someone has found a slution or workaround for this problem.
>Thanx in advance,
>
>Tan

Such questions should be posted to *.authoring.cgi newsgroup.  But look at
the example in CGI.pm.  You can simply reproduce your form after the
preview and have 2 submit buttons on the form, "Preview" and "Submit".
Previous data is automatically duplicated in the form.

-- 
David Efflandt   efflandt@xnet.com   http://www.xnet.com/~efflandt/
http://www.de-srv.com/   http://cgi-help.virtualave.net/


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

Date: Tue, 13 Jul 1999 18:10:15 GMT
From: margfud@my-deja.com
Subject: Format Oracle Stdout
Message-Id: <7mfvdr$q4i$1@nnrp1.deja.com>

Hi,

Thanks anyone who takes time to help me out - I know you're all very
busy...

I have this Perl code that talks to Oracle. My goal is to display it
through Java's TextArea.

#!/usr/bin/perl -w

$result = "";

sub start {

        use DBI;

        use DBD::Oracle;

        my $dbh = DBI->connect('dbi:Oracle:','scott/tiger@orac', '' );

        die unless $dbh;

        my $sth = $dbh->prepare( q{
                 SELECT name, phone
                 FROM employees
         }) || die "Can't prepare statement: $DBI::errstr";

         my $rc = $sth->execute
             || die "Can't execute statement: $DBI::errstr";


         while(@field = $sth->fetchrow_array)
         {
         	$size= @field;
         	foreach $x (@field)
         	{
               		if($x < $size)
               		{
                      		$result .= $x;
                      		$result .= "\t";
                	}
                	else
                	{
                      		$result .= $x;
                      		$result .= "\n";
                	}
         	}



        }

format STDOUT =
@<<<<<<<<<<<<<< @>>>>>>>>>>>>>>>>>>
$x,             $x,
 .

How do I get output displayed in columns (my attempts fail miserably)?

What about query "select * from table_name" where I don't know
number/names of fields?

Also with perl -w option I get error messages:

 Argument "Doug MacEachern" isn't numeric in lt at
/home/spider/scripts//simple_ex.pl line 34.
Argument "555-0404" isn't numeric in lt at
/home/spider/scripts//simple_ex.pl line 34.

Lot's of questions... - so many thanks for your help.

Marg


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 13 Jul 1999 13:51:51 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Format Oracle Stdout
Message-Id: <nbufm7.9sh.ln@magna.metronet.com>

margfud@my-deja.com wrote:


: Also with perl -w option I get error messages:


   -w enables warnings.

   You are getting warning (not error) messages.


:  Argument "Doug MacEachern" isn't numeric in lt at
: /home/spider/scripts//simple_ex.pl line 34.
: Argument "555-0404" isn't numeric in lt at
: /home/spider/scripts//simple_ex.pl line 34.


   All of the messages that perl might issue are documented in
   perldiag.pod.

   Let's go see what it says for your message de jure...

--------------------
=item Argument "%s" isn't numeric%s

(W) The indicated string was fed as an argument to an operator that
expected a numeric value instead.  If you're fortunate the message
will identify which operator was so unfortunate.
--------------------


   Looks like you have a "<" where you might want "lt" instead
   (probably on line 34 :-)


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


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

Date: Mon, 12 Jul 1999 22:47:20 GMT
From: wyndo <wyndo@cxo.com>
Subject: Free Web Chat Program (Perl CGI) Available For Downloading
Message-Id: <378A8AA9.AFA523CB@cxo.com>

JabberChat is available for free downloading at the JabberChat web site.
JabberChat has millions of  channels, whispering, teleconference
actions, and more. The JabberChat website has a live demo of it
running. It's free and should run on most any platform/server where Perl
is set up. It's free. We hope  that it's useful and unique enough to be
worthwhile to anybody who wants it, and maybe get a little  name
recognition too. I know there are dozens of chat scripts out there
already, but JabberChat isn't  like any I've seen yet. Anyway, if
interested ----

http://www.prowler-pro.com/jabberchat/

PS - Thanks again to this newsgroup for helping with questions I had
while learning Perl. Often you get "RTFM" replies when the answer is
almost as short to have just typed instead, but many many times I got
really great advice! Thanks!

Mike Snyder
Prowler Productions



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

Date: Mon, 12 Jul 1999 22:17:43 -0400
From: Don Grogan <dgrogan@erols.com>
Subject: Re: from a pipe
Message-Id: <378AA1C7.A67012F9@erols.com>



Abigail wrote:

> Don Grogan (dgrogan@erols.com) wrote on MMCXL September MCMXCIII in
> <URL:news:3788B9A0.CB0A27B@erols.com>:
> ## I wanted grep for dos.  I wrote this script
> ##
> ## $pat=$ARGV[0];
> ## $pat=~tr/a-z/A-Z/;
> ## @dir=`dir`;
> ## for (@dir){
> ##   if ($_=~$pat){
>
> That's not a valid statement.  And if you make it valid, all you're
> matching is the name of the files in the directory.
>

what do you mean by valid statement?  it works, but I dont think thats what you
mean, sorry to be ignorant, but can you let me know?  thanks



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

Date: Tue, 13 Jul 1999 07:31:49 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: from a pipe
Message-Id: <378ae2cf.1005402@news.skynet.be>

Abigail wrote:

>##   if ($_=~$pat){
>
>That's not a valid statement. 

Would you believe that it *is*? I was amazed, too. I stumbled across
this syntax when checking out the new qr() operator in perlop. There,
it's in one of the examples.

	$string =~ $re;             # or used standalone

I tried it using an ordinary string, and it works. You do need the "=~"
(or "!~") though.

	$pattern = '(\\S+)';
	$string = "I'll be damned!";
	$string =~ $pattern and print $1;
-->
	I'll
-- 
	Bart.


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

Date: Tue, 13 Jul 1999 09:38:36 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: from a pipe
Message-Id: <378f081a.10552245@news.skynet.be>

Don Grogan wrote:

>I wanted grep for dos.  I wrote this script
 ...
>Can anyone tell me how I access something from a pipe?  Like if I wanted
>to do
>type autoexec.bat |grep <pattern>

Just read from <>.

Don't forget the limitations of DOS. If you call this script "grep.pl",
you could do

	type autoexec.bat | perl grep.pl <pattern>

or if you wrapped it in a .BAT jacket, 

	type autoexec.bat | grep.bat <pattern>

Yes, it's silly, but you may not drop the ".bat" extension.

And the handling of typical meta-characters in the pattern by the DOS
shell may well annoy you, too.

	Bart.


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

Date: Tue, 13 Jul 1999 17:59:04 -0400
From: Don Grogan <dgrogan@erols.com>
Subject: Re: from a pipe
Message-Id: <378BB6A7.9FED8C13@erols.com>




> >Can anyone tell me how I access something from a pipe?  Like if I wanted
> >to do
> >type autoexec.bat |grep <pattern>
>
> Just read from <>.
>
> Don't forget the limitations of DOS. If you call this script "grep.pl",
> you could do
>
>         type autoexec.bat | perl grep.pl <pattern>
>
> or if you wrapped it in a .BAT jacket,
>
>         type autoexec.bat | grep.bat <pattern>
>
> Yes, it's silly, but you may not drop the ".bat" extension.
>
> And the handling of typical meta-characters in the pattern by the DOS
> shell may well annoy you, too.
>
>         Bart.

Ok, thanks a lot!  I had tried <stdin> before posting and that was nothing
doing.  I'll try <>.  I didnt think that I could drop the .bat, but yeah I
can do that too.  :)  I don't mean to sound stupid again, but what is wrong
about the
if ($_=~$pat){
How else do you check and see if a string contains a substring?  I thought
that this was standard.  I guess not...

Anyways, thanks for you help!



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

Date: Tue, 13 Jul 1999 16:43:59 GMT
From: wired2000@my-deja.com
Subject: FTP fetch with LWP::Simple
Message-Id: <7mfqcb$np1$1@nnrp1.deja.com>

Hi,

According to the Perl FAQ's (Faq 9), it seems with LWP::Simple you can
fetch: "LWP::Simple (available from CPAN) can fetch but not put". Well,
I don't quite see how you can use the Simple module to fetch. From my
understanding only methods allowed are: get, head, getprint, getstore,
mirror.

Any help on how to fetch with LWP::Simple greatly appreciated.

Thanks
Charles


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 13 Jul 1999 11:54:12 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: FTP fetch with LWP::Simple
Message-Id: <xkf4sj8mo57.fsf@valdemar.col.hp.com>

wired2000@my-deja.com writes:
> Any help on how to fetch with LWP::Simple greatly appreciated.

LWP::Simple is for WWW pages.

You want Net::FTP (also on CPAN).

-=Eric


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

Date: Tue, 13 Jul 1999 21:54:05 +0200
From: "Per Gransøe" <gransoe@antispam.get2net.dk>
Subject: Re: FTP fetch with LWP::Simple
Message-Id: <eNMi3.408$Ax.805@news.get2net.dk>

Net::FTP doesn't handle the response from the ftp server... Quite stupid it
is. I'm trying to make LWP to do the ftp instead.


/Per

Eric The Read <emschwar@rmi.net> wrote in message
news:xkf4sj8mo57.fsf@valdemar.col.hp.com...
> wired2000@my-deja.com writes:
> > Any help on how to fetch with LWP::Simple greatly appreciated.
>
> LWP::Simple is for WWW pages.
>
> You want Net::FTP (also on CPAN).
>
> -=Eric




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

Date: Tue, 13 Jul 1999 21:01:53 GMT
From: wired2000@my-deja.com
To: emschwar@rmi.net
Subject: Re: FTP fetch with LWP::Simple
Message-Id: <7mg9fo$uib$1@nnrp1.deja.com>

In article <xkf4sj8mo57.fsf@valdemar.col.hp.com>,
  Eric The Read <emschwar@rmi.net> wrote:
> wired2000@my-deja.com writes:
> > Any help on how to fetch with LWP::Simple greatly appreciated.
>
> LWP::Simple is for WWW pages.
>
> You want Net::FTP (also on CPAN).
>
> -=Eric
>

That's what I thought too, but according to the Perl FAQ's (Faq 9, last
question on page), it says that LWP::Simple can do FTP fetches. I
myself don't see how, but it says it, and I'm wondering if its truly
possible.

Would anyone know by any chance if using Net::FTP how I can verify if a
file is downloadable (similar to doing a HEAD request, just want to
verify if its valid without downloading it).

Thanks
Charles


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 13 Jul 1999 22:04:10 +0200
From: "Per Gransøe" <gransoe@antispam.get2net.dk>
Subject: FTP with LWP
Message-Id: <GWMi3.415$Ax.773@news.get2net.dk>

Hi

Has anyone had any luck using LWP (and not Net::FTP) to get (and put) files
from (and to) a ftp server? If yes, please list an example.


/Per




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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 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.  

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 V9 Issue 124
*************************************


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