[17501] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4921 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 19 03:05:38 2000

Date: Sun, 19 Nov 2000 00:05:13 -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: <974621112-v9-i4921@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 19 Nov 2000     Volume: 9 Number: 4921

Today's topics:
    Re: apache perl module?  EOH? <junk@beetfoundation.com>
    Re: Beginners blues. <wyzelli@yahoo.com>
    Re: Beginners blues. <johngros@Spam.bigpond.net.au>
    Re: Beginners blues. <wyzelli@yahoo.com>
    Re: Do I need Java to redirect form parameters? <jwhitt@webaccess.net>
        download file via http bird_sky@my-deja.com
    Re: download file via http (Gwyn Judd)
    Re: download file via http (Martien Verbruggen)
    Re: How do you redirect to download a file? <jwhitt@webaccess.net>
    Re: Perl beginner <wyzelli@yahoo.com>
    Re: Perl beginner (Gwyn Judd)
    Re: Perl beginner <uri@sysarch.com>
    Re: Perl beginner <wyzelli@yahoo.com>
        Perl List Question <jtk@_nospam_jtkconsulting.com>
    Re: Perl List Question <bwalton@rochester.rr.com>
    Re: Perl spider performance (Alan Barclay)
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
    Re: Problems saving an uploaded file. dtbaker_dejanews@my-deja.com
    Re: simple question: can Perl do this? (talking to a pe (Michael Koehne)
    Re: simple question: can Perl do this? (talking to a pe (Tad McClellan)
        STOP REPEATED POSTING! Re: Problems saving an uploaded  dtbaker_dejanews@my-deja.com
    Re: System command, limit on number of ARGV? dtbaker_dejanews@my-deja.com
    Re: System command, limit on number of ARGV? (Martien Verbruggen)
    Re: views and/or cursors with DBD::mysql ?? (Alan Barclay)
    Re: views and/or cursors with DBD::mysql ?? <stevie_d38nospam@hotmail.com>
    Re: views and/or cursors with DBD::mysql ?? <kstep@pepsdesign.com>
    Re: XSUB output strings (Ilya Zakharevich)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 18 Nov 2000 23:43:04 -0700
From: "Jopa" <junk@beetfoundation.com>
Subject: Re: apache perl module?  EOH?
Message-Id: <cKKR5.3762$u47.697717@news.uswest.net>

Excuse me, obviously a newbie,

let me know I may grow, oppesie I think that rhymes.


"Gwyn Judd" <tjla@guvfybir.qlaqaf.bet> wrote in message
news:slrn91e5e7.jm5.tjla@thislove.dyndns.org...
> I was shocked! How could Jopa <junk@beetfoundation.com>
> say such a terrible thing:
> >Hey, does anyone know if you need an apache module to use End of html
blocks
> >
> >              print <<EOH;
> >
> >               Html content inhere
> >
> >               EOH
> >
> >I have apache and perl running, but it seems to reject these these.
>
> This sytax has nothing to do with Apache or any Apache module it is a
> pure Perl construct. The correct syntax is like this:
>
> print <<END_OF_STRING;
>
> some stuff here
>
> END_OF_STRING
>
> The end marker can be any single word you like (by convention in upper
> case). It has to start right at the very left hand edge of the line it
> is on and there cannot be anything else on the line. Also the "print
> <<END;" cannot have any white space between "END" and the "<<".
>
> As an aside, you seem to be acting under the delusion that Perl is only
> used for creating CGI scripts. This is a complete fallacy.
>
> --
> Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
> If you don't do the things that are not worth doing, who will?




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

Date: Sun, 19 Nov 2000 12:01:00 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Beginners blues.
Message-Id: <wXGR5.5$dm1.2330@vic.nntp.telstra.net>

"John Boy Walton" <johngros@Spam.bigpond.net.au> wrote in message
news:qRFR5.12581$tU2.105586@news-server.bigpond.net.au...
> Egg on my face!
> I cracked the file does not exist prob. I used the incorrect path,
misspelt
> one of the directories.
> Yet it does not work as I now get Use of uninitialized value in
> concatenation (.) at john.pl line 5.
> line 5 being : print BOGUS "$pwd+\n";
> close BOGUS; getting pushed out to line 6.

What is that + doing there?

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';




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

Date: Sun, 19 Nov 2000 05:40:56 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Beginners blues.
Message-Id: <IJJR5.12808$tU2.107988@news-server.bigpond.net.au>

I was hoping it would hold the $pwd and "/n" together but it does not work.
I have tried all sorts of combinations of putting them both in quotes with
and without the "+" I have tried dropping the /n as well and I get errors no
matter what.
Could someone show me an example of writing to a file?
One that works.
print BOGUS $pwd;
For some reason in this line is an uninitialised variable. BOGUS is a
filehandle and $pwd is declared as trying print BOGUS my($pwd);
Tells me that its already been declared.





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

Date: Sun, 19 Nov 2000 17:25:55 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Beginners blues.
Message-Id: <6ILR5.4$Wq1.448@vic.nntp.telstra.net>

"John Boy Walton" <johngros@Spam.bigpond.net.au> wrote in message
news:IJJR5.12808$tU2.107988@news-server.bigpond.net.au...
> I was hoping it would hold the $pwd and "/n" together but it does not
work.
> I have tried all sorts of combinations of putting them both in quotes with
> and without the "+" I have tried dropping the /n as well and I get errors
no
> matter what.
> Could someone show me an example of writing to a file?
> One that works.
> print BOGUS $pwd;
> For some reason in this line is an uninitialised variable. BOGUS is a
> filehandle and $pwd is declared as trying print BOGUS my($pwd);
> Tells me that its already been declared.

uninitialised means no value.  How are you setting the value of $pwd?

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';




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

Date: Sat, 18 Nov 2000 21:55:59 -0700
From: "Josh Whitt" <jwhitt@webaccess.net>
Subject: Re: Do I need Java to redirect form parameters?
Message-Id: <3a175c4a@news.webaccess.net>


Alan Dougall (ntl) <abaltd@ntlworld.com> wrote in message
news:BERQ5.2998$X03.50261@news2-win.server.ntlworld.com...

> But how do I ensure that a page form parameters (with hidden values) are
> automatically forwarded to the follow-up page without waiting/needing the
> user to press the button on that page?
>
> Essentially, the first page asks for details.  After checking the details,
> the second form "page" needs to forwards these to another site (not mine!)
Hi, I'm Josh.  There are some options here:

1) use a GET style URL to pass the parameters, if it's really not imperative
that they be hidden:

print redirect ("http://www.foo.bar/myperlprog?param1=nifty&param2=neato");

2) print a page with some javascript to trigger the form submit immediately
3) whip out LWP and post directly to this external script, grab that
script's output, and print it out from your script.

Option 3 would be the most seamless to the user, but option 2 would probably
be the fastest.

- Josh




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

Date: Sun, 19 Nov 2000 04:23:24 GMT
From: bird_sky@my-deja.com
Subject: download file via http
Message-Id: <8v7kjp$lcf$1@nnrp1.deja.com>

i wanna write a script to get file via http.


i tried libwwww but it only supprts ftp


can u suggest me a module to do so.

thanx,
vivek


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


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

Date: Sun, 19 Nov 2000 04:42:03 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: download file via http
Message-Id: <slrn91emgp.lrf.tjla@thislove.dyndns.org>

I was shocked! How could bird_sky@my-deja.com <bird_sky@my-deja.com>
say such a terrible thing:
>i wanna write a script to get file via http.
>
>i tried libwwww but it only supprts ftp

Do you mean LWP? The same LWP as in:

use LWP::Simple;

getprint 'http://www.slashdot.org';

?

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
I tell ya, I was an ugly kid.  I was so ugly that my dad kept the kid's
picture that came with the wallet he bought.
		-- Rodney Dangerfield


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

Date: Sun, 19 Nov 2000 16:57:01 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: download file via http
Message-Id: <slrn91eqtd.dm.mgjv@martien.heliotrope.home>

On Sun, 19 Nov 2000 04:23:24 GMT,
	bird_sky@my-deja.com <bird_sky@my-deja.com> wrote:
> i wanna write a script to get file via http.
> 
> 
> i tried libwwww but it only supprts ftp

Hmmm.. Are you sure? the last three letters in the name of libwww seem
to suggest to me that it would support a little more than just FTP. Is
this the libwww which is also called LWP? Because then I am absolutely
certain it supports more than just FTP.

The lwpcook documentation has numerous examples. The LWP documentation
itself has numerous examples, and mentions HTTP specifically, a few
times. I think you might be most interested in the LWP::Simple module.

What did you try, and how did you decide that HTTP wasn't supported?

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Little girls, like butterflies, need
Commercial Dynamics Pty. Ltd.   | no excuse - Lazarus Long
NSW, Australia                  | 


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

Date: Sun, 19 Nov 2000 01:02:52 -0700
From: "Josh Whitt" <jwhitt@webaccess.net>
Subject: Re: How do you redirect to download a file?
Message-Id: <3a17881a@news.webaccess.net>


"Scott Thornton" <sladb69@magma.ca> wrote in message
news:3A13EAB8.497F96C1@magma.ca...
> Just say I have a simple page with 1 button on it saying 'Download
> Now'.  When I click this button I want to do two things:
>
> (1) add client information to a log file
> (2) go ahead with the download.
>
> Basically I want it to work exactly like a normal download link in HTML,
> but also log the event.  How do I, in PERL pass on information to the
> browser to tell it to start downloading a file immediatley?

Structure your program like this:

#!/usr/bin/perl
use CGI qw[ :standard];
[place code to log all your info here]
print redirect("http://url.to.file/thefile.exe");

print redirect, like any other print in a CGI script, will send the url
through the web server - which will tell the client's browser what kind of
file to expect, so that you don't get that weird */* thing (which was
probably happening because you were trying to do http on your local machine,
without a web server?  there's a bit more to it than that, actually)

Note, if you want to display HTML before the download starts (by doing a
download.com type thing, "thanks, if it doesn't start click here"), then
you'll have to use a <META> refresh tag with the URL in it; redirect prints
a Location: header and that, of course, can't mix in with content and be
interpreted.

HTH, Josh




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

Date: Sun, 19 Nov 2000 12:03:10 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Perl beginner
Message-Id: <yZGR5.6$dm1.2290@vic.nntp.telstra.net>

"David Marvil" <captmarvil@rcn.com> wrote in message
news:8v75dn$jba$1@bob.news.rcn.net...
> #! /usr/bin/perl -w
> print "Enter users name: ";
> chomp  ($user = <STDIN>);
> open (FILE, "/user_info") || die "File not found";
> while (<FILE>) {
> chomp;
> ($name, $ip) = /(\w+\s+\w+)\s+(\d+\.\d+\.\d+\.\d+)/;
> $a{$name} = $ip;
> }

if ($name eq $user){
    print "$user\t"$a{name};
}

Hope that helps

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';




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

Date: Sun, 19 Nov 2000 02:36:16 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Perl beginner
Message-Id: <slrn91ef4v.kvq.tjla@thislove.dyndns.org>

I was shocked! How could Wyzelli <wyzelli@yahoo.com>
say such a terrible thing:

>if ($name eq $user){
>    print "$user\t"$a{name};
>}

ITYM:

     print "$user\t".$a{name};

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
The greatest way to live with honor in this world is to be what we
pretend to be.

		-- Socrates


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

Date: Sun, 19 Nov 2000 04:57:36 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Perl beginner
Message-Id: <x7pujseeyn.fsf@home.sysarch.com>

>>>>> "GJ" == Gwyn Judd <tjla@guvfybir.qlaqaf.bet> writes:

  GJ> I was shocked! How could Wyzelli <wyzelli@yahoo.com>
  GJ> say such a terrible thing:

  >> if ($name eq $user){
  >> print "$user\t"$a{name};
  >> }

  GJ> ITYM:

  GJ>      print "$user\t".$a{name};

yechh. i don't like . over basic interpolation. it is harder to read IMO

	print "$user\t$a{name}" ;

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Sun, 19 Nov 2000 17:27:48 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Perl beginner
Message-Id: <YJLR5.6$Wq1.471@vic.nntp.telstra.net>

"Gwyn Judd" <tjla@guvfybir.qlaqaf.bet> wrote in message
news:slrn91ef4v.kvq.tjla@thislove.dyndns.org...
> I was shocked! How could Wyzelli <wyzelli@yahoo.com>
> say such a terrible thing:
>
> >if ($name eq $user){
> >    print "$user\t"$a{name};
> >}
>
> ITYM:
>
>      print "$user\t".$a{name};
>

Ewk sorry, just added the test around the existing print without really
looking properly.

My preference is like Uri's, - simple interpolation rather than
concatenation.

print "$user\t$a{name}\n";

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';




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

Date: Sun, 19 Nov 2000 00:07:50 -0500
From: "Jtk" <jtk@_nospam_jtkconsulting.com>
Subject: Perl List Question
Message-Id: <t1enul1qdlg602@corp.supernews.com>

Okay I am stumped.  I have a Perl list and I am trying to add
stuff to the end of each item in the list.  What I came up with
is :

@Email[$ListPos] =  @Email[$ListPos] .= ":" ;

Now this adds a colon to the Front on each item
so does:

@Email[$ListPos] =  @Email[$ListPos] . ":" ;

as well as this:

$Email[$ListPos] =  $Email[$ListPos] . ":" ;

So how can I add this colon to the the end of each item?

TIA

Jtk






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

Date: Sun, 19 Nov 2000 06:12:45 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Perl List Question
Message-Id: <3A177021.1A5C8CA5@rochester.rr.com>

Jtk wrote:
> 
> Okay I am stumped.  I have a Perl list and I am trying to add
> stuff to the end of each item in the list.  What I came up with
> is :
> 
> @Email[$ListPos] =  @Email[$ListPos] .= ":" ;
> 
> Now this adds a colon to the Front on each item
> so does:
> 
> @Email[$ListPos] =  @Email[$ListPos] . ":" ;
> 
> as well as this:
> 
> $Email[$ListPos] =  $Email[$ListPos] . ":" ;
> 
> So how can I add this colon to the the end of each item?
 ...
> Jtk
I don't follow what you are saying.  I assume the $ListPos is an index
which is iterating over the elements of your list?  If so, all the
statements you have above will put a : after wherever string is already
in each of the list elements.  For example, if $Email[0] is 'hi' and
$ListPos is 0, then $Email[0] will be 'hi:' after executing any of those
statements.  What do you mean that it puts a colon in *front* of the
string?  It puts it at the end of the string, the last character of the
string.  But why not just do:

   $Email[$ListPos].=':';

Note that the statements containing @Email[$ListPos] in various
capacities are relying upon one of Perl's DWIM things -- the @ should be
$, as it is a scalar, not a list, that is returned as the value of a
list element.

If you don't want to have to explicitly iterate over all the list
elements, try:

   @Email=map{$_.':'}@Email;
-- 
Bob Walton


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

Date: 19 Nov 2000 04:59:57 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: Perl spider performance
Message-Id: <974609967.337346@elaine.furryape.com>

In article <8v4dt80kr@enews4.newsguy.com>,
yo mamma <wigglybutt@hotmail.com> wrote:
>Mario wrote in message <8v41k7$202$1@nnrp1.deja.com>...
>>is Perl an acceptable choice for a web spider?
>>
>Yes, if it is compiled into a binary it is very fast.  There are excellent
>modules for every 'net related function you can think of, and regex's are

'Compiling' of perl doesn't make any difference to it's speed.



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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v7ccc$62n$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v7e4k$9r7$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v7fst$f5q$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v7hl5$k0l$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v7jdd$nr9$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v7l5l$rr8$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v7mtu$22v$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v7om8$5fj$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v7qeg$8o9$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v7s6u$c5q$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v7tv6$fja$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v7vne$i81$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Sun, 19 Nov 2000 05:40:34 GMT
From: dtbaker_dejanews@my-deja.com
Subject: Re: Problems saving an uploaded file.
Message-Id: <8v7p4i$oio$1@nnrp1.deja.com>

In article <8v7mtu$22v$1@newstoo.ericsson.se>,
  "Johan Ditmar" <johan.ditmar@era.ericsson.se> wrote:
> Hi all,
>
> I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I
have
> the following problem. I want to upload a file from a webpage and save
it at
> a server. I am using the following code to do that:
>
>    $bitfile = param("bitfile");
>
>    open (SAVE,">./bitfile.bit") || die $!;
>    binmode(SAVE);
>
>     while ( read($bitfile,$data,1024) ) {
>       print SAVE $data;
>     }
>    close SAVE;
>
> What it does is that it takes the file handle and then saves the
clients
> file under 'bitfile.bit' on the server.
>
> Sometimes this works, but many times it happens that the file is not
saved
> (it is created, but has size 0 or is only 1 byte long). I have enough
space
> on my disk and enough memory. Could this be a bug?
----------------

I think you have to binmode() both the incoming FH and the target FH. I
use a sub like this:

sub WriteUploadFile { my ( $FromFH , $ToPath ) = @_ ;

	# we are using this sub because we dont trust CGI:: to check
size

	# local vars
	my $bytesread ;
	my $buffer = "";
	my $flen = 0 ;

	open ( TARGETFILE , ">$ToPath" ) ;
	binmode( TARGETFILE );
	binmode( $FromFH  );
	$flen = 0 ;
	while ( $bytesread = read( $FromFH , $buffer , 1024 ) ) {
		print TARGETFILE $buffer ;
		$flen += 1024 ;
		if ( $flen > $CGI::POST_MAX ) { # check size here since
						# we cant count on CGI
to do it
			print "Content-type: text/plain \n\n".
			"FATAL ERROR - \n\n".
			"The file $FromFH \nthat you attempted to upload
".
			"is too big. \nOnly $CGI::POST_MAX kbytes are ".
			"allowed.  \n\n".
			"Please use your browser \"Back\" button and ".
			"resample, crop, or select a smaller file...\n";

			close $FromFH ;
			close TARGETFILE ;
			unlink $ToPath or die "could not delete working
file because $!" ;
			exit;
		}
	}
	close $FromFH ;
	close TARGETFILE ;
	chmod 0666, "$ToPath" ;

	unless (-f $ToPath ) { # something might have gone wrong during
the save
		die "FATAL ERROR - could not upload >$FromFH< to
>$ToPath< because $! \n";
	}
1;}


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


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

Date: Sun, 19 Nov 2000 03:08:43 +0100
From: not-for-mail@copyleft.de (Michael Koehne)
Subject: Re: simple question: can Perl do this? (talking to a permanent opened prog.)
Message-Id: <bnc7v8.c22.ln@bakunin.copyleft.de>

Kurt Stephens <kstep@pepsdesign.com> wrote something similar to :
#------------------------------------------------------------------------------#
# Build the lookup hash
my %translate = qw(
    un      one
    deux    two
    trois   three
    quatre  four
    cinq    five
);

# Build the search string, sorting DESCENDING BY LENGTH, so that
# big words match before little ones do.
my $keys = join '|', \
    sort { length($b) <=> length($a) } \
    map { $_ = "\Q$_\E" } \
    keys %translate;

# Perform a global substitution, matching on word boundaries
$foobar =~ s/\w($keys)\w/$translate{$1}/ge;

# > $1 fix), please disregard these ramblings.
# me to ;-)
#------------------------------------------------------------------------------#
  
  The best would be to code exactly this functionality into a powerful XS.
  I'm using this construct in many sources and I think that its typical.

Bye Michael
-- 
  mailto:kraehe@copyleft.de     	UNA:+.? 'CED+2+:::Linux:1.2:13'UNZ+1'
  http://www.xml-edifact.org/		CETERUM CENSEO MSDOS ESSE DELENDAM


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

Date: Sat, 18 Nov 2000 22:56:00 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: simple question: can Perl do this? (talking to a permanent opened prog.)
Message-Id: <slrn91ejqg.1gc.tadmc@magna.metronet.com>

On Sun, 19 Nov 2000 03:08:43 +0100, Michael Koehne 
   <not-for-mail@copyleft.de> wrote:
>Kurt Stephens <kstep@pepsdesign.com> wrote something similar to :


># Build the search string, sorting DESCENDING BY LENGTH, so that
># big words match before little ones do.

># Perform a global substitution, matching on word boundaries


You don't need descending by length if you have a trailing 
word boundary.


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


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

Date: Sun, 19 Nov 2000 06:06:02 GMT
From: dtbaker_dejanews@my-deja.com
Subject: STOP REPEATED POSTING! Re: Problems saving an uploaded file.
Message-Id: <8v7qk8$pet$1@nnrp1.deja.com>

I answered one of your many earlier threads.... please STOP re-posting.
D


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


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

Date: Sun, 19 Nov 2000 05:58:18 GMT
From: dtbaker_dejanews@my-deja.com
Subject: Re: System command, limit on number of ARGV?
Message-Id: <8v7q5p$p9t$1@nnrp1.deja.com>

I just ran into a "feature" of the system() command that I am not sure
how to deal with, so I thought I'd continue this thread on a related
topic if ya'll dont mind.

I have been using a script with lines like this:

my $SysCmd = "perl BuildGalleryPages.pl $RedirectTo @ImageList " ;
if ( $^O =~ m/mswin32/i ) {
	system( "start -m $SysCmd" ) == 0 or
                die "child error: ".$?/256 ;
} else {
	system( "$SysCmd" ) ;
}

which has worked ok until I put in too many @ImageList ... then the
system() command fails with "access denied."  I looked for some info on
what the limit of args passed might be, but didnt see anything.

Is there a limit?

Ideas on passing a large list? do I need to write a temp file or
something like that?

thanx,

dan


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


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

Date: Sun, 19 Nov 2000 18:31:19 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: System command, limit on number of ARGV?
Message-Id: <slrn91f0e7.dm.mgjv@martien.heliotrope.home>

On Sun, 19 Nov 2000 05:58:18 GMT,
	dtbaker_dejanews@my-deja.com <dtbaker_dejanews@my-deja.com> wrote:
> I just ran into a "feature" of the system() command that I am not sure
> how to deal with, so I thought I'd continue this thread on a related
> topic if ya'll dont mind.
> 
> I have been using a script with lines like this:
> 
> my $SysCmd = "perl BuildGalleryPages.pl $RedirectTo @ImageList " ;
> if ( $^O =~ m/mswin32/i ) {
> 	system( "start -m $SysCmd" ) == 0 or
>                 die "child error: ".$?/256 ;
> } else {
> 	system( "$SysCmd" ) ;
> }
> 
> which has worked ok until I put in too many @ImageList ... then the
> system() command fails with "access denied."  I looked for some info on
> what the limit of args passed might be, but didnt see anything.
> 
> Is there a limit?

That depends on your shell. You should probably see which sheel gets
invoked.

> Ideas on passing a large list? do I need to write a temp file or
> something like that?

That is a possibility. You can also set up IPC between this program and
the BuildGalleryPages.pl, or simply open a pipe and write to it:

open (PROGGIE, "| perl BuildGalleryPages.pl") or die "Can't fork: $!";
print "$_\n" foreach (@ImageList);
close(PROGGIE)                                or die "Can't close pipe: $!";

Of course, the BuildGalleries.pl program should accept input from STDIN,
and do things with that. 

It depends totally on your needs, and the amount of information you need
to convey. But I generally abandon passing large numbers of parameters
on command lines quite early on.

Of course, there are things like xargs, and you could try passing a list
to system, instead of a single string. As long as $RedirectTo doesn't
contain shell metacharacters, that should be fine.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | That's not a lie, it's a
Commercial Dynamics Pty. Ltd.   | terminological inexactitude.
NSW, Australia                  | 


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

Date: 19 Nov 2000 01:58:46 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: views and/or cursors with DBD::mysql ??
Message-Id: <974599089.230715@elaine.furryape.com>

In article <z%FR5.77$Uj7.128857@nnrp2.sbc.net>,
StevieD <stevie_d38nospam@hotmail.com> wrote:
>If i can use SELECT statements that'd be great; i just don't understand how
>to do 2 selects to create 2 recordsets, then be able to a SELECT for my
>desired output that refers to both recordsets (using an inner join and
>aggregate functions) ... If i can't store them in views or cursors, how can
>i reference them in my final SELECT statement?

Sounds like you 

1) Need to reconsider your choice of database. PostgreSQL supports both
views and cursors.
2) Go to a database group for your questions on SQL.


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

Date: Sat, 18 Nov 2000 20:28:11 -0600
From: "StevieD" <stevie_d38nospam@hotmail.com>
Subject: Re: views and/or cursors with DBD::mysql ??
Message-Id: <tTGR5.334$Uj7.145845@nnrp2.sbc.net>

1) MySQL is all i have to work with at this point, and i'm finding ways to
accomplish what i need in the documentation. These are specific workarounds
for SQL functionality currently lacking in MySQL.  However, when i use Perl
to send any of these through DBI and DBD::mysql, it's as if anything
proprietary to MySQL's flavor of SQL causes a syntax error in the DBD driver
(a CREATE TABLE as per mySQL docs in this case):

DBD::mysql::db do failed: You have an error in your SQL syntax near
'TEMPORARY TABLE IF NOT EXISTS temp1 SELECT * FROM testTable' at line 1 at
mysql_test.pl line 29.

2) This leads me to believe that where i'm missing the boat is not a SQL
issue as much as a DBI or DBD::mysql issue. Asking about these in a database
group would certainly have people sending me back here i would think.

I was just hoping someone in here has used MySQL from a Perl script before
and knows how to work with temporary tables.

-Steve

"Alan Barclay" <gorilla@elaine.furryape.com> wrote in message
news:974599089.230715@elaine.furryape.com...
> In article <z%FR5.77$Uj7.128857@nnrp2.sbc.net>,
>
> Sounds like you
>
> 1) Need to reconsider your choice of database. PostgreSQL supports both
> views and cursors.
> 2) Go to a database group for your questions on SQL.
>




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

Date: Sat, 18 Nov 2000 22:02:48 -0500
From: "Kurt Stephens" <kstep@pepsdesign.com>
Subject: Re: views and/or cursors with DBD::mysql ??
Message-Id: <8v7ft2$n3r$1@slb2.atl.mindspring.net>

"StevieD" <stevie_d38nospam@hotmail.com> wrote in message
news:tTGR5.334$Uj7.145845@nnrp2.sbc.net...
> 1) MySQL is all i have to work with at this point, and i'm finding ways to
> accomplish what i need in the documentation. These are specific
workarounds
> for SQL functionality currently lacking in MySQL.  However, when i use
Perl
> to send any of these through DBI and DBD::mysql, it's as if anything
> proprietary to MySQL's flavor of SQL causes a syntax error in the DBD
driver
> (a CREATE TABLE as per mySQL docs in this case):
>
> DBD::mysql::db do failed: You have an error in your SQL syntax near
> 'TEMPORARY TABLE IF NOT EXISTS temp1 SELECT * FROM testTable' at line 1 at
> mysql_test.pl line 29.

If you check the docs on MySQL CREATE TABLE, the TEMPORARY keyword doesn't
appear until version 3.23.  I suspect that your problem may not be with DBI,
but with an earlier version of MySQL.  If you have Telnet access to the
server, type the following at the command prompt:

mysql --version

If the version is under 3.23, the TEMPORARY TABLE IF NOT EXISTS syntax will
have to go.  You can always add a DROP TABLE when you're done with it.





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

Date: 19 Nov 2000 05:51:36 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: XSUB output strings
Message-Id: <8v7pp8$spc$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to eric <eric@urbanrage.com>]

I wrote in article <8v70es$l2d$1@charm.magnus.acs.ohio-state.edu>:
> In addition to what you listed, there is savepv() (which is a misnomer
> for copy_pv()) which may be used like this:
> 
>   void
>   newfunc(instring,outstring)
>      char *instring
>      char *outstring
>     CODE:
>      outstring = savepv(instring);
>     OUTPUT:
>      outstring

Unfortunately, this was a very unappropriate example.  Since the
simple

     CODE:
      outstring = instring;

would work, the code in the example will work too, but will result in
a memory leak.  (Nobody is going to free() outstring.)  savepv() is
used in other situations.

I did

  pfind -alllines .cpan/build/ '=~ /\bsavepvn?\b/'

and the only example I could find was in Term::ReadLine::Gnu - which
tries to work around some bugs with dynaloading on Solaris.
Basically, you want to put the result of savepv(s) into some some *C*
"global" storage, not Perl storage.

Ilya


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

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


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