[22274] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4495 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 31 11:11:36 2003

Date: Fri, 31 Jan 2003 08:10:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 31 Jan 2003     Volume: 10 Number: 4495

Today's topics:
        Oracle DBD <roymain@sbcglobal.net>
    Re: Perl Operations (Helgi Briem)
    Re: Perl Operations <flavell@mail.cern.ch>
    Re: Perl Operations <barbr-en@online.no>
    Re: problem 'chomp' ing shell command's output <thens@nospam.com>
    Re: regular expression / matching (agape)
    Re: Search a text <simon.oliver@umist.ac.uk>
        sending binary files from server to client <hugo@geoinformex.com>
    Re: sending binary files from server to client <simon.oliver@nospam.umist.ac.uk>
    Re: sending binary files from server to client <hugo@geoinformex.com>
    Re: sending binary files from server to client <tassilo.parseval@post.rwth-aachen.de>
    Re: sending binary files from server to client <simon.oliver@nospam.umist.ac.uk>
    Re: sending binary files from server to client <steven.smolinski@sympatico.ca>
    Re: Tie::IxHash Andrew Lee
        User Quota as a %. (Andrew McCall)
    Re: User Quota as a %. <tassilo.parseval@post.rwth-aachen.de>
    Re: Why is this script sending 0 byte file attachments? (Jay Tilton)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 31 Jan 2003 13:41:25 GMT
From: "roym" <roymain@sbcglobal.net>
Subject: Oracle DBD
Message-Id: <92v_9.67$5S1.75836517@newssvr11.news.prodigy.com>

Hello everyone,

I have seen some related emails in the archives about the Oracle DBD driver,
but they still don't quite answer my questions.  I am simply trying to talk
to an Oracle database on another server using my Perl script.

Am I correct that in order to build the driver, you must have Oracle
installed on your server?  The DBD readme simply states that you must have
Oracle at least *partially* installed.  How much is partially?  Will
installing an Oracle client be enough to build the driver?  I don't know
enough about Oracle for the DBD docs to be of much help....

I don't have a copy of Oracle.  Are there some places where I can download
Oracle DBDs that are already compiled?

What other ways could I use to talk to the Oracle database from my Perl
script?  Could I use an ODBC driver for Linux?

Thanks & Regards,
roy






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

Date: Fri, 31 Jan 2003 11:12:40 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Perl Operations
Message-Id: <3e3a58e4.154549340@news.cis.dfn.de>

On Thu, 30 Jan 2003 22:21:16 -0600, Abernathey Family
<family2@aracnet.com> wrote:


>> It is a Question that is Asked Frequently.
>> 
>> > but does anyone have a link to a
>> > list of Perl modules, and there uses / definitions?
>> 
>>    perldoc -q module

>Do you suppose that it is possible that this person doesn't 
>have access to Unix at the moment?

So what?  Perldoc works just fine under Windows.
I use it every day.  I believe it works just fine under
MacOS and VMS too, in case he's an eccentric.

Further, the exhortation to look up perldoc X, is
shorthand to look up X in the standard Perl 
documentation that comes standard with every
Perl installation.  It can be browsed and searched
with all kinds of tools, although the perldoc program
is bundled for that purpose.  On Activestate Perl
installations a copy of it is found in HTML format
under C:/Perl/html/ and it can be read online
at http://www.perldoc.com 


-- 
Regards, Helgi Briem
helgi AT decode DOT is


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

Date: Fri, 31 Jan 2003 12:17:50 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Perl Operations
Message-Id: <Pine.LNX.4.53.0301311214530.1624@lxplus070.cern.ch>

On Jan 30, Abernathey Family inscribed on the eternal scroll:

> Do you suppose that it is possible that this person doesn't have access
> to Unix at the moment?
> <gag>

I thought I'd plonked you before for stupidity beyond the normal call
of duty.

When usenet becomes a substitute for access to documentation, we may
as well all resign.  "Access to Unix", piffle.


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

Date: Fri, 31 Jan 2003 13:04:02 +0100
From: Kåre Olai Lindbach <barbr-en@online.no>
Subject: Re: Perl Operations
Message-Id: <c2ok3vo7noknl50hn5jdv74ua50fi8sq3k@4ax.com>

On Fri, 31 Jan 2003 11:12:40 GMT, helgi@decode.is (Helgi Briem) wrote:


>On Activestate Perl
>installations a copy of it is found in HTML format
>under C:/Perl/html/ ...

If you're using AS Perl under _MS OS_, and then maybe usually ;-)

Mine on a MS OS is under D:\        :-)

(I tend to think like this on MS-OS: C:(S)ystem and related, useful
D:ata and applications, E:xtra, like downloads, testing and
speciality.)

But your point about that if you have installed AS Perl, then you have
a lot of info both using perldoc and/or browsing the
HTML-formatted-files withstands .......

-- 
mvh/Regards
Kåre Olai Lindbach


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

Date: Fri, 31 Jan 2003 14:51:59 +0530
From: Thens <thens@nospam.com>
Subject: Re: problem 'chomp' ing shell command's output
Message-Id: <20030131145159.616253fd.thens@nospam.com>

On Thu, 30 Jan 2003 15:20:36 -0600
tadmc@augustmail.com (Tad McClellan) wrote:

> 
> >  What is that iam doing wrong here ??
> 
> 
> Not reading the documentation for the function you are using.
> 
>    perldoc -f chomp
> 
>       It returns the total number of characters removed from 
>       all its arguments.
>       ...
>       If you chomp a list, each element is chomped
> 
> 
> Inside of the map block it removes one character from $_, and
> returns 1, so a bunch of ones is what you get back from the map.
>
   Thanks Ted, Next time I will make sure that i read the doc when i run
into trouble. It was a case of assuming things.. Sorry


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


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

Date: 31 Jan 2003 07:11:09 -0800
From: bionic_man1@yahoo.com (agape)
Subject: Re: regular expression / matching
Message-Id: <3e5aae09.0301310711.7894be23@posting.google.com>

-b /my_directory/file.m,v -m 100 -f -s direcotry -ex "-m file"
-b /his_directory/file3.m, -m 90000 -n -s direcotry_650 -ex "-m file8"
-b /her_directory/file4.m -m 100 -f -s direcotry -ex "-m file_908"

The above is an example of three records on that file that I am
parsing.
I want to be able to parse. I want to keep the integrity of ".m,v" and
".m," and ".m" as they are so is there a reg exp that I can use that
parses the argument that is passed to "-b" option above and keeps the
file extensions as they are.

Intention is to parse each record(here is three of them)
replace -b with blank which is easy
leave the argument to -b untouched (this is what fails)meaning if I
do:
$captured_test =~ s/-b//; Then the script ignores everything including
other arguments and leave me with this:
/my_directory/file.m
/his_directory/file3.m
/her_directory/file4.m

Agape


anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message news:<b1c9mm$kop$1@mamenchi.zrz.TU-Berlin.DE>...
> agape <bionic_man1@yahoo.com> wrote in comp.lang.perl.misc:
> > Thanks those who helped in the following search:
> > 
> > I have a file with thousands of records as such:
>                                ^^^^^^^
> > -term1 /my/home/directory -term2 a.v -term3 15000 -last "var1 var2
> > var3 var4" -t4 /my/current/  -last_one "variable1 variable2" -term4
> > xyz
> 
> You don't say how to tell one record from another.  I'll assume each
> record is on one line and you have broken the data for Usenet.  If
> you do that, please say so.
> 
> > The above could be in any order but any switch(-term1 or -term2 or
> > -last and so forth) is followed by a value of some sort. 
> > 
> > on one of the field say :  -b abcdev.m,v  I am trying to capture the
> > value that is passed to "-b" and remove the "-b" itself.  so the
> > result should be abcdev.m,v
> > 
> > My script works if I have:
> > 
> > $captured_test =~ s/-b//;
> > But, once it sees ",v" at the end of abcdev.m,v , then it ignores the
> > rest of the record or entry. Any idea?
> 
> I don't see how the comma (with or without "v") should be a problem.
> 
> Your main problem are the embedded blanks in quoted strings, which
> are apparently supposed to be treated as a unit.  You'll want to use
> Text::ParseWords from the standard distribution for that, but also
> see the faq "perldoc -q 'except when inside'".
> 
> This will give you a list (say @terms) of alternately a keyword (with
> leading "-") and a value (possibly multi-word).  This is for well-formed
> input.
> 
> Your next step will be to make the keyword-value associations (a hash
> suggests itself).  Assuming good input, this is as simple as
> 
>     my %values = @terms;
> 
> If you must check things, do it step-wise, working on a pair a time
> 
>     my %values;
>     while ( @terms ) {
>         my $key = shift @terms;
>         die "bad keyword" unless $key =~ /^-/; # or whatever
>         die "short data" unless @terms;
>         my $value = shift @terms;
>         # further checks
>         # ...
>         $values{ $key} = $value;
>     }
> 
> If you actually need the string of all values without the keys...,
> well, I guess if you're at this point, you'll probably see for
> yourself how to get it.
> 
> Anno


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

Date: Fri, 31 Jan 2003 08:31:57 +0000
From: Simon Oliver <simon.oliver@umist.ac.uk>
To: Djm <dmuren@start.no>
Subject: Re: Search a text
Message-Id: <3E3A347D.8090504@umist.ac.uk>

Djm wrote:
> The format of my bible is a plain text file.
> gen1:2 Bla bla bla bla
>             bla lba bla
> gen1:3 bla bla
> gen1:4 bla bla bla
> bla bla bal
> gen1:5
> 
Are all books represented by precicely three characters?

If so you can find the start of a verse with a match like so
   if ($line =~ /^\s*(\w{3}\d+:\d+)\s+(.*)/)

And now $1 contains the reference and $2 the text.

> As you can see the text in each verse is not just on one line, so I need to
> find a way to print out one verse at a time - any verse.

You need to detect the end of the verse, which is either the end of the 
file or the next verse.

my ($search, $found, $verse);
$search = 'gen1:2';

while (<DATA>)
{
   if (/^\s*(\w{3}\d+:\d+)\s*(.*)/)
   {
     last if $found;
     next if $1 ne $search;
     $found = $1;
     $verse = $2;
   }
   elsif ($found)
   {
     $verse .= $_;
   }
}
print $found ? "Reference: $found\nVerse: $verse\n"
              : "Can't find verse: $search\n";

__DATA__
gen1:2 Bla bla bla bla
        bla lba bla
gen1:3 bla bla
gen1:4 bla bla bla
bla bla bal
gen1:5

Of course if you are doing many searches this is really inefficient and 
you should consider converting to a DBM type file and using a tied hash 
interface.



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

Date: Fri, 31 Jan 2003 16:02:48 +0800
From: hugo <hugo@geoinformex.com>
Subject: sending binary files from server to client
Message-Id: <3E3A2DA8.3030103@geoinformex.com>

Hi

I would like to mail an excel file (which has been created on a web 
server) to the user who created it. I thought I would make a form which 
has sender's mail address, recipient's mail address and a field to get 
the file. I assume that, as the file resides on the server, it is 
available to be sent from the server to the client's email address as an 
attachment.

However, it does not work. Am I getting it fundamentally wrong in the 
way I want to send this file? Note that the excel file is binary, and 
perhaps that is an added complication?

Any help will be greatly appreciated.

Thanks

Hugo

I have the following code:

***
use CGI::Carp qw(fatalsToBrowser);
$query = new CGI;
use MIME::Lite;

#----------------------------------------------------------------------------

&print_page_header;
&mail_excel;
&print_page_end;

sub print_page_header {
	print $query->header;
	}

sub print_page_end {
	print "</body></html>"
}

sub mail_excel {

print "<p><font size=+3 color=#990099><b>Geoinformatics Exploration 
Timesheets</b></font>";
print "<html><head><title>Mail Excel File</title>\n</head>\n<body>\n";
print "<p><font size=+2 color=#550000><b>Mail Excel File </b></font>";
print "<FORM METHOD=\"POST\" ENCTYPE=\"multipart/form-data\" 
ACTION=\"http://www.geoinformex.com/cgi-geo/g_mail_excel.pl\">\n";
print "<p><font size+1 color=#FF0000><b>From:</font></b><br>\n";
print "<INPUT TYPE=\"TEXT\" NAME=\"from\" 
VALUE=\"".$query->param('from')."\" SIZE=\"20\">\n";
print "<p><font size+1 color=#FF0000><b>To:</font></b><br>\n";
print "<INPUT TYPE=\"TEXT\" NAME=\"to\" 
VALUE=\"".$query->param('from')."\" SIZE=\"20\">\n";
print "<p><font size+1 color=#FF0000><b>Excel File:</font></b><br>\n";
print "<INPUT TYPE=\"Text\" NAME=\"excel\" SIZE=\"20\">\n";
print "<INPUT TYPE=\"SUBMIT\" VALUE=\"Mail\"></p>";
print "</FORM><br><br>\n";

if ($user = $query->param('from') ) {

$from = $query->param('from');
$to = $query->param('to');
$excel = $query->param('excel');
$subject = "sending excel file";

my $msg = MIME::Lite->new(From    => $from,
                           To      => $to,
                           Subject => $subject,
                           Type    => 'multipart/mixed')
     or die "PROBLEM opening MIME object: $!";

$msg->attach(Type        => 'application/vnd.ms-excel',
              Disposition => 'attachment',
              Data        => $excel,
              Filename    => $excel')
     or die "PROBLEM attaching Excel file: $!";

$msg->send() or die "PROBLEM sending MIME mail: $!";

print "Sent $name!\n";
  }
}

exit;



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

Date: Fri, 31 Jan 2003 08:44:23 +0000
From: Simon Oliver <simon.oliver@nospam.umist.ac.uk>
To: hugo <hugo@geoinformex.com>
Subject: Re: sending binary files from server to client
Message-Id: <3E3A3767.6030105@nospam.umist.ac.uk>

hugo wrote:
> Hi
> 
> I would like to mail an excel file (which has been created on a web 
> server) to the user who created it. I thought I would make a form which 
> has sender's mail address, recipient's mail address and a field to get 
> the file. I assume that, as the file resides on the server, it is 
> available to be sent from the server to the client's email address as an 
> attachment.
> 


>              Data        => $excel,
>              Filename    => $excel')

Is $excel a filename or the file data? Try using Path instead of Data.

Before sending the file I'd make sure that it exists using (-e) and you 
will probably want to put some security steps in such as basing all 
filepaths on a virtual root to prevent clients asking for something you 
don't want them to have.

What is the error - you just said it didn't work.

-- 
   Simon Oliver



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

Date: Fri, 31 Jan 2003 17:18:49 +0800
From: hugo <hugo@geoinformex.com>
Subject: Re: sending binary files from server to client
Message-Id: <3E3A3F79.8080902@geoinformex.com>

Hi Simon

Actually the mail is sent - what doesn't work is that the file 
attachment does not contain anything.

Thanks

Hugo

Simon Oliver wrote:
> hugo wrote:
> 
>> Hi
>>
>> I would like to mail an excel file (which has been created on a web 
>> server) to the user who created it. I thought I would make a form 
>> which has sender's mail address, recipient's mail address and a field 
>> to get the file. I assume that, as the file resides on the server, it 
>> is available to be sent from the server to the client's email address 
>> as an attachment.
>>
> 
> 
>>              Data        => $excel,
>>              Filename    => $excel')
> 
> 
> Is $excel a filename or the file data? Try using Path instead of Data.
> 
> Before sending the file I'd make sure that it exists using (-e) and you 
> will probably want to put some security steps in such as basing all 
> filepaths on a virtual root to prevent clients asking for something you 
> don't want them to have.
> 
> What is the error - you just said it didn't work.
> 



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

Date: 31 Jan 2003 09:57:40 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: sending binary files from server to client
Message-Id: <b1dhak$qd7$1@nets3.rz.RWTH-Aachen.DE>

I can't comment on your actual problem, but on something else that shows
a misconception you have about error handling.

Also sprach hugo:

> I would like to mail an excel file (which has been created on a web 
> server) to the user who created it. I thought I would make a form which 
> has sender's mail address, recipient's mail address and a field to get 
> the file. I assume that, as the file resides on the server, it is 
> available to be sent from the server to the client's email address as an 
> attachment.

[...]

> my $msg = MIME::Lite->new(From    => $from,
>                            To      => $to,
>                            Subject => $subject,
>                            Type    => 'multipart/mixed')
>      or die "PROBLEM opening MIME object: $!";
> 
> $msg->attach(Type        => 'application/vnd.ms-excel',
>               Disposition => 'attachment',
>               Data        => $excel,
>               Filename    => $excel')
>      or die "PROBLEM attaching Excel file: $!";

While it might be possible that 'MIME::Lite->new()' and '$msg->attach'
return a false value, they certainly don't set $!. $! is Perl's
equivalent to 'extern int errno' from <errno.h> which is only set on
certain operations relating to system-calls (such as opening files,
doing a read(2) or a write(2) etc).

So don't deduce from something like

    open F, "file" or die $!;

that this idiom can be used anywhere. This can be misleading because
using $! in inappropriate places can give you a completely meaningless
error-message.

> $msg->send() or die "PROBLEM sending MIME mail: $!";

Using $! _could_ be ok here though since sending a message is likely to
involve system-calls. Howver, the MIME::Lite docs don't mention it (but
that could just be an omission).

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Fri, 31 Jan 2003 13:46:58 +0000
From: Simon Oliver <simon.oliver@nospam.umist.ac.uk>
Subject: Re: sending binary files from server to client
Message-Id: <3E3A7E52.5050802@nospam.umist.ac.uk>

hugo wrote:
> Hi Simon
> 
> Actually the mail is sent - what doesn't work is that the file 
> attachment does not contain anything.
> 
As I said, you are specifying $excel as both the filename and the data - 
it can't be both!

Also, as Tassilo pointed out - you need to take more care with your 
error checking.  Make sure the requested file exists!

-- 
   Simon Oliver



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

Date: Fri, 31 Jan 2003 14:51:45 GMT
From: Steven Smolinski <steven.smolinski@sympatico.ca>
Subject: Re: sending binary files from server to client
Message-Id: <54w_9.5128$nD1.1162715@news20.bellglobal.com>

hugo <hugo@geoinformex.com> wrote:
> I would like to mail an excel file (which has been created on a web
> server) to the user who created it. I thought I would make a form
> which has sender's mail address, recipient's mail address and a field
> to get the file.

If you take a recipient address and a file upload, and just send the
file out, you are creating a type of mail relay.  This sort of thing, if
left open to the public, could be (ab)used by spammers or others to send
unsolicited/harassing mail to third parties.

I just raise the issue in hopes you secure this page properly.

Steve
-- 
Steven Smolinski => http://arbiter.ca/ GnuPG Public Key =>
http://arbiter.ca/steves_public_key.txt => or email me with 'auto-key'
in the subject.  Key Fingerprint  => 08C8 6481 3A7B 2A1C 7C26  A5FC 1A1B
66AB F637 495D


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

Date: Fri, 31 Jan 2003 10:10:54 -0500
From: Andrew Lee
Subject: Re: Tie::IxHash
Message-Id: <k94l3vg0gh296oki3p5k9haf2p99j0kdap@4ax.com>

On 30 Jan 2003 23:10:31 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

>Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote in comp.lang.perl.misc:
>> Also sprach Benjamin Goldberg:
>
>[discussion snipped]
> 
>> I wonder whether -w and strict has made me a more careless programmer. I
>> don't spend much time on 'correctness' (with respect to typos) in my
>> code any longer because it's so convenient to have Perl spot it for me.
>
>I don't think it's necessarily bad.  Attention-paying is a limited
>resource much in demand in a programming task.  If relaxing on the
>trivial typos helps focusing on the parts that need attention that's a
>good thing.
>
>Most trivial typos are indeed immediately detected and precisely
>located by Perl, so they're equally trivial to correct.  The most
>notable exception is a missing ";", which sometimes takes a bit to
>find; misplaced or missing ',' is probably second.

I spent an hour the other day shotgun debugging because I had something
like this :

foo(a => "b" . c => "d", e => "f");

*grumble*



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

Date: 31 Jan 2003 01:17:44 -0800
From: it.andrew.mccall@oldham.gov.uk (Andrew McCall)
Subject: User Quota as a %.
Message-Id: <acc5b949.0301310117.6c1617c5@posting.google.com>

Hi All,

I have built a pretty cool virtual hosting web server for all the
schools in the area I live in and its being offered to them as a free
service.  Each user on the system has 500Mb quota, and I am now trying
to write a quick and easy perl script that will give me the % used of
their quota so that I can display this on a web page.

Does anyone know how I can do this? I know about the quota command,
but I can't seem to get this to return a %.  I was thinking that I
might be able to use Perl to modify the output from quota to make a %.

If I use quota for user greenacres I get this output :

whale:/ # quota -u greenacres
Disk quotas for user greenacres (uid 1000):
     Filesystem  blocks   quota   limit   grace   files   quota  
limit   grace
      /dev/sda2    8490       0  500000              10       0      
0

Presuming I know the username, how can I get the % they have used? I
am not bothered about the HTML (I don't do the web design, I just have
to sort the scripts out for the web designers), all I basically want
is an number to be returned from a script.

Thanks

Andrew McCall


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

Date: 31 Jan 2003 10:05:40 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: User Quota as a %.
Message-Id: <b1dhpk$qsm$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Andrew McCall:

> I have built a pretty cool virtual hosting web server for all the
> schools in the area I live in and its being offered to them as a free
> service.  Each user on the system has 500Mb quota, and I am now trying
> to write a quick and easy perl script that will give me the % used of
> their quota so that I can display this on a web page.
> 
> Does anyone know how I can do this? I know about the quota command,
> but I can't seem to get this to return a %.  I was thinking that I
> might be able to use Perl to modify the output from quota to make a %.
> 
> If I use quota for user greenacres I get this output :
> 
> whale:/ # quota -u greenacres
> Disk quotas for user greenacres (uid 1000):
>      Filesystem  blocks   quota   limit   grace   files   quota  
> limit   grace
>       /dev/sda2    8490       0  500000              10       0      
> 0
> 
> Presuming I know the username, how can I get the % they have used? I
> am not bothered about the HTML (I don't do the web design, I just have
> to sort the scripts out for the web designers), all I basically want
> is an number to be returned from a script.

You don't need to parse all this yourself. Instead install the Quota
module from the CPAN. 'Quota::query("/dev/sda2", $uid)' will return a
list of values from which you should easily be able to calculate this
percentage for the given $uid yourself.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Fri, 31 Jan 2003 10:42:34 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Why is this script sending 0 byte file attachments?
Message-Id: <3e3a4c03.38337570@news.erols.com>

tararse@hotmail.com (Tara) wrote:

: Hello, this script is passing the uploaded files as 0 bytes... can
: someone see what I am doing wrong here?

[...]
:     foreach ( $query->param ) {
:         if ( $query->param($_) ) {    ##     The user entered some value!!
:             if (/^file_attached_[A-Z]$/) {    ##     The uploaded file!!
:                 ++$no_of_files;
:                 push ( @list, $_ );
:             }
:             else {
:                 ##     One of the other items (Sender's Name, Sender's Email, etc...).
:                 ##     Store the value in a variable.
:                 ##     The name of the variable is the same as the HTML form element name
:                 ##     Eg if the HTML element is called name_sender, the PERL
:                 ##     variable will be called $name_sender.
:                 $$_ = $query->param($_);
:             }
:         }
:     }
:     open( MAIL, "| $mailprog -t " );
[...]

No taint checks, no input validation, all package variables, and
symbolic references being used to give any variable under the sun a
value from user input.

It is not exaggeration to call this program a ticking time bomb.



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 4495
***************************************


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