[18312] in Perl-Users-Digest
Perl-Users Digest, Issue: 480 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 13 14:11:05 2001
Date: Tue, 13 Mar 2001 11:10:44 -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: <984510644-v10-i480@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 13 Mar 2001 Volume: 10 Number: 480
Today's topics:
CGI module on file upload <ydzhang@iastate.edu>
Re: CGI module on file upload <dcsa@eci.esys.com>
Re: CGI module on file upload <joe+usenet@sunstarsys.com>
Re: CGI module on file upload <ydzhang@iastate.edu>
Re: CGI module on file upload <ydzhang@iastate.edu>
Re: CGI module on file upload <ydzhang@iastate.edu>
Re: CGI module on file upload <ydzhang@iastate.edu>
Re: CGI module on file upload (Malcolm Dew-Jones)
converting text to hex? <mail@ericmarques.net>
Re: converting text to hex? <ciaran.mccreesh@useaddressbelow.please>
Re: converting text to hex? <b_nospam_ill.kemp@wire2.com>
Re: converting text to hex? <mail@ericmarques.net>
Re: converting text to hex? <ciaran.mccreesh@useaddressbelow.please>
Re: converting text to hex? <mail@ericmarques.net>
Re: converting text to hex? <ciaran.mccreesh@useaddressbelow.please>
Re: converting text to hex? <mail@ericmarques.net>
Re: CPAN Question <meisterplan@t-online.de>
Re: Does a merge function exist? (Monte)
Re: Does a merge function exist? <lfoss@myxa.com>
file upload problem in 5.6 <dcsa@eci.esys.com>
Re: file upload problem in 5.6 <joe+usenet@sunstarsys.com>
Re: file upload problem in 5.6 <dcsa@eci.esys.com>
Re: file upload problem in 5.6 nobull@mail.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 13 Mar 2001 09:06:58 -0600
From: YD <ydzhang@iastate.edu>
To: ydzhang@iastate.edu
Subject: CGI module on file upload
Message-Id: <3AAE3792.4D124639@iastate.edu>
Hi,
a question regarding CGI.pm module.
I try to upload a text file via web form and use CGI perl module to
parse the submission.
in web form, a entry set as :
<INPUT TYPE="file" NAME="upfile" enctype="multipart/form
-data">
or
<INPUT TYPE="file" NAME="upfile">
In my cgi file, I use
use CGI qw/:standard/;
$query =new CGI;
print $query->header;
#print"Content-type:text/html\n\n";
$name = $query->param('name');
$email = $query->param('email');
$marker = $query->param('marker');
$upfile = $query->param('upfile');
....
The returned 'upfile' value is the file name and its path. However, when
I use this as file handle, it is empty.
tried this and did not print anything
while (<$upfile>) {
print "## $_<br>\n";
}
then, tried to manupilate the file handle by
$upfile = "main::$upfile";
the file handle is empty again.
Can someone help me fix this?
Thanks,
Yuandan
------------------------------
Date: Tue, 13 Mar 2001 10:38:05 -0500
From: Darhl Stultz <dcsa@eci.esys.com>
Subject: Re: CGI module on file upload
Message-Id: <3AAE3EDC.2599CBB3@eci.esys.com>
When I was researching the file upload problem in the post ahead of yours I
found this info that you might be able to use...
There are two definitions in CGI.pm for $POST_MAX and $DISABLE_UPLOADS (in
subroutine initialize_globals() ) You can reset them in your program
thusly:
$CGI::POST_MAX = 1024 * 100; # max 100K posts
$CGI::DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
dc
YD wrote:
> Hi,
> a question regarding CGI.pm module.
>
> I try to upload a text file via web form and use CGI perl module to
> parse the submission.
> in web form, a entry set as :
> <INPUT TYPE="file" NAME="upfile" enctype="multipart/form
> -data">
> or
> <INPUT TYPE="file" NAME="upfile">
>
> In my cgi file, I use
>
> use CGI qw/:standard/;
> $query =new CGI;
> print $query->header;
> #print"Content-type:text/html\n\n";
>
> $name = $query->param('name');
> $email = $query->param('email');
> $marker = $query->param('marker');
> $upfile = $query->param('upfile');
>
> ....
> The returned 'upfile' value is the file name and its path. However, when
> I use this as file handle, it is empty.
> tried this and did not print anything
>
> while (<$upfile>) {
> print "## $_<br>\n";
> }
>
> then, tried to manupilate the file handle by
>
> $upfile = "main::$upfile";
>
> the file handle is empty again.
>
> Can someone help me fix this?
>
> Thanks,
> Yuandan
------------------------------
Date: 13 Mar 2001 10:55:45 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: CGI module on file upload
Message-Id: <m3bsr5acji.fsf@mumonkan.sunstarsys.com>
YD <ydzhang@iastate.edu> writes:
> I try to upload a text file via web form and use CGI perl module to
> parse the submission.
> in web form, a entry set as :
> <INPUT TYPE="file" NAME="upfile" enctype="multipart/form
> -data">
Huh? enctype is a <form> attribute- how does your <form> tag read?
> or
> <INPUT TYPE="file" NAME="upfile">
>
> In my cgi file, I use
>
> use CGI qw/:standard/;
> $query =new CGI;
> print $query->header;
> #print"Content-type:text/html\n\n";
>
> $name = $query->param('name');
> $email = $query->param('email');
> $marker = $query->param('marker');
> $upfile = $query->param('upfile');
Not using strict, are you? Bad idea.
> ....
> The returned 'upfile' value is the file name and its path. However, when
> I use this as file handle, it is empty.
> tried this and did not print anything
>
> while (<$upfile>) {
> print "## $_<br>\n";
> }
>
> then, tried to manupilate the file handle by
>
> $upfile = "main::$upfile";
^^^^^^^^^^^^^^^^^^^^^^^^^^
What do you expect this to do?
--
Joe Schaefer "Language is the dress of thought."
-- Samuel Johnson
------------------------------
Date: Tue, 13 Mar 2001 12:13:35 -0600
From: YD <ydzhang@iastate.edu>
To: Darhl Stultz <dcsa@eci.esys.com>
Subject: Re: CGI module on file upload
Message-Id: <3AAE634F.6DD2828F@iastate.edu>
I have changed the definitions for
$POST_MAX = 1024 * 100; # max 100K posts
$DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
in CGI.pm
the perl script print out the values for thw two variables, but the filehandle
is still empty,
Any futher suggestion? is there anything to do with my web server and broswer?
Yuandan
#!/usr/bin/perl
use CGI qw/:standard/;
#use CGI::Carp 'fatalsToBrowser';
#$CGI::POST_MAX = 1024 * 100; # max 100K posts
#$CGI::DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
$query =new CGI;
print $query->header;
#print"Content-type:text/html\n\n";
$name = $query->param('name');
$email = $query->param('email');
$marker = $query->param('marker');
$chromosome = $query->param('chromosome');
$upfile = $query->param('upfile');
print $query->start_html(-title=>'Gneotype Submission for BY family',
-BGCOLOR=>'blue');
print $query->hr;
print $query->end_html;
print "$name\n<br>";
print "$email\n<br>";
print "$marker\n<br>";
print "$chromosome\n<br>";
print $query->hr;
print "$upfile\n";
#$upfile = "main::$upfile";
print "<BR> $upfile\n";
while (<$upfile>) {
print "$_<br>\n";
}
print $query->end_html;
print "$CGI::POST_MAX\n<br>";
print "$CGI::DISABLE_UPLOADS\n<br>";
exit 0;
Darhl Stultz wrote:
> When I was researching the file upload problem in the post ahead of yours I
> found this info that you might be able to use...
>
> There are two definitions in CGI.pm for $POST_MAX and $DISABLE_UPLOADS (in
> subroutine initialize_globals() ) You can reset them in your program
> thusly:
>
> $CGI::POST_MAX = 1024 * 100; # max 100K posts
> $CGI::DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
>
> dc
>
> YD wrote:
>
> > Hi,
> > a question regarding CGI.pm module.
> >
> > I try to upload a text file via web form and use CGI perl module to
> > parse the submission.
> > in web form, a entry set as :
> > <INPUT TYPE="file" NAME="upfile" enctype="multipart/form
> > -data">
> > or
> > <INPUT TYPE="file" NAME="upfile">
> >
> > In my cgi file, I use
> >
> > use CGI qw/:standard/;
> > $query =new CGI;
> > print $query->header;
> > #print"Content-type:text/html\n\n";
> >
> > $name = $query->param('name');
> > $email = $query->param('email');
> > $marker = $query->param('marker');
> > $upfile = $query->param('upfile');
> >
> > ....
> > The returned 'upfile' value is the file name and its path. However, when
> > I use this as file handle, it is empty.
> > tried this and did not print anything
> >
> > while (<$upfile>) {
> > print "## $_<br>\n";
> > }
> >
> > then, tried to manupilate the file handle by
> >
> > $upfile = "main::$upfile";
> >
> > the file handle is empty again.
> >
> > Can someone help me fix this?
> >
> > Thanks,
> > Yuandan
------------------------------
Date: Tue, 13 Mar 2001 12:13:17 -0600
From: YD <ydzhang@iastate.edu>
To: Darhl Stultz <dcsa@eci.esys.com>
Subject: Re: CGI module on file upload
Message-Id: <3AAE633D.BC0B9E2A@iastate.edu>
I have changed the definitions for
$POST_MAX = 1024 * 100; # max 100K posts
$DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
in CGI.pm
the perl script print out the values for thw two variables, but the filehandle
is still empty,
Any futher suggestion? is there anything to do with my web server and broswer?
Yuandan
#!/usr/bin/perl
use CGI qw/:standard/;
#use CGI::Carp 'fatalsToBrowser';
#$CGI::POST_MAX = 1024 * 100; # max 100K posts
#$CGI::DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
$query =new CGI;
print $query->header;
#print"Content-type:text/html\n\n";
$name = $query->param('name');
$email = $query->param('email');
$marker = $query->param('marker');
$chromosome = $query->param('chromosome');
$upfile = $query->param('upfile');
print $query->start_html(-title=>'Gneotype Submission for BY family',
-BGCOLOR=>'blue');
print $query->hr;
print $query->end_html;
print "$name\n<br>";
print "$email\n<br>";
print "$marker\n<br>";
print "$chromosome\n<br>";
print $query->hr;
print "$upfile\n";
#$upfile = "main::$upfile";
print "<BR> $upfile\n";
while (<$upfile>) {
print "$_<br>\n";
}
print $query->end_html;
print "$CGI::POST_MAX\n<br>";
print "$CGI::DISABLE_UPLOADS\n<br>";
exit 0;
Darhl Stultz wrote:
> When I was researching the file upload problem in the post ahead of yours I
> found this info that you might be able to use...
>
> There are two definitions in CGI.pm for $POST_MAX and $DISABLE_UPLOADS (in
> subroutine initialize_globals() ) You can reset them in your program
> thusly:
>
> $CGI::POST_MAX = 1024 * 100; # max 100K posts
> $CGI::DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
>
> dc
>
> YD wrote:
>
> > Hi,
> > a question regarding CGI.pm module.
> >
> > I try to upload a text file via web form and use CGI perl module to
> > parse the submission.
> > in web form, a entry set as :
> > <INPUT TYPE="file" NAME="upfile" enctype="multipart/form
> > -data">
> > or
> > <INPUT TYPE="file" NAME="upfile">
> >
> > In my cgi file, I use
> >
> > use CGI qw/:standard/;
> > $query =new CGI;
> > print $query->header;
> > #print"Content-type:text/html\n\n";
> >
> > $name = $query->param('name');
> > $email = $query->param('email');
> > $marker = $query->param('marker');
> > $upfile = $query->param('upfile');
> >
> > ....
> > The returned 'upfile' value is the file name and its path. However, when
> > I use this as file handle, it is empty.
> > tried this and did not print anything
> >
> > while (<$upfile>) {
> > print "## $_<br>\n";
> > }
> >
> > then, tried to manupilate the file handle by
> >
> > $upfile = "main::$upfile";
> >
> > the file handle is empty again.
> >
> > Can someone help me fix this?
> >
> > Thanks,
> > Yuandan
------------------------------
Date: Tue, 13 Mar 2001 12:14:53 -0600
From: YD <ydzhang@iastate.edu>
To: Darhl Stultz <dcsa@eci.esys.com>, ydzhang@iastate.edu
Subject: Re: CGI module on file upload
Message-Id: <3AAE639D.E297C338@iastate.edu>
I have changed the definitions for
$POST_MAX = 1024 * 100; # max 100K posts
$DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
in CGI.pm
the perl script print out the values for thw two variables, but the filehandle
is still empty,
Any futher suggestion? is there anything to do with my web server and broswer?
Yuandan
#!/usr/bin/perl
use CGI qw/:standard/;
#use CGI::Carp 'fatalsToBrowser';
#$CGI::POST_MAX = 1024 * 100; # max 100K posts
#$CGI::DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
$query =new CGI;
print $query->header;
#print"Content-type:text/html\n\n";
$name = $query->param('name');
$email = $query->param('email');
$marker = $query->param('marker');
$chromosome = $query->param('chromosome');
$upfile = $query->param('upfile');
print $query->start_html(-title=>'Gneotype Submission for BY family',
-BGCOLOR=>'blue');
print $query->hr;
print $query->end_html;
print "$name\n<br>";
print "$email\n<br>";
print "$marker\n<br>";
print "$chromosome\n<br>";
print $query->hr;
print "$upfile\n";
#$upfile = "main::$upfile";
print "<BR> $upfile\n";
while (<$upfile>) {
print "$_<br>\n";
}
print $query->end_html;
print "$CGI::POST_MAX\n<br>";
print "$CGI::DISABLE_UPLOADS\n<br>";
exit 0;
Darhl Stultz wrote:
> When I was researching the file upload problem in the post ahead of yours I
> found this info that you might be able to use...
>
> There are two definitions in CGI.pm for $POST_MAX and $DISABLE_UPLOADS (in
> subroutine initialize_globals() ) You can reset them in your program
> thusly:
>
> $CGI::POST_MAX = 1024 * 100; # max 100K posts
> $CGI::DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
>
> dc
>
> YD wrote:
>
> > Hi,
> > a question regarding CGI.pm module.
> >
> > I try to upload a text file via web form and use CGI perl module to
> > parse the submission.
> > in web form, a entry set as :
> > <INPUT TYPE="file" NAME="upfile" enctype="multipart/form
> > -data">
> > or
> > <INPUT TYPE="file" NAME="upfile">
> >
> > In my cgi file, I use
> >
> > use CGI qw/:standard/;
> > $query =new CGI;
> > print $query->header;
> > #print"Content-type:text/html\n\n";
> >
> > $name = $query->param('name');
> > $email = $query->param('email');
> > $marker = $query->param('marker');
> > $upfile = $query->param('upfile');
> >
> > ....
> > The returned 'upfile' value is the file name and its path. However, when
> > I use this as file handle, it is empty.
> > tried this and did not print anything
> >
> > while (<$upfile>) {
> > print "## $_<br>\n";
> > }
> >
> > then, tried to manupilate the file handle by
> >
> > $upfile = "main::$upfile";
> >
> > the file handle is empty again.
> >
> > Can someone help me fix this?
> >
> > Thanks,
> > Yuandan
------------------------------
Date: Tue, 13 Mar 2001 12:15:27 -0600
From: YD <ydzhang@iastate.edu>
To: Darhl Stultz <dcsa@eci.esys.com>, ydzhang@iastate.edu
Subject: Re: CGI module on file upload
Message-Id: <3AAE63BF.E6774CE8@iastate.edu>
I have changed the definitions for
$POST_MAX = 1024 * 100; # max 100K posts
$DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
in CGI.pm
the perl script print out the values for thw two variables, but the filehandle
is still empty,
Any futher suggestion? is there anything to do with my web server and broswer?
Yuandan
#!/usr/bin/perl
use CGI qw/:standard/;
#use CGI::Carp 'fatalsToBrowser';
#$CGI::POST_MAX = 1024 * 100; # max 100K posts
#$CGI::DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
$query =new CGI;
print $query->header;
#print"Content-type:text/html\n\n";
$name = $query->param('name');
$email = $query->param('email');
$marker = $query->param('marker');
$chromosome = $query->param('chromosome');
$upfile = $query->param('upfile');
print $query->start_html(-title=>'Gneotype Submission for BY family',
-BGCOLOR=>'blue');
print $query->hr;
print $query->end_html;
print "$name\n<br>";
print "$email\n<br>";
print "$marker\n<br>";
print "$chromosome\n<br>";
print $query->hr;
print "$upfile\n";
#$upfile = "main::$upfile";
print "<BR> $upfile\n";
while (<$upfile>) {
print "$_<br>\n";
}
print $query->end_html;
print "$CGI::POST_MAX\n<br>";
print "$CGI::DISABLE_UPLOADS\n<br>";
exit 0;
Darhl Stultz wrote:
> When I was researching the file upload problem in the post ahead of yours I
> found this info that you might be able to use...
>
> There are two definitions in CGI.pm for $POST_MAX and $DISABLE_UPLOADS (in
> subroutine initialize_globals() ) You can reset them in your program
> thusly:
>
> $CGI::POST_MAX = 1024 * 100; # max 100K posts
> $CGI::DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
>
> dc
>
> YD wrote:
>
> > Hi,
> > a question regarding CGI.pm module.
> >
> > I try to upload a text file via web form and use CGI perl module to
> > parse the submission.
> > in web form, a entry set as :
> > <INPUT TYPE="file" NAME="upfile" enctype="multipart/form
> > -data">
> > or
> > <INPUT TYPE="file" NAME="upfile">
> >
> > In my cgi file, I use
> >
> > use CGI qw/:standard/;
> > $query =new CGI;
> > print $query->header;
> > #print"Content-type:text/html\n\n";
> >
> > $name = $query->param('name');
> > $email = $query->param('email');
> > $marker = $query->param('marker');
> > $upfile = $query->param('upfile');
> >
> > ....
> > The returned 'upfile' value is the file name and its path. However, when
> > I use this as file handle, it is empty.
> > tried this and did not print anything
> >
> > while (<$upfile>) {
> > print "## $_<br>\n";
> > }
> >
> > then, tried to manupilate the file handle by
> >
> > $upfile = "main::$upfile";
> >
> > the file handle is empty again.
> >
> > Can someone help me fix this?
> >
> > Thanks,
> > Yuandan
------------------------------
Date: 13 Mar 2001 10:54:56 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: CGI module on file upload
Message-Id: <3aae6d00@news.victoria.tc.ca>
YD (ydzhang@iastate.edu) wrote:
: Any futher suggestion? is there anything to do with my web server and broswer?
One reply wondered if your FORM was set up correctly. You could show us
your HTML and then we'd know.
The problem should not have anything to do with your web server.
A (very) old browser won't do file uploads - e.g. MSIE v2. Lynx may not
either, but it tells you that fact when you try.
: #!/usr/bin/perl
: use CGI qw/:standard/;
I don't think that /:standard/ is needed if you choose to use the $query->
format for calls.
------------------------------
Date: Tue, 13 Mar 2001 18:32:00 GMT
From: "Eric" <mail@ericmarques.net>
Subject: converting text to hex?
Message-Id: <AItr6.17025$PF4.20984@news.iol.ie>
how do i convert text to hex code?
like to covert "a" to "61" etc...
Thanks
--
Eric Marques
mail@ericmarques.net
------------------------------
Date: Tue, 13 Mar 2001 06:38:35 +0000
From: Ciaran McCreesh <ciaran.mccreesh@useaddressbelow.please>
Subject: Re: converting text to hex?
Message-Id: <8fxVaRArBcr6Iw3O@harlawroad.freeserve.co.uk>
In article <AItr6.17025$PF4.20984@news.iol.ie> (whatever that means),
Eric <mail@ericmarques.net> writes
>how do i convert text to hex code?
>like to covert "a" to "61" etc...
sprintf "%2.2x", chr($mychar);
HTH,
Ciaran
--
Ciaran McCreesh
mail: keesh@users.sourceforge.net
web: http://www.opensourcepan.com/
------------------------------
Date: Tue, 13 Mar 2001 18:39:11 -0000
From: "W K" <b_nospam_ill.kemp@wire2.com>
Subject: Re: converting text to hex?
Message-Id: <984508943.7116.0.nnrp-07.c3ad6974@news.demon.co.uk>
>>how do i convert text to hex code?
>>like to covert "a" to "61" etc...
>
>sprintf "%2.2x", chr($mychar);
>
hmmm
ord instead of chr?
------------------------------
Date: Tue, 13 Mar 2001 18:45:08 GMT
From: "Eric" <mail@ericmarques.net>
Subject: Re: converting text to hex?
Message-Id: <UUtr6.17037$PF4.20985@news.iol.ie>
Cannot get it to work
it always outputs 00
this is what i done
$mychar = "test";
$coutput = sprintf "%2.2x", chr($mychar);
print "$output";
--
Eric Marques
mail@ericmarques.net
"Ciaran McCreesh" <ciaran.mccreesh@useaddressbelow.please> wrote in message
news:8fxVaRArBcr6Iw3O@harlawroad.freeserve.co.uk...
> In article <AItr6.17025$PF4.20984@news.iol.ie> (whatever that means),
> Eric <mail@ericmarques.net> writes
> >how do i convert text to hex code?
> >like to covert "a" to "61" etc...
>
> sprintf "%2.2x", chr($mychar);
>
> HTH,
> Ciaran
>
> --
> Ciaran McCreesh
> mail: keesh@users.sourceforge.net
> web: http://www.opensourcepan.com/
------------------------------
Date: Tue, 13 Mar 2001 06:46:57 +0000
From: Ciaran McCreesh <ciaran.mccreesh@useaddressbelow.please>
Subject: Re: converting text to hex?
Message-Id: <1$jXyVAhJcr6Iw0w@harlawroad.freeserve.co.uk>
>how do i convert text to hex code?
>like to covert "a" to "61" etc...
Oops, I meant ord, not chr... Ah, need coffee...
Sorry,
Ciaran
--
Ciaran McCreesh
mail: keesh@users.sourceforge.net
web: http://www.opensourcepan.com/
------------------------------
Date: Tue, 13 Mar 2001 18:48:00 GMT
From: "Eric" <mail@ericmarques.net>
Subject: Re: converting text to hex?
Message-Id: <AXtr6.17040$PF4.21042@news.iol.ie>
yep ord works good
but i wanted to convert a whole text file at once and then be able to covert
it back
--
Eric Marques
mail@ericmarques.net
"W K" <b_nospam_ill.kemp@wire2.com> wrote in message
news:984508943.7116.0.nnrp-07.c3ad6974@news.demon.co.uk...
> >>how do i convert text to hex code?
> >>like to covert "a" to "61" etc...
> >
> >sprintf "%2.2x", chr($mychar);
> >
>
>
> hmmm
> ord instead of chr?
>
>
------------------------------
Date: Tue, 13 Mar 2001 06:57:29 +0000
From: Ciaran McCreesh <ciaran.mccreesh@useaddressbelow.please>
Subject: Re: converting text to hex?
Message-Id: <s$9RSaAZTcr6Iw3Z@harlawroad.freeserve.co.uk>
In article <AXtr6.17040$PF4.21042@news.iol.ie> (whatever that means),
Eric <mail@ericmarques.net> writes
>yep ord works good
>but i wanted to convert a whole text file at once and then be able to covert
>it back
How do you mean? If you're just after numbers one after another:
s/(.)/printf OUTFILE "%2.2x", ord($1)/eg while (<INFILE>);
Ugh, that's messy. There's probably a better way (see also: way that
works)...
Ciaran
--
Ciaran McCreesh
mail: keesh@users.sourceforge.net
web: http://www.opensourcepan.com/
------------------------------
Date: Tue, 13 Mar 2001 19:04:32 GMT
From: "Eric" <mail@ericmarques.net>
Subject: Re: converting text to hex?
Message-Id: <4bur6.17048$PF4.21073@news.iol.ie>
No not just numbers, all ascii characters
basically i want to do this
i will open a file to $filecontents
convert $filecontents to hex $filehex
then later on i want to convert $filehex back to the original $filecontents
--
Eric Marques
mail@ericmarques.net
"Ciaran McCreesh" <ciaran.mccreesh@useaddressbelow.please> wrote in message
news:s$9RSaAZTcr6Iw3Z@harlawroad.freeserve.co.uk...
> In article <AXtr6.17040$PF4.21042@news.iol.ie> (whatever that means),
> Eric <mail@ericmarques.net> writes
> >yep ord works good
> >but i wanted to convert a whole text file at once and then be able to
covert
> >it back
>
> How do you mean? If you're just after numbers one after another:
>
> s/(.)/printf OUTFILE "%2.2x", ord($1)/eg while (<INFILE>);
>
> Ugh, that's messy. There's probably a better way (see also: way that
> works)...
>
> Ciaran
>
> --
> Ciaran McCreesh
> mail: keesh@users.sourceforge.net
> web: http://www.opensourcepan.com/
------------------------------
Date: Tue, 13 Mar 2001 16:07:56 +0100
From: Klaus-Dieter =?iso-8859-1?Q?S=F6der?= <meisterplan@t-online.de>
Subject: Re: CPAN Question
Message-Id: <3AAE37CC.2E8F81D1@t-online.de>
Thanks.
> But why not just use the Paradox Export function?
>
> Phil
Because I am a totally newbe in the Database sector, I even don´t know
that there exists a Paradox Export function.
You know my next questions?
Where can I get information about that?
Thanks in advance
Oliver Söder
------------------------------
Date: Tue, 13 Mar 2001 14:52:32 GMT
From: montep@about.com (Monte)
Subject: Re: Does a merge function exist?
Message-Id: <3aaf3310.4901077@news.hal-pc.org>
On Mon, 12 Mar 2001 18:16:45 -0500, Lloyd Foss <lfoss@myxa.com> wrote:
>The problem is I am combining several timestamped logfiles together
>and need the combined file to be in order. The dirty solution is
>to use sort:
>
>@results = sort @log_1_contents, @log_2_contents, ... @log_N_contents;
>
>However the logs are already in order so sort is inefficient. I would
>really like to merge the rather than sort. Something on the order of:
>
>@results = merge {merge_function} \@log_1_contents, \@log_2_contents...
>
>The 'merge function' would be similar to sort's 'sort function' execpt
>it would be a min or a max of the top element of each array in the
>list of array references rather than a compare.
>
>Has such a function been written? Or something similar available?
>
>If not I will write it but I would prefer to not reinvent the wheel.
>
>Thanks ahead of time,
Not sure on *nix, but on my NTserver I just wrote a small perl script
that 'glob'ed the directory, placed the filenames in variables. Then
I system() the copy command like so $a+$b+$c+... $allfiles. Thats the
old DOS concantenate function of the Copy command. I took the file
date of the latest file and used that as the $totalfile name.
Not elegant but works nicely.
f your gonna spam.....
admin@loopback, $LOGIN@localhost, $LOGNAME@localhost,
$USER@localhost, $USER@$HOST, -h1024@localhost, root@mailloop.com
root@localhost, postmaster@localhost, admin@localhost, abuse@localhost
Chairman Reed Hundt: rhundt@fcc.gov
Commissioner James Quello: jquello@fcc.gov
Commissioner Susan Ness: sness@fcc.gov
Commissioner Rachelle Chong: rchong@fcc.gov
US Postal Service: customer@email.usps.gov
Fraud Watch: fraudinfo@psinet.com
Pyramid Schemes: pyramid@ftc.gov
Federal Trade Commission: consumerline@ftc.gov
net-abuse@nocs.insp.irs.gov
------------------------------
Date: Tue, 13 Mar 2001 10:47:10 -0500
From: Lloyd Foss <lfoss@myxa.com>
Subject: Re: Does a merge function exist?
Message-Id: <3AAE40FE.50BAF946@myxa.com>
Anno Siegel wrote:
>
> According to Lloyd Foss <lfoss@myxa.com>:
> >
> > Has such a function been written? Or something similar available?
>
> A CPAN search for "merge" shows this:
>
> File::Sort Sort a file or merge sort multiple files
>
> Sounds like what you're asking for.
>
> Anno
It looks like it will work. Thanks. I had looked in Camel 2 and
the Cookbook first and then searched CPAN but I had not searched
CPAN documentation, just CPAN modules. It had only returned
Text::merge which loads templates so thats why I asked.
--
Lloyd Foss Jr
Myxa Corporation
lfoss@myxa.com
------------------------------
Date: Tue, 13 Mar 2001 09:53:26 -0500
From: Darhl Stultz <dcsa@eci.esys.com>
Subject: file upload problem in 5.6
Message-Id: <3AAE3466.FA15098C@eci.esys.com>
My sysadmin upgraded from 5.04 to 5.6 and all of my form based file
uploads stopped working. My code is pretty standard and looks like most
of the examples I've seen on the net.
I've looked all over and can't find anyone else reporting the problem,
so I have to suspect that it is something with the way he installed
5.6... but, of course, I'm not sure.
This code snippet works under 5.04, but the I get nothing in the from
the read in the while with the new install. Any ideas as to what me or
he has done wrong?
$filename = $input{'UPFILE'};
open(OUTFILE, ">$msgfile") || &err_trap( "0 Cannot open $msgfile for
writing\n");;
binmode OUTFILE;
while($bytesread=read($filename, $buffer, 1024)) {
print OUTFILE $buffer;
}
close (OUTFILE);
Thanks
DC
------------------------------
Date: 13 Mar 2001 10:47:13 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: file upload problem in 5.6
Message-Id: <m3g0ghacxq.fsf@mumonkan.sunstarsys.com>
Darhl Stultz <dcsa@eci.esys.com> writes:
> This code snippet works under 5.04, but the I get nothing in the from
> the read in the while with the new install. Any ideas as to what me or
> he has done wrong?
>
> $filename = $input{'UPFILE'};
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Is $filename an ordinary string or an open filehandle? Did you use CGI.pm?
[...]
> while($bytesread=read($filename, $buffer, 1024)) {
^^^^^^^^^
Same question.
HTH
--
Joe Schaefer "It is better to be feared than loved, if you cannot be both."
-- Niccolo Machiavelli
------------------------------
Date: Tue, 13 Mar 2001 11:03:21 -0500
From: Darhl Stultz <dcsa@eci.esys.com>
Subject: Re: file upload problem in 5.6
Message-Id: <3AAE44C9.669E63BF@eci.esys.com>
Joe Schaefer wrote:
>
> > $filename = $input{'UPFILE'};
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Is $filename an ordinary string or an open filehandle? Did you use CGI.pm?
>
Didn't use CGI.pm (other than ReadParse to get the UPFILE name/dir)
$filename equals c:\data\test\test.txt (or whatever is selected in the file
browse in the form)
Obviously am using in the form: enctype="multipart/form-data"
Code worked with our install of 5.04
dc
------------------------------
Date: 13 Mar 2001 18:09:44 +0000
From: nobull@mail.com
Subject: Re: file upload problem in 5.6
Message-Id: <u9ae6p8rrr.fsf@wcl-l.bham.ac.uk>
Darhl Stultz <dcsa@eci.esys.com> writes:
> Joe Schaefer wrote:
>
> >
> > > $filename = $input{'UPFILE'};
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > Is $filename an ordinary string or an open filehandle? Did you use CGI.pm?
> >
>
> Didn't use CGI.pm (other than ReadParse to get the UPFILE name/dir)
>
> $filename equals c:\data\test\test.txt (or whatever is selected in the file
> browse in the form)
>
> Obviously am using in the form: enctype="multipart/form-data"
>
> Code worked with our install of 5.04
ReadParse() function in CGI.pm exists to emulate the behaviour of the
older "cgi-lib.pl" library. This older library had no upload support.
Early versions of upload support in CGI.pm used symbolic references to
allow a single variable to act both as a filehandle and as the name of
the uploaded file. This was very bad for various reasons. In later
versions of CGI.pm this mechanism was replaced by one that used
overloading rather than symbolic references (which IMNSHO is still
bad, but not nearly _so_ bad).
Your program worked with older versions of CGI.pm but this was an
simply an artifact of the use of symbolic references. Symbolic
references are really just strings so will survive going through the
stringification implicit in join(). True references do not.
Use CGI.pm's native API rather than it's cgi-lib.pl emulatation and
your code should work OK.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
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 V10 Issue 480
**************************************