[24025] in Perl-Users-Digest
Perl-Users Digest, Issue: 6222 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 5 14:05:44 2004
Date: Fri, 5 Mar 2004 11:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 5 Mar 2004 Volume: 10 Number: 6222
Today's topics:
Re: 7-bit transmission via Net::SMTP? <Juha.Laiho@iki.fi>
hash keys <ihatespam@hotmail.com>
Re: hash keys <usenet@morrow.me.uk>
IMAP via ssl? <josef.moellers@fujitsu-siemens.com>
Re: IMAP via ssl? <Me@myco.com>
Re: Is it possible to impose a timeout on <>? <andy@misk.co.uk>
Re: Need to parse SQL statements...use regular expressi <x@x.us>
Re: Need to parse SQL statements...use regular expressi <jwillmore@remove.adelphia.net>
Re: Nested arrays <mr@sandman.net>
Re: new to perl <s020274@cuhk.edu.hk>
Not Getting Cookies in LWP <hal@thresholddigital.com>
Re: Perl on Win32, with Apache (sangeetha)
problem about qq/.../; <ckacka@163.com>
Re: problem about qq/.../; <usenet@morrow.me.uk>
Re: problem about qq/.../; <ckacka@163.com>
Re: Protecting CGI Scripts <inbox@kodo.me.uk>
Re: Protecting CGI Scripts <jwillmore@remove.adelphia.net>
Re: Protecting CGI Scripts ctcgag@hotmail.com
Re: Reaction time source code? <s020274@cuhk.edu.hk>
Re: Real Numbers in Perl <ittyspam@yahoo.com>
Re: Real Numbers in Perl <bart.lateur@pandora.be>
References Subroutines and Arrays (Ketema)
Replacing 1500 bytes at a variable offset (A. Farber)
Re: routine/module to translate microsoft extended asci (James O'Brien)
Re: routine/module to translate microsoft extended asci <usenet@morrow.me.uk>
Re: Running Perl Programs as .CGI <remorse@partners.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 05 Mar 2004 18:17:00 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: 7-bit transmission via Net::SMTP?
Message-Id: <c2aftv$3h5$1@ichaos.ichaos-int>
Guru03 <Guru03@despammed.com> said:
>I must delivery an email message from a SMTP server to an another.
>
>The transmission MUST be 7-bit coded (*NOT* 8BITMIME).
>
>It's ok to use Net::SMTP? The documentation about it don't tell me about
>the type of transmission. And the code isn't clear.
You can use Net::SMTP, but it doesn't do any recoding for you -- so if
your transfer data is declared to be 8-bit (so using 'Bits => 8' among
the options for the "mail" method) and the remote doesn't announce
support for 8-bit transfers, the transfer will be aborted.
>It must be able to delivery MIME 1.0 format emails with special characters
>(i.e. non US keyboard) coded in 8-bit format (with some attachments in UTF8
>code converted into BASE64 that already are in 7bit format).
So, as long as you pre-code your message body and attachments into such
form that they only contain printable ASCII, you won't have a problem
with Net::SMTP.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
------------------------------
Date: Fri, 05 Mar 2004 08:07:34 -0800
From: BigDaDDY <ihatespam@hotmail.com>
Subject: hash keys
Message-Id: <104h9e6keqhjqc4@corp.supernews.com>
I am wondering if it is possible for me to have a hash with numeric keys
and a string as the value for each corresponding key. The reason is, is
the results of a mathematical calculation are going to determine the key.
The program below seems to populate the hash %jay with the correct values,
but I am not sure how to get at them. If I calculate the value of $angle
through a series of complex equations, then how can I get at $jay{$angle},
which is what I really want to print?
Thanks
#!/usr/bin/perl -w
use strict;
my ($k, $v, $angle, $stackup, $matt, %jay);
$stackup = "(45/45/45)";
$angle = 45.00;
$matt = &rel_stacks($stackup);
%jay = %$matt;
while (($k, $v) = each %jay){
print "$k $v\n";
}
sub rel_stacks{
my ($mark, $count, $y, @ang, $z, @tmp2, %rel_stack);
my ($layup) = @_;
%rel_stack = ();
$layup =~ s/[\(\)]//g;
@ang = split(/\//,$layup);
for ($z = 0; $z <= 3600; $z+=1){
$#tmp2 = -1;
$count = sprintf("%.2f", ($z/100));
for ($y = 0; $y <= $#ang; $y++){
$tmp2[$z] = $tmp2[$z] . sprintf("%.2f", ($ang[$y] - $count)) . '/';
}
$rel_stack{$count} = $tmp2[$z];
}
$mark = \%rel_stack;
return($mark);
}
------------------------------
Date: Fri, 5 Mar 2004 16:36:39 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: hash keys
Message-Id: <c2aaan$gov$4@wisteria.csv.warwick.ac.uk>
ihatespam@hotmail.com wrote:
> I am wondering if it is possible for me to have a hash with numeric keys
> and a string as the value for each corresponding key. The reason is, is
> the results of a mathematical calculation are going to determine the key.
>
> The program below seems to populate the hash %jay with the correct values,
> but I am not sure how to get at them. If I calculate the value of $angle
> through a series of complex equations, then how can I get at $jay{$angle},
> which is what I really want to print?
Ummmm... like that? One thing you may want to bear in mind is that hash
keys are strings, so you will probably need to sprintf them with some
appropriate format to get a consistent representation.
Ben
--
"If a book is worth reading when you are six, * ben@morrow.me.uk
it is worth reading when you are sixty." - C.S.Lewis
------------------------------
Date: Fri, 05 Mar 2004 17:14:09 +0100
From: =?ISO-8859-1?Q?Josef_M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: IMAP via ssl?
Message-Id: <c2a8t9$m4s$1@nntp.fujitsu-siemens.com>
Hi,
according to IMAPClient's manual page, it should be possible to access=20
an IMAP server via an SSL connection.
I tried:
($server is the right server name and $prot is "imaps", $user and=20
$password are also correct)
if ($prot eq "imaps") {
$port =3D getservbyname($prot, 'tcp');
my $s =3D IO::Socket::SSL->new(PeerAddr=3D>$host,
PeerPort =3D> $port,
Proto =3D> 'tcp');
die $@ unless defined $s;
$imap =3D Mail::IMAPClient->new(Socket =3D> $s,
User =3D> $user,
Password =3D> $password,);
$imap->State($imap->Connected());
$imap->login or die $@;
but I get the error message
Use of uninitialized value in string eq at=20
/usr/lib/perl5/site_perl/5.8.1/Mail/IMAPClient.pm line 1435.
and then
Error sending '1 Login "XXXXXXXX" {12}
YYYYYYYYYYYY
' to IMAP: at Perl/IMAP.pl line 45
Error sending '1 Login "XXXXXXXX" {12}
YYYYYYYYYYYY
' to IMAP: at Perl/IMAP.pl line 45.
What am I doing wrong?
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Fri, 05 Mar 2004 22:25:47 +0530
From: Abhinav <Me@myco.com>
Subject: Re: IMAP via ssl?
Message-Id: <So22c.12$zW4.46@news.oracle.com>
Josef Möllers wrote:
> Hi,
>
> according to IMAPClient's manual page, it should be possible to access
> an IMAP server via an SSL connection.
> I tried:
> ($server is the right server name and $prot is "imaps", $user and
> $password are also correct)
>
Hope you have added the following :
use strict;
use warnings;
> if ($prot eq "imaps") {
> $port = getservbyname($prot, 'tcp');
$port should be initialised ??? (use strict to find out) if
getservbyname() actually returns something..you may want to do
my $port;
$port = getservbyname($prot, 'tcp') or die ("Could Not get Server By
Name");
> my $s = IO::Socket::SSL->new(PeerAddr=>$host,
> PeerPort => $port,
> Proto => 'tcp');
> die $@ unless defined $s;
>
> $imap = Mail::IMAPClient->new(Socket => $s,
> User => $user,
> Password => $password,);
> $imap->State($imap->Connected());
> $imap->login or die $@;
>
> but I get the error message
> Use of uninitialized value in string eq at
> /usr/lib/perl5/site_perl/5.8.1/Mail/IMAPClient.pm line 1435.
> and then
> Error sending '1 Login "XXXXXXXX" {12}
> YYYYYYYYYYYY
> ' to IMAP: at Perl/IMAP.pl line 45
> Error sending '1 Login "XXXXXXXX" {12}
> YYYYYYYYYYYY
> ' to IMAP: at Perl/IMAP.pl line 45.
>
> What am I doing wrong?
>
Of course, TMTOWTDI :)
Regards
Abhinav
------------------------------
Date: Fri, 5 Mar 2004 12:00:00 -0000
From: "Andrew McGregor" <andy@misk.co.uk>
Subject: Re: Is it possible to impose a timeout on <>?
Message-Id: <c29v0s$5vr$1@news.ukfsn.org>
"Bob Dubery" <megapode@hotmail.com> wrote in message
news:e8f67309.0403050035.4ad523c3@posting.google.com...
>
> OK... a wierd situation and not a common one, but I want to improve
> the code. Specificially when I invoke <> I'd like to be able to impose
> a time out so that if I get nothing back after n seconds I can raise
> an error condition and start interrogating the next site.
>
perldoc -f alarm
------------------------------
Date: Fri, 5 Mar 2004 06:33:04 -0600
From: "Justin F" <x@x.us>
Subject: Re: Need to parse SQL statements...use regular expression?
Message-Id: <5s_1c.10192$m4.9910@okepread03>
"gnari" <gnari@simnet.is> wrote in message
news:c29fdn$j8e$1@news.simnet.is...
> "Justin F" <x@x.us> wrote in message
news:jTS1c.10175$m4.5448@okepread03...
> > I'm developing a tool that will be used to write queries against a
> database.
> > The word 'GO' is used as a batch terminator...for example, two queries
> > separated by 'GO' would need to be sent to the database separately. I
can
> > can accomplish this if 'GO' appears on it's own line, but that won't
> always
> > be the case...it may be in a comment or contained in a string, in which
> case
> > I don't want to match.
>
> [snip examples]
>
> > I really don't know much about regular expressions...can this be
> > accomplished with one? If so, what would the expression look like?
>
> first: is there any reason for the 'go' as SQL terminator ?
> it is quite usual to use ';' for this. one problem is that 'go' is
> a valid SQL object name (table/column/...)
>
> I think that it is not possible to do this with a regex, unless you add
> a few restrictions to the allowed use of the comments, because you
> need to deal with so many cases:
> terminator in single quotes
> terminator in double quotes
> terminator in comments
> nested comments of all combinations
> comments inside quoted strings
> quotes in comments
> quotes in quoted strings
>
> you probably are better off doing some basic parsing instead of
> using a regex. (or many)
> who knows, maybe one of the many SQL modules on CPAN
> can help you.
>
> gnari
The reason 'GO' is the terminator is because it's a Microsoft SQL server
I'll be going against. From the replies I've gotten it looks like I'll have
to pursue a different avenue for parsing. Thanks for the replies.
BTW, what is CPAN?
------------------------------
Date: Fri, 05 Mar 2004 11:43:24 -0500
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Need to parse SQL statements...use regular expression?
Message-Id: <pan.2004.03.05.16.43.22.734949@remove.adelphia.net>
On Fri, 05 Mar 2004 06:33:04 -0600, Justin F wrote:
> The reason 'GO' is the terminator is because it's a Microsoft SQL server
> I'll be going against. From the replies I've gotten it looks like I'll have
> to pursue a different avenue for parsing. Thanks for the replies.
I didn't get that impression. I got the impression that your data that
you're using needs to be re-thought :-) It would be a simple task if the
'GO' were on a single line.
But ... since you don't have control over your data coming in, you need to
fashion a (series of) rather complex regular expression(s).
Or ... another option you *may* be able to examine is substituting each
instance of 'GO' into a newline character. Then, you *might* be able to
use a single regular expression to extract the SQL statements. A module
from ye olde CPAN might be able to help.
This, of course, is just off the top of my head and untested :-)
> BTW, what is CPAN?
Comprehensive Perl Archive Network - it is the central repository for Perl
modules. `perldoc CPAN` for more information.
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
Documentation is like sex: when it is good, it is very, very
good; and when it is bad, it is better than nothing. -- Dick
Brandon
------------------------------
Date: Fri, 05 Mar 2004 14:05:33 +0100
From: Sandman <mr@sandman.net>
Subject: Re: Nested arrays
Message-Id: <mr-5E16D5.14053305032004@news.fu-berlin.de>
In article <c29a5a$8cd$1@nets3.rz.RWTH-Aachen.DE>,
"Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de> wrote:
> In Perl, arrays and hashes are two distinct data-types and you cannot
> access one as though it were the other. Fortunately there is never a
> need for such androgynous types. Your first example becomes:
>
> my %foo = (
> foo => [ qw/foo bar/ ],
> bar => [ qw/rab oof/ ],
> );
>
> print $foo{foo}[0];
> # which is really
> print $foo{foo}->[0]
>
> The second one:
>
> my %foo = (
> foo => { foo => 'orange', bar => 'apple' },
> bar => { rab => 'pear', oof => 'pineapple' },
> );
>
> print $foo{foo}{foo};
> # or
> print $foo{foo}->{foo};
Thanks!
--
Sandman[.net]
------------------------------
Date: Fri, 5 Mar 2004 23:43:59 +0800
From: "Tsui Wai-ming" <s020274@cuhk.edu.hk>
Subject: Re: new to perl
Message-Id: <c2a6qn$2f3m$1@justice.itsc.cuhk.edu.hk>
"Joe Smith" <Joe.Smith@inwap.com> ¼¶¼g©ó¶l¥ó·s»D
:jpM1c.177224$jk2.647006@attbi_s53...
> Tsui Wai-ming wrote:
>
> > In fact I just changed to
> >
> > #!C:\perl\bin\perl
> >
> > This one
> > # perl, and
> > #!C:\perl\bin
> >
> > didnt work at all...
>
> It depends on how you invoke your perl script.
>
> Double-clicking on an icon in a local file folder: Uses registry.
> Typing name into CMD.EXE command-line prompt: Uses registry.
> Typing name into some other command-line shell: Depends on shell (bash).
> (In particular, cygwin uses /usr/bin/perl.)
> Clicking on link in a browser: Depends on web server.
> Sambar Server for Windows: Uses shebang line.
> Apache Server for Windows: I believe it is a configuration option.
> IIS: Registry.
>
> Which method "didnt work at all"?
> -Joe
This one: #perl
And this one: #!C:\perl\bin
Ming :)
------------------------------
Date: Fri, 05 Mar 2004 14:06:53 GMT
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Not Getting Cookies in LWP
Message-Id: <1Q%1c.120896$4o.161340@attbi_s52>
I'm trying to access a site with data that needs to be paged through, one
page at a time. It won't allow back buttons and you have to use the menu
links to get through. In other words, it is run through CGI (ASP, I think)
and must be able to keep track of sessions.
I have a simple program I've written using Perl and LWP. I tried a totally
innocuous site (TVLand.com) that I found had cookies. When I read in 1
page from this site, I got a cookie and it showed up in lwpcookies.txt.
Whenever I try this other site (which requires a password and account, so I
can't list it here, according to registration agreement -- and no, it isn't
pr0n!), I find that there is a line in the header to set a cookie in both
web pages. The only difference is that the one where the cookie isn't
storied doesn't list a domain name in the cookie line. Here's the header
lines with the cookie info (1st is TVLand, 2nd is private site):
Set-Cookie: JSESSIONID=M1LHYKX2DVXRMCQBAFML3UQ; domain=.tvland.com; path=/
Set-Cookie: JSESSIONID=0000CSPVV3Q5TXU2BUPIIDEWOCY:ulnfn1uq;Path=/
my program (listed below) prints out that I have a cookie. (Whenever I try
the site with Galeon, I can read a cookie for the site, too), but no cookie
shows up in lwpcookie.txt (the cookie file) at all.
Am I doing something wrong? I need to be sure that the cookie is persistant
in my program, but it never shows up in the cookie file. Is there a reason
for that, or am I doing something wrong? What can I do to make sure the
cookie from the 2nd site is stored for later -- and also read back when
needed by other pages?
Thanks!
Hal
--------------------------------------------------------------------
Program listing:
use LWP::UserAgent;
use HTTP::Cookies;
our $domain = "tvland.com";
our $locmenu = "schedule";
our $ua = LWP::UserAgent->new;
$ua->agent("Mozilla/4.0");
$ua->agent("MSIE/6.0");
$ua->cookie_jar(HTTP::Cookies->new(file =>"lwpcookies.txt", autosave =>
1));
$url = "HTTP://".$domain."/".$locmenu;
print "Url: $url\n";
$req = HTTP::Request->new(GET => $url);
$req->content_type("application/x-www-form-urlencoded");
$req->header('Accept' => 'text/html');
$res = $ua->request($req);
print "Cookie: ".$res->status_line."\n";
$page = $res->as_string;
# print "Page: $page\n";
------------------------------
Date: 5 Mar 2004 05:44:38 -0800
From: sangeetha_b@india.com (sangeetha)
Subject: Re: Perl on Win32, with Apache
Message-Id: <4fde56d3.0403050544.d3d4c93@posting.google.com>
Create package file .pm file and place in the current directory. "use
package"
In anotherway, in the configuration file your have specified the
location HTTPROOT(???) directory for the application. So give relative
path from that ROOT in the "require x/y/z/fileame".
Sangetha
Regent <arthur0421@163.com> wrote in message news:<c29c2d$1pkd$1@mail.cn99.com>...
> I have a Perl-based web site, of which each script must "require" a
> commonstuff.pl that simply defines some common subroutines and
> constants. If I don't put commonstuff.pl in any of the @INC paths, how
> should I efficiently include it in each script, avoiding such lines as
>
> require "d:/wwwroot/cgi-bin/commonstuff.pl";
>
> Of course I also tried the following:
>
> unshift (@INC, "d:/wwwroot/cgi-bin");
> require ("commonstuff.pl");
>
> However I hate to do such path-specific things in the many scripts. Thanks!
>
> Regent
------------------------------
Date: Sat, 6 Mar 2004 01:10:54 +0800
From: "ckacka" <ckacka@163.com>
Subject: problem about qq/.../;
Message-Id: <c2acau$1r6btl$1@ID-224383.news.uni-berlin.de>
Hello, I use
print qq/<!DOCTYPE html
PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\n/;
get 500 error.
and I use
print "<!DOCTYPE html
PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\n";
get 200.
_______
but I think there is no difference.
Why? Thanks.
------------------------------
Date: Fri, 5 Mar 2004 17:20:41 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: problem about qq/.../;
Message-Id: <c2act9$ioa$1@wisteria.csv.warwick.ac.uk>
"ckacka" <ckacka@163.com> wrote:
> Hello, I use
>
> print qq/<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
^^
qq// will stop at the first /. Either escape them with \ or use different
delimiters.
Ben
--
Heracles: Vulture! Here's a titbit for you / A few dried molecules of the gall
From the liver of a friend of yours. / Excuse the arrow but I have no spoon.
(Ted Hughes, [ Heracles shoots Vulture with arrow. Vulture bursts into ]
/Alcestis/) [ flame, and falls out of sight. ] ben@morrow.me.uk
------------------------------
Date: Sat, 6 Mar 2004 01:29:32 +0800
From: "ckacka" <ckacka@163.com>
Subject: Re: problem about qq/.../;
Message-Id: <c2addu$1rjbc9$1@ID-224383.news.uni-berlin.de>
Thanks. ^_^
"Ben Morrow" <usenet@morrow.me.uk> дÈëÓʼþ
news:c2act9$ioa$1@wisteria.csv.warwick.ac.uk...
>
> "ckacka" <ckacka@163.com> wrote:
> > Hello, I use
> >
> > print qq/<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
> ^^
> qq// will stop at the first /. Either escape them with \ or use different
> delimiters.
>
> Ben
>
> --
> Heracles: Vulture! Here's a titbit for you / A few dried molecules of the
gall
> From the liver of a friend of yours. / Excuse the arrow but I have no
spoon.
> (Ted Hughes, [ Heracles shoots Vulture with arrow. Vulture bursts
into ]
> /Alcestis/) [ flame, and falls out of sight. ]
ben@morrow.me.uk
------------------------------
Date: Fri, 05 Mar 2004 13:25:17 +0100
From: kodo <inbox@kodo.me.uk>
Subject: Re: Protecting CGI Scripts
Message-Id: <c29rjd$1rgivh$1@ID-226330.news.uni-berlin.de>
usadreams@yahoo.com (Neil) writes:
> Hi,
>
> I have a consultant who is about to access files on our UNIX server
> via FTP.
> Is there a simple way to protect the CGI scripts from being
> copied/stolen while, at the same time, keeping the CGI script actively
> available for public use?
>
> Please help!
> TIA :)
This is not a perl-related question, is it?
But anyway, what about using the permission-system your filesystem
offers you? ask the administrator of that server, I'm sure he can do
that.
--
greetings,
kodo
[ http://kodo.me.uk ]
------------------------------
Date: Fri, 05 Mar 2004 11:28:04 -0500
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Protecting CGI Scripts
Message-Id: <pan.2004.03.05.16.28.02.49756@remove.adelphia.net>
On Fri, 05 Mar 2004 02:31:23 -0800, Neil wrote:
> I have a consultant who is about to access files on our UNIX server via
> FTP.
> Is there a simple way to protect the CGI scripts from being
> copied/stolen while, at the same time, keeping the CGI script actively
> available for public use?
Perl != CGI
So, with this in mind .... this question is better suited to a newsgroup
that deals with Unix security or deals with the ins and outs of whatever
web server you're using.
To get you started, your permissions on your scripts *may* be altered from
755 to 750 (which basically means that, the owner can read, write and
execute the scripts, the group can read and execute the scripts, and the
rest of the world gets nada). There are other factors to consider ...
which I'll leave up to you to find out :-)
HTH
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
Andrea: Unhappy the land that has no heroes. Galileo: No, unhappy
the land that needs heroes. -- Bertolt Brecht, "Life of
Galileo"
------------------------------
Date: 05 Mar 2004 16:54:37 GMT
From: ctcgag@hotmail.com
Subject: Re: Protecting CGI Scripts
Message-Id: <20040305115437.974$wZ@newsreader.com>
usadreams@yahoo.com (Neil) wrote:
> Hi,
>
> I have a consultant who is about to access files on our UNIX server
> via FTP.
> Is there a simple way to protect the CGI scripts from being
> copied/stolen while, at the same time, keeping the CGI script actively
> available for public use?
>
> Please help!
Presumably your FTP server will be rooted somewhere that does not overlap
with cgi-bin. But the fact that you ask that on a Perl newsgroup makes
me think you won't understand what I said. (You need to hire another
consultant--a security one--to keep an eye on the first consultant.)
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Fri, 5 Mar 2004 23:46:01 +0800
From: "Tsui Wai-ming" <s020274@cuhk.edu.hk>
Subject: Re: Reaction time source code?
Message-Id: <c2a6uh$2f5k$1@justice.itsc.cuhk.edu.hk>
"James Willmore" <jwillmore@remove.adelphia.net> ¼¶¼g©ó¶l¥ó·s»D
:pan.2004.03.05.05.20.07.663078@remove.adelphia.net...
> On Fri, 05 Mar 2004 02:05:49 +0800, Tsui Wai-ming wrote:
>
> > "Ben Morrow" <usenet@morrow.me.uk> ¼¶¼g©ó¶l¥ó·s»D
> > :c27pjm$njh$3@wisteria.csv.warwick.ac.uk...
> >>
> >> "Tsui Wai-ming" <s020274@cuhk.edu.hk> wrote:
> >> > Has anyone written a program for recording reaction time, like those
> > used in
> >> > psychology experiments?
> >> >
> >> > I've seen some written in C/C++ but I don't know C languages... :(
> >>
> >> Should be pretty trivial using Time::HiRes...
> >
> > Thanks for your message. But could you tell me where I can find some
> > information on Time::HiRes? I've just searched through my Perl Bookshelf
> > (Perl in a Nutshell, Learning Perl on Win32 Systems, Programming Perl)
and I
> > wasn't able to locate it :'(
>
> http://search.cpan.org/ - search for time hires
Thanks for your information!
------------------------------
Date: Fri, 5 Mar 2004 10:20:42 -0500
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Real Numbers in Perl
Message-Id: <20040305101853.L27834@dishwasher.cs.rpi.edu>
On Thu, 4 Mar 2004, BigDaDDY wrote:
> I am writing several equations in Perl, but I want the values returned to
> be in a "%.2f" format. Is there a way to do this without using sprintf
> commands everywhere?
>
Well, you could define your own class, and then tie that class so that the
get operations call sprintf themselves.... but that would be increasing
the slowness of your program, and be far more work than copy-and-pasting
sprintf a few times.
perldoc perltie for more information
Paul Lalli
------------------------------
Date: Fri, 05 Mar 2004 16:42:29 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Real Numbers in Perl
Message-Id: <o1bh40to1j84aicualfs79rcek84to9l8h@4ax.com>
BigDaDDY wrote:
>I am writing several equations in Perl, but I want the values returned to
>be in a "%.2f" format. Is there a way to do this without using sprintf
>commands everywhere?
Tie a hash to do the calculation for you? Use the Interpolatin module.
You can either use the interface as seen in its docs, or do it like
this, which hides less under the carpet but does pretty much the same
(except it'll work on lexicals too):
use Interpolation;
tie my(%dd), Interpolation => sub { sprintf "%.2f", shift};
Now you can do:
$a = $dd{123.45678};
The "hash index" can be any scalar expression. You can even do this in a
string:
$x = 123.456;
$y = 15.777;
print "The value is <$dd{$x+$y}>.\n";
-->
The value is <139.23>.
--
Bart.
------------------------------
Date: 5 Mar 2004 10:46:19 -0800
From: ketema@ketema.net (Ketema)
Subject: References Subroutines and Arrays
Message-Id: <84bca20f.0403051046.520f6b9e@posting.google.com>
I am a little lost on how PERL handles references and array's,
especially when you pass and array to a subroutine. Here is some code
I have working to try and get a better understanding. I read perldoc
perlref, and I just don't see why this isn't working...Please help!
#I'm working with a mime::entity object from net::pop3
&getParts($mime_entity);
sub getParts {
print "The wierd variable \@_ consists of: ".scalar @_."
variables\n";
print "That passed variable: ".scalar @_->[0]." is a:
".ref(@_->[0])."\n";
#lets take the address of the passed array out of the hard to read
@_ variable which is a list of everything passed to the sub
my $passedArray = \@_[0];
print "passedArray now holds the address for the passed object.
passedArray holds: $passedArray\n";
print "The object located at the memory address passedArray holds is
a: ". ref({$passedArray})."\n";
print "Lets do some Tests.\n";
print "\@_->{'ME_Parts'} attribute is a
:".ref(@{@_[0]->{'ME_Parts'}});
print "passedArray->{'ME_Parts'} attribute is a
:".ref(@$$passedArray->{'ME_Parts'});
die "Debugging The real Way!";
}
------------------------------
Date: 5 Mar 2004 06:16:53 -0800
From: Alexander.Farber@t-online.de (A. Farber)
Subject: Replacing 1500 bytes at a variable offset
Message-Id: <c9ccaf83.0403050616.1e172b44@posting.google.com>
How could I replace 1500 bytes in a file, please?
They are not located at some fixed offset and also
the amount of replacing bytes could be bigger or
smaller than 1500. Here's what I am trying currently:
my $SEARCH = pack 'C*', map { hex } qw(
98 e6 52 ca db ce db 19 62 00 00 00
69 b5 40 0c 91 dc 6b 43 cf 00 00 00
5b 7d 92 c2 e1 ec f1 45 11 00 00 00
92 45 a3 64 0b ff e4 d9 a6 00 00 00
2e 0d cb 22 50 0e 92 5a 0f 00 00 00
4e d5 78 59 ee 1c 8b c6 cc 00 00 00
.... );
my $REPLACE = pack 'C*', map { hex } qw(
ff ff ff ff ff ff ff ff ff ff ff ff
69 b5 40 0c 91 dc 6b 43 cf 00 00 00
5b 7d 92 c2 e1 ec f1 45 11 00 00 00
92 45 a3 64 0b ff e4 d9 a6 00 00 00
2e 0d cb 22 50 0e 92 5a 0f 00 00 00
.... );
use constant KEYSIZE => length $SEARCH;
while (sysread $upload, $chunk, KEYSIZE) {
$both = $prev . $chunk;
if ($both =~ s/$SEARCH/$REPLACE/o) {
die "syswrite failed: $!"
unless length $both == syswrite $fh, $both;
undef $prev;
} else {
die "syswrite failed: $!"
unless length $prev == syswrite $fh, $prev;
$prev = $chunk;
}
}
# don't forget to print the last line
die "syswrite failed: $!"
unless length $prev == syswrite $fh, $prev;
Unfortunately the regex doesn't compile, probably
because it doesn't like the binary data I feed to it!
Regards
Alex
------------------------------
Date: 5 Mar 2004 08:03:08 -0800
From: jobrien@techtarget.com (James O'Brien)
Subject: Re: routine/module to translate microsoft extended ascii to plain ascii
Message-Id: <47a3b6fd.0403050803.6c403e3d@posting.google.com>
Yeah, I searched already.
------------------------------
Date: Fri, 5 Mar 2004 16:33:50 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: routine/module to translate microsoft extended ascii to plain ascii
Message-Id: <c2aa5e$gov$3@wisteria.csv.warwick.ac.uk>
jobrien@techtarget.com (James O'Brien) wrote:
> Does anyone know of a routine/module to do this? I know I can stick
> 127 regexes in my code, but I'm looking for something more efficient.
Can you specify a little more clearly what you want to do? Whatever it
is, it can almost certainly be done with the Encode module; but I can't
help you with how as I don't understand what translation you want.
Firstly, what is 'microsoft extended ascii'? Some 8-bit charset?
(cp-1250, at a guess?) Secondly, how do you wish it to be translated
into ASCII: all top-bit-set characters stripped? Do you have some
mapping from characters > 127 to those below (in which case, there's
certainly no need for 127 regexen: one tr/// will do fine)?
Ben
--
And if you wanna make sense / Whatcha looking at me for? (Fiona Apple)
* ben@morrow.me.uk *
------------------------------
Date: Fri, 05 Mar 2004 11:49:19 -0500
From: Richard Morse <remorse@partners.org>
Subject: Re: Running Perl Programs as .CGI
Message-Id: <remorse-04996C.11491905032004@plato.harvard.edu>
In article <8lgf409imfl31iilev0es3jsfrhcj3bs3d@4ax.com>,
Steven Pladl <sillo@anchrin.net> wrote:
> The info I've found usually suggests associating cgi files with Perl,
> but I haven't found any procedures for doing so. Most suggest
> contacting the host to make the changes, however my host does not
> manage my server. Any changes, I must make myself. How would I do
> this?
Are you using Apache on Windows?
If so, what you might be talking about (I don't use Apache on Windows,
so I'm not positive) is the Windows settings. I assume that Apache just
forks and execs the CGI. Basically, the same as double-clicking on an
icon. So you need to make windows allow you to double-click on the icon
for the .cgi files.
Start Menu->Settings->Control Panels->Folder Options
File Types tab
You need to add a new entry to this list. First go look at the .PL file
type. You need to click on "Advanced", then on the "Open" action, then
on "Edit...". There will be a string, looking something like
'"C:\perl\bin\perl.exe" %1 %*'. You need to use this same string in
your new CGI file type.
HTH,
Ricky
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 6222
***************************************