[12520] in Perl-Users-Digest
Perl-Users Digest, Issue: 6120 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 24 18:07:15 1999
Date: Thu, 24 Jun 99 15:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 24 Jun 1999 Volume: 8 Number: 6120
Today's topics:
[Q]: Get different hashes from a sub? (Jih-Shin Suen)
Re: Afraid to ask about Y2K! <robert@ling.gu.se>
Re: Can not write my file to the server <martin@adoma.se>
Re: Creating graphics on the fly for web pages <kazuma@my-deja.com>
Re: deleting part of a string <hasant@trabas.co.id>
Re: Does Perl have a future? <bobn@interaccess.com>
Re: garbage collector (Bart Lateur)
getting rid of a character <bsat@iprolink.ch>
Re: How can I get size of uploaded image via CGI? <martin@adoma.se>
Re: How can I get size of uploaded image via CGI? <martin@adoma.se>
Re: How can I get size of uploaded image via CGI? <cassell@mail.cor.epa.gov>
Kicking off remote program <scrosby1@nycap.rr.com>
ksh to perl <prasad@lanka.ce.lsu.edu>
Re: ksh to perl <cassell@mail.cor.epa.gov>
Re: localtime (perldoc -f localtime didn't help) <dhenders@cpsgroup.com>
Re: localtime (perldoc -f localtime didn't help) <arcane@verinet.com>
Re: mod_perl require problem <bobn@interaccess.com>
Re: Newbie - Perl books - which to get? <upsetter@ziplink.net>
Newbie -> trying to wirte a Cgi for FTP-access ... o_klaus@my-deja.com
Newbie can't delete file roberthp@my-deja.com
Re: Newbie can't delete file <upsetter@ziplink.net>
Re: newbie: Grab URL into PERL? <kazuma@my-deja.com>
Re: newbie: Grab URL into PERL? <radmoose@spam.spam.spam.not.bigfoot.com>
perl to executable <itoi@cc.gatech.edu>
Re: Probably simple, but pulling hair out (Tri Tram)
Re: Read a file starting a a certain point in the middl (Bart Lateur)
Re: Safe expression evaluation (Bart Lateur)
Send e-mail using Perl?? <stuntman@koan.com>
Re: Send e-mail using Perl?? <cassell@mail.cor.epa.gov>
validating a regexp from a CGI form jhefferon@my-deja.com
Re: validating a regexp from a CGI form (Bart Lateur)
Re: Viral matters [completely off-topic] <dhenders@cpsgroup.com>
Re: Wraparound Array/list... <jhi@alpha.hut.fi>
Re: WWWBoard for NT <martin@adoma.se>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Jun 1999 16:19:54 -0500
From: jihshin@linux11.ph.utexas.edu (Jih-Shin Suen)
Subject: [Q]: Get different hashes from a sub?
Message-Id: <7ku7dq$c6h$1@linux11.ph.utexas.edu>
Hi, All:
I got the problem in accessing different hashes.
I try to use same sub to print different hashes' data to different
output files.
But don't know how.
I have data hashes:
%dose has the form (key=date, data1)...
%paq has the form (key=date, data2, data3)...
%lasermaxp has form (key=date, data4) ...
the main program:
---------- main --------------------------------------------
my @Outfiles = (dose,paq,lasermaxp);
foreach $Outfiles (@Outfiles)
{
$FileH_Out = $Outfiles;
$file_out = ">$Outfiles";
#print("\n\n $FileH_Out, $file_out \n\n");
Output_to_file();
}
----------- sub -------------------------------------------
sub Output_to_file
{
open($FileH_Out, $file_out) || die ("!!! Can't output to $file_out !
");
my $myhash = $FileH_Out;
#print ("\n\n $myhash \n\n");
local $" = ', ';
for my $key (sort keys %myhash)
{
my ($value1,$value2,value3) = @{$myhash{$key}};
print $FileH_Out ("$ndate, $value1,$value2,$value3 \n");
}
close ($FileH_Out);
print ("\n --- Output to $file_out ! \n \n");
}
---------------------------------------------------------
Thanks for any input.
Q
--
Ah-Q, made by God
AhQ@mail.utexas.edu
------------------------------
Date: 24 Jun 1999 22:12:36 +0200
From: Robert Andersson <robert@ling.gu.se>
Subject: Re: Afraid to ask about Y2K!
Message-Id: <ytfziu8ds6h7.fsf@kripke.ling.gu.se>
abigail@delanet.com (Abigail) writes:
>
> While these problems might be interesting, they are not at all Perl
> specific. Hence, they are OFF TOPIC in this newsgroup. They should be
> discussed in either general programming groups, or (better IMO) the
> specific Y2K groups.
>
> This group discusses Perl. Perl DOES NOT HAVE A Y2K PROBLEM. (But you
> keep shutting down your brain on that statement). Programmers might
> not be Y2K compliant, hence they should be discussed in newsgroups for
> programmers, not in the Perl newsgroups.
>
>
> Go away.
I don't think they hear you. You will have to shout a bit louder...
GO AWAY!
/Robert
--
Computational Linguistics
Department of Linguistics
Gvteborg University
------------------------------
Date: Thu, 24 Jun 1999 22:22:45 +0100
From: "Martin Quensel" <martin@adoma.se>
Subject: Re: Can not write my file to the server
Message-Id: <7ku58p$gnk$1@zingo.tninet.se>
Jim Ray skrev i meddelandet ...
>I am converting my UNIX perl scripts over to NT and I am having some
>problems.
>
>Right now the following code will create a file on the server. Under UNIX,
>no problem, under NT big problem.
>
>Here's the code...
>
> open(DATA, ">>$dataname");
>
> foreach $argsa(@Save)
> {
> print DATA ("$argsa\n");
> }
> close DATA;
>
Dont know about NT but you are not creating a file, just appending to an
existing one.
loose one of those ">" and your file will be created i think
Best regards
Martin Quensel
------------------------------
Date: Thu, 24 Jun 1999 21:03:22 GMT
From: Kazuma <kazuma@my-deja.com>
Subject: Re: Creating graphics on the fly for web pages
Message-Id: <7ku6ei$h8h$1@nnrp1.deja.com>
> If anyone has a fix that isn't too cumbersome, I would be very
> appreciative. I think my last resort is to run a cron job on the
> server which deletes all of the gif files in the temp directory.
One possible solution is not to save the image on the disk, but
generating the images on the fly on the web:
<IMG SRC="/cgi-bin/generateImage.pl?<PARAMETERS>">
Something similar (can be achieved with an SSI.
Best Regards,
Kazuma
--
Cos'e' il genio: fantasia, intuizione,
colpo d'occhio e velocita' d'esecuzione...
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 24 Jun 1999 21:21:46 GMT
From: Hasanuddin Tamir <hasant@trabas.co.id>
Subject: Re: deleting part of a string
Message-Id: <7ku7gu$hm4$1@nnrp1.deja.com>
In article <slrn7mqr82.k1b.abigail@alexandra.delanet.com>,
abigail@delanet.com wrote:
> Hasanuddin Tamir (hasant@trabas.co.id) wrote on MMCXIX September
MCMXCIII
> in
<URL:news:Pine.LNX.3.96.990621012916.17964A-100000@borg.intern.trabas.co
.id>:
> && On 18 Jun 1999, Abigail wrote:
> &&
> && abigail] JQ (pigs_can_fly@mindless.com) wrote on MMCXVII September
MCMXCIII in
> && abigail] <URL:news:376a79fc.62397051@news.cyberway.com.sg>:
> && abigail] //
> && abigail] // I need to delete whatever follows the LAST occurence of
/, including
> && abigail] // the last /
> && abigail]
> && abigail]
> && abigail] s{/[^/]*$}{};
> &&
> && or,
> &&
> && use File::Basename;
> && $string_without_whatever_follows_last_slash_including_itself =
> && dirname($original_string);
>
> Now, why would you use something that uses a module, is longer to
type,
> and isn't portable instead of 12 character substitution?
Longer to type, yes....
but beside to mererly show another way, I also
blindly assumed that he wanted to extract string
contains file path (or URL). And that's what
the module does. Talking about portable, the
module is platform independent.
--
Hasanuddin Tamir hasant@trabas.co.id
TRABAS www.trabas.co.id
==========================================
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 24 Jun 1999 15:17:00 -0500
From: bobn <bobn@interaccess.com>
Subject: Re: Does Perl have a future?
Message-Id: <3772923C.C915FD86@interaccess.com>
Tom Phoenix wrote:
> On Tue, 22 Jun 1999, Joe Chan wrote:
>
> > Hi, I was asking in my ISP's cgi newsgroup about the possibility of
> > installing mod_perl. This is the reply I got from another user
> >
> > 4) Development. Because a script is cached by the process you cannot
> > simply upload a new version and expect Apache to serve it correctly. I
> > think you have to either restart the Apache process or send it a
> > signal that causes it to flush the cache.
>
> True. There is a price to be paid for keeping things in the cache. But how
> often do you update your programs? How hard is it to signal that you've
> done so? It's not as hard as all that.
False, if you use Apache::Registry - the daemon code stat's the script file and
recompiles if the script time is later than the cache time.
------------------------------
Date: Thu, 24 Jun 1999 20:04:38 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: garbage collector
Message-Id: <377a8f0e.4185724@news.skynet.be>
vijoc@my-deja.com wrote:
>Is the perl garbage collector going to change
> anytime soon?
I've never had any problems with it so far. Circular references are
RARE. For speed reasons, I don't think it will change "anytime soon".
What's your problem with it?
Bart.
------------------------------
Date: Thu, 24 Jun 1999 23:16:01 +0200
From: Maan Bsat <bsat@iprolink.ch>
Subject: getting rid of a character
Message-Id: <3772A010.324C9FA5@iprolink.ch>
Hi,
I'm accessing data from a database server, and it's returning times with
an initial space. How can I get rid of it (I know it's the first
character in the string).
Thanks,
Maan
bsat@iprolink.ch
------------------------------
Date: Thu, 24 Jun 1999 22:14:49 +0100
From: "Martin Quensel" <martin@adoma.se>
Subject: Re: How can I get size of uploaded image via CGI?
Message-Id: <7ku4pt$fp2$1@zingo.tninet.se>
Brian Wagener skrev i meddelandet <37728B08.A67CFB5E@cs.fsu.edu>...
>I have made a script that allows a person to upload a graphic file,
>either a jpg or gif, and I need to be able to see if it is within the
>size specs. I don't see a way in perl to get info from a graphic file.
>I am using perl 5.005 if anyone can help me I would be very happy.
>Thanks in advance.
You could read the header, (this only works on GIF4s, you have to read the
specs for jpg, and figure out how jpg works)
open(FILE,"filname.gif");
binmode(FILE);
read(FILE,$id,3); # gif ID code is always "GIF"
read(FILE,$version,3); # verision 87 89a
read(FILE,$w,2); $width = unpack("s",$w); # width
read(FILE,$h,2); $height = unpack("s",$h); # hight
close(FILE);
I havent tried this code, since i dident write it to begin with...but i
guess it works......
MVH
Martin Quensel
------------------------------
Date: Thu, 24 Jun 1999 22:18:22 +0100
From: "Martin Quensel" <martin@adoma.se>
Subject: Re: How can I get size of uploaded image via CGI?
Message-Id: <7ku50i$g6j$1@zingo.tninet.se>
Brian Wagener skrev i meddelandet <37728B08.A67CFB5E@cs.fsu.edu>...
>I have made a script that allows a person to upload a graphic file,
>either a jpg or gif, and I need to be able to see if it is within the
>size specs. I don't see a way in perl to get info from a graphic file.
>I am using perl 5.005 if anyone can help me I would be very happy.
>Thanks in advance.
>Brian
or you can use /image::size/i
Best regards
Martin quensel
------------------------------
Date: Thu, 24 Jun 1999 14:37:25 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Brian Wagener <wagener@cs.fsu.edu>
Subject: Re: How can I get size of uploaded image via CGI?
Message-Id: <3772A515.D5A3081B@mail.cor.epa.gov>
[courtesy cc sent to poster]
Brian Wagener wrote:
>
> I have made a script that allows a person to upload a graphic file,
> either a jpg or gif, and I need to be able to see if it is within the
> size specs. I don't see a way in perl to get info from a graphic file.
> I am using perl 5.005 if anyone can help me I would be very happy.
Then you should be ecstatic to learn that there's already a Perl
module which will do just what you want. Image::Size . It
understands jpg, gif, and half a dozen other formats too.
Since you sent this from a linux box, I'm assuming you'll
want to go to CPAN and snag a copy.
> Thanks in advance.
You're welcome.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 24 Jun 1999 20:50:52 GMT
From: "SfpcC" <scrosby1@nycap.rr.com>
Subject: Kicking off remote program
Message-Id: <MSwc3.1020$qX3.14388@typhoon.nycap.rr.com>
Newbie post (got several programs running and am greatly impressed with Perl
& its community):
I want to be able to kick off either a .bat job or .pl program from one NT
server to another (also WinNT). The far end is complete (checks if tape
drive is empty using a utility that MUST run on the far server from the
command line. I MUST be able to kick it off from the local server at various
(different)_ times and can't leave a mess of AT jobs. The next project is
something similar, but to run an existing utility to check the status of
each drive in a Raid5 array (also runs from the command line on the remote
server).
What would be the most secure and cleanest means to do this with perl? If a
module is involved, which one?
------------------------------
Date: Thu, 24 Jun 1999 15:39:57 -0500
From: "Prasad M. Samarajiva" <prasad@lanka.ce.lsu.edu>
Subject: ksh to perl
Message-Id: <3772979D.E348A2CF@lanka.ce.lsu.edu>
Hi,
I want to translate a kornshell script to perl. Is there a utlility
like xxxx2yyyy for this. Regards.
Prasad
------------------------------
Date: Thu, 24 Jun 1999 15:00:15 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: prasad@lanka.ce.lsu.edu
Subject: Re: ksh to perl
Message-Id: <3772AA6F.441B8BF0@mail.cor.epa.gov>
[courtesy cc sent to poster]
Prasad M. Samarajiva wrote:
>
> Hi,
Howdy,
> I want to translate a kornshell script to perl. Is there a utlility
> like xxxx2yyyy for this. Regards.
No.
Why not, you ask? Well think about it. Shell scripts spend
all their time shuffling stuff from one external command to
another. Pipe City. That's incredibly inefficient in a pro-
gramming language which has all (or almost all) those tools
internally implemented. So shell scripts need to be
re-invented before translating them into Perl programs.
But feel free to write a ksh2perl program, if you want.
Then you could submit it to CPAN so others can benefit from
it as well.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 24 Jun 1999 15:41:44 -0500
From: Dale Henderson <dhenders@cpsgroup.com>
Subject: Re: localtime (perldoc -f localtime didn't help)
Message-Id: <87hfnxgwl3.fsf@camel.cpsgroup.com>
>>>>> "Arcane" == Arcane <arcane@verinet.com> writes:
Arcane> I have the following perl program that when run on the
Arcane> commandline it returns the correct time, but once it is
Arcane> run through apache the time is an hour behind. This only
Arcane> happens on one of my computers and not the other two. I
Arcane> would guess it's some kind of TZ setting or daylight
Arcane> savings setting, but I don't know where it would be
Arcane> located at.
Try using gmtime and see if the time-lapse still occurs. Or try
print scalar (localtime()) which will print the timezone.
------------------------------
Date: Thu, 24 Jun 1999 15:32:38 -0600
From: Arcane <arcane@verinet.com>
Subject: Re: localtime (perldoc -f localtime didn't help)
Message-Id: <3772A3F5.90323E50@verinet.com>
Dale Henderson wrote:
> >>>>> "Arcane" == Arcane <arcane@verinet.com> writes:
>
> Arcane> I have the following perl program that when run on the
> Arcane> commandline it returns the correct time, but once it is
> Arcane> run through apache the time is an hour behind. This only
> Arcane> happens on one of my computers and not the other two. I
> Arcane> would guess it's some kind of TZ setting or daylight
> Arcane> savings setting, but I don't know where it would be
> Arcane> located at.
>
> Try using gmtime and see if the time-lapse still occurs. Or try
> print scalar (localtime()) which will print the timezone.
Using gmtime shows the correct time in both areas. print scalar
(localtime()) doesn't return the timezone, but doing print `date` does.
Here is the output of the updated program:
Commandline:
--- Start ---
Content-Type: text/html
Current date and time is: 06-24-1999: 21:29:56<BR>
Current date and time is: 06-24-1999: 15:29:56<BR>
Thu Jun 24 15:29:56 1999<BR>
Thu Jun 24 15:29:56 MDT 1999
<BR>
--- End ---
Web site on same computer:
--- Start ---
Current date and time is: 06-24-1999: 21:30:51
Current date and time is: 06-24-1999: 14:30:51
Thu Jun 24 14:30:51 1999
Thu Jun 24 14:30:51 MST 1999
--- End ---
So somehow this is caused by daylight savings time being on in one of
them! We're using version 1.3.6 that came with Redhat 6.0 I believe.
Any ideas?
Here is the new source for the program:
--- Start ---
#!/usr/local/bin/perl -w
use strict;
use diagnostics;
print "Content-Type: text/html\n\n";
my ($second, $minute, $hour, $day, $month, $year) = gmtime();
$year += 1900;
$month++;
printf "Current date and time is: %2.2d-%2.2d-%4d:
%2.2d:%2.2d:%2.2d<BR>\n", $month, $day, $year, $hour, $minute, $second;
($second, $minute, $hour, $day, $month, $year) = (localtime);
$year += 1900;
$month++;
printf "Current date and time is: %2.2d-%2.2d-%4d:
%2.2d:%2.2d:%2.2d<BR>\n", $month, $day, $year, $hour, $minute, $second;
print scalar (localtime()) . "<BR>\n";
print `date` . "<BR>\n";
--- End ---
Thanks for the help!
Bryan
------------------------------
Date: Thu, 24 Jun 1999 14:55:14 -0500
From: bobn <bobn@interaccess.com>
Subject: Re: mod_perl require problem
Message-Id: <37728D22.42C1A931@interaccess.com>
There is a mod_perl FAQ or mod_perl traps FAQ (see perl.apache.org, if you
can) that mentions this - if a 'requir'ed script doesn't declare a package
name, only the first httpd that 'requires' it will actually be able to use
its stuff. Solutions are to make it a full blown module with it's own
package namespace and 'use' it or < I think, to just 'do' it.
HTH
- Bob N.
Jason Eggleston wrote:
> I have written a mod_perl cgi script that "require()"s another script.
> Unfortunately, the functions in the script are not always available.
> The script works about 1 out of every 2 tries.
------------------------------
Date: Thu, 24 Jun 1999 20:31:08 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Newbie - Perl books - which to get?
Message-Id: <gAwc3.120$Of3.28222@news.shore.net>
Ryan Corder <uucon@my-deja.com> wrote:
: I have to disagree. TY Perl in 21 Days, gave me a solid foundation. I agree
: that it is by FAR, not the best Perl book our there, but it gave me a start.
I got my CGI start from sams.net's "TY CGI Programming with Perl in 7
Days", and it enabled me to write functional CGI scripts in Perl, but that
doesn't mean it's a good book. It probably set me back around a year
because of the author's unfortunate habit of starting to explain the
solution to a problem and then moving on to something else halfway
through. I would have been far better off starting with a different book,
and the same is probably true for you, based on your comments.
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: Thu, 24 Jun 1999 21:14:50 GMT
From: o_klaus@my-deja.com
Subject: Newbie -> trying to wirte a Cgi for FTP-access ...
Message-Id: <7ku741$hgt$1@nnrp1.deja.com>
Hi !
I don't know really, whether I am right with
posting this request here, however :
I was going to write a Cgi for the following task(s):
Login to any specified FTP-Server
and copying a specified file to
another FTP server.
In general it seems to be something
like a Cgi-FTP-client.
I have written a HTML - file which
get's the required data via the POST
method, but I wasn't able to get it
to work with my ideas of writing a
Cgi in C.
Later I was told that C shouldn't be used
for such tasks - and that there is
a better language available - Perl.
It is said that Perl supports the getting
of variables directly.
But I don't know much Perl-syntax.
(I even wasn't able to intialize
a variable....)
And therefore I've posted this !
Perhaps you could help me :
Do you know how I have to write such
a procedure in C/Perl ?
Comments, suggestions and especially
*solutions* are always welcome !
Thx Olaf Klaus !
(If I am not right with posting this request here - please tell
me *where* I have to post it - thx)
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 24 Jun 1999 19:58:14 GMT
From: roberthp@my-deja.com
Subject: Newbie can't delete file
Message-Id: <7ku2kf$fmf$1@nnrp1.deja.com>
Hello:
All I'm trying to do is open a directory and delete a file. I can list
the directory contents ok, but when I try to "unlink" a file, I get an
error that the file doesn't exist. I don't get it. Could this be a
permissions problem, but with an error message that doesn't indicate as
such?
Any help would be greatly appreciated.
Thanks,
Robert
Code below:
------------------------------------
use POSIX;
opendir (DESKTOP, "c:/winnt/profiles/all users/desktop") ||
die "Open: $!";
foreach $name (sort readdir(DESKTOP)) {
print "$name\n";
}
unlink ("Acrobat Reader 4.0.lnk") ||
die "Delete: $!";
closedir (DESKTOP);
---------------------------------------------
The output produced is as follows:
Delete: No such file or directory at script line 8.
.
..
Acrobat Reader 4.0.lnk
Emergency Undelete.lnk
PrimalSCRIPT.lnk
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 24 Jun 1999 20:35:35 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Newbie can't delete file
Message-Id: <rEwc3.121$Of3.28222@news.shore.net>
roberthp@my-deja.com wrote:
: All I'm trying to do is open a directory and delete a file. I can list
: the directory contents ok, but when I try to "unlink" a file, I get an
: error that the file doesn't exist.
: use POSIX;
: opendir (DESKTOP, "c:/winnt/profiles/all users/desktop") ||
: die "Open: $!";
: foreach $name (sort readdir(DESKTOP)) {
: print "$name\n";
: }
: unlink ("Acrobat Reader 4.0.lnk") ||
: die "Delete: $!";
You need to chdir to the proper directory first, or feed unlink the
fully-qualified file name ("c:/winnt/..." etc).
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: Thu, 24 Jun 1999 20:53:45 GMT
From: Kazuma <kazuma@my-deja.com>
Subject: Re: newbie: Grab URL into PERL?
Message-Id: <7ku5sk$h0h$1@nnrp1.deja.com>
> How do I get the URL into the PERL script? In your example,
> you have set the URL to a predefined URL, I want to grab the
> URL from the calling page and stuff it into the URL variable.
This means that every page should show this header. In this case, I
suggest you to check out if there is any way to handle it directly from
the server.
For example, with Apache/mod_perl you can write a "PerlHandler" that
takes care of adding this 'line' top of each page, before the page is
sent to the client.
If you use a CGI module check the documentation of that module.
For example, with CGI.pm, the called url can be retrieved using 'url()'
use CGI;
my $CGI = new CGI;
my $url = $CGI->url();
# your code here
Best Regards,
Kazuma
--
Cos'e' il genio: fantasia, intuizione,
colpo d'occhio e velocita' d'esecuzione...
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 24 Jun 1999 14:39:28 -0700
From: "R. Moose" <radmoose@spam.spam.spam.not.bigfoot.com>
Subject: Re: newbie: Grab URL into PERL?
Message-Id: <nAxc3.1317$Sl3.71027@nuq-read.news.verio.net>
Cool! :)
Using your feedback, (as well as a couple other messages in the newsgroup),
I am now on my way with code samples, suggested web sites and books.
Thank you for your courteous replies.
"'o.o'"
Kazuma <kazuma@my-deja.com> wrote in message
news:7ku5sk$h0h$1@nnrp1.deja.com...
>
> > How do I get the URL into the PERL script? In your example,
> > you have set the URL to a predefined URL, I want to grab the
> > URL from the calling page and stuff it into the URL variable.
>
> This means that every page should show this header. In this case, I
> suggest you to check out if there is any way to handle it directly from
> the server.
> For example, with Apache/mod_perl you can write a "PerlHandler" that
> takes care of adding this 'line' top of each page, before the page is
> sent to the client.
>
> If you use a CGI module check the documentation of that module.
> For example, with CGI.pm, the called url can be retrieved using 'url()'
>
> use CGI;
> my $CGI = new CGI;
> my $url = $CGI->url();
> # your code here
>
> Best Regards,
> Kazuma
>
> --
> Cos'e' il genio: fantasia, intuizione,
> colpo d'occhio e velocita' d'esecuzione...
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
------------------------------
Date: Thu, 24 Jun 1999 17:02:58 +0100
From: Timotheus Itoi <itoi@cc.gatech.edu>
Subject: perl to executable
Message-Id: <377256B2.614D5210@cc.gatech.edu>
Is there a freeware that converts .pl to .exe like perl2exe does?
Thanks,
Tim
------------------------------
Date: Thu, 24 Jun 1999 19:51:29 GMT
From: tram@olympic.seas.ucla.edu (Tri Tram)
Subject: Re: Probably simple, but pulling hair out
Message-Id: <FDuKHt.950@seas.ucla.edu>
Using single quotes will not expand the variable $myvalue.
Using something like this:
print qq|<input type=hidden name="myfield" value=$hidden>|;
Michael Hill (l463520@lmtas.lmco.com) wrote:
> In my perl script I am trying to pass the value that is being stored to
> my variable.
> $myvalue="fresh";
> print '<input type=hidden name="myfield" value=$myvalue>';
> Of course what I get is $myvalue and not fresh.
> Thanks, Mike
--
-----------------------------------------------------------------
Tri Tram, Computer Science and Engineering at UCLA
http://www.seas.ucla.edu/~tram
------------------------------
Date: Thu, 24 Jun 1999 20:06:30 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Read a file starting a a certain point in the middle
Message-Id: <377b8f81.4301396@news.skynet.be>
Philip 'Yes, that's my address' Newton wrote:
>perldoc -f seek may help you; however, seek() only knows about bytes,
>not about lines.
Oh, doing a random seek(), and reading and ignoring the first line
(unless you seeked to the very start of the file) will get rid of the
half-line.
Bart.
------------------------------
Date: Thu, 24 Jun 1999 20:01:44 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Safe expression evaluation
Message-Id: <37798e98.4068129@news.skynet.be>
Tom Christiansen wrote:
>--
>If you want to see useful Perl examples, we can certainly arrange to have
>comp.lang.misc flooded with them, but I don't think that would help the
>advance of civilization. :-) --Larry Wall in <1992Mar5.180926.19041@netlabs.com>
"comp.lang.misc"?
Bart.
------------------------------
Date: Thu, 24 Jun 1999 13:18:31 -0700
From: "Robert Leonard" <stuntman@koan.com>
Subject: Send e-mail using Perl??
Message-Id: <930255512.643.31@news.remarQ.com>
I would like to write a perl script that would allow me to send an e-mail at
scheduled times using Activate's Perl for Windows...
Can anybody give me some pointers?? or some sample code?
Thanks!
------------------------------
Date: Thu, 24 Jun 1999 14:45:16 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Send e-mail using Perl??
Message-Id: <3772A6EC.790D770D@mail.cor.epa.gov>
Robert Leonard wrote:
>
> I would like to write a perl script that would allow me to send an e-mail at
> scheduled times using Activate's Perl for Windows...
>
> Can anybody give me some pointers?? or some sample code?
How about some pointers to sample code?
Go to the HTML online docs that ActiveState installed on your
machine when you loaded ActiveState Perl. You can get there
from your Start Menu, unless you mucked with the installation.
In the ActivePerl FAQ, the fifth section (titled "Windows 95/NT"
oddly enough) has the questions you asked, and the answers you
want:
"How do I send email from Perl for Win32?"
"How do I schedule jobs on Win32 platforms?"
In fact, they're back to back. And they both have sample
code too.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 24 Jun 1999 19:45:09 GMT
From: jhefferon@my-deja.com
Subject: validating a regexp from a CGI form
Message-Id: <7ku1s2$fdj$1@nnrp1.deja.com>
I have a web page and Perl CGI script that allows users to search an
archive for files, by name. So the script gets a parameter which is
placed into $searchstring, that is a regexp, and somewhere it sees if
"$dirname/$fn" =~ /$searchstring/
for each directory, file pair. I see in the error_log that a lot of
users are trying regexp's like "*.txt", which of course bombs the above
line and they get a terminated return page.
So I'd like to test $searchstring for validity. I know that
defined(exec `/$searchstring/`) will do, but I think that the CGI FAQ
says (very last item) that this is unsafe. If so, what is safe?
I scanned the FAQ's and recent messages on this group, and saw
references to the Safe module. I pulled it down, but it won't compile
for me (I have Linux, RH 6). No doubt I could figure it out, but I had
hoped to install my scripts on a few different sites that are archive
mirrors; I'm not sure that I can help the owners of these machines to
compile Safe on all of them. Is this the best/only solution?
Thanks,
Jim Hefferon jim@joshua.smcvt.edu
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 24 Jun 1999 20:10:04 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: validating a regexp from a CGI form
Message-Id: <377c900f.4443048@news.skynet.be>
jhefferon@my-deja.com wrote:
> "$dirname/$fn" =~ /$searchstring/
>for each directory, file pair. I see in the error_log that a lot of
>users are trying regexp's like "*.txt", which of course bombs the above
>line and they get a terminated return page.
Try eval(). Actually, try something like:
$sub = eval "sub { /$regexp/ }";
If $sub is undefined afterwards, it failed.
You can test each line by doing
if($sub->();) { ... }
where the sub, as it is, tests $_.
Bart.
------------------------------
Date: 24 Jun 1999 15:23:35 -0500
From: Dale Henderson <dhenders@cpsgroup.com>
Subject: Re: Viral matters [completely off-topic]
Message-Id: <87iu8dgxfc.fsf@camel.cpsgroup.com>
>>>>> "Tom" == Tom Christiansen <tchrist@mox.perl.com> writes:
Tom> Well, I call it a syntax error, but beyond that, a confusion
Tom> about who gets to do what to what.
Tom> If I send you a piece of mail saying to run:
Tom> rm -rf *
Tom> And you do that, it's hardly a virus. And you deserve to
Tom> die. I'm so tired of the script kiddies who think Unix only
Tom> lacks viruses because people don't care to write them.
Tom> They're fundamentally missing the point of privilege
Tom> management.
No it wouldn't be a virus. However the script I posted IS a virus
in that it is self-replicating. If someone where to run it in a
dirctory full of perl scripts that they owned. Every script would
be infected by the virus. (Assuming of course you add an opendir
to the top (dumb dumb dumb (hey this is starting to look like
lisp))).
I wouldn't expect someone to run this if it were not more
cleverly hidden (i.e. attached to the end of a more useful
script.)
I never said that this virus would be effective under a Unix
system. In order to do any real damage it would require root
access. I realize that. However, it would be possible for some
luser to run this script and destroy anything that THEY own. Of
course it might be very effective under a windows system which
offers no protection.
I am very aware of why there are few to no virus written for Unix
systems. It is because it would be impractical. As I've said
before, the only way to do any real damage on a Unix box is with
root access. And the practicality of hacking root in a virus is
nil.
(For the curious there are 2 bugs in my script. One is the opendir I
mention above. And the virus will attach itself to a script
multiple times. Of course the script won't work on any script
that uses strict :)
------------------------------
Date: 25 Jun 1999 00:46:20 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Wraparound Array/list...
Message-Id: <oeelnd95l1v.fsf@alpha.hut.fi>
lr@hpl.hp.com (Larry Rosler) writes:
> [Posted and a courtesy copy mailed.]
>
> In article <3771fc5a.489109662@24.0.3.71> on Thu, 24 Jun 1999 17:39:27
> GMT, Mitch <portboy@home.com> says...
> > I'd like to have an wraparound array that consists of five elements
> > (strings).
>
> my @array;
> push @array, 'new string';
> shift @array if @array > 5;
>
> Methinks you are asking too much here for simple answers, meanwhile
> avoiding reading the docs and trying things out yourself.
Just for the hell of it (kids, don't try this with too old Perl,
5.005_03 is modern enough) (yes, the PUSH method could be optimized):
package Ring;
sub TIEARRAY {
my ($class, $size) = @_;
bless {
size => $size,
ring => [],
}, $class;
}
sub PUSH {
my $ring = shift;
for my $thing (@_) {
shift @{$ring->{ring}} if @{$ring->{ring}} == $ring->{size};
push @{$ring->{ring}}, $thing;
}
}
sub FETCHSIZE {
my ($ring) = @_;
return @{$ring->{ring}};
}
sub FETCH {
my ($ring, $index) = @_;
die __PACKAGE__ . "::FETCH: bad index $index\n"
if $index < 0 || $index >= $ring->{size};
$ring->{ring}->[$index];
}
package main;
tie @Ring, Ring, 3;
push @Ring, "a".."e";
print "Ring = @Ring\n";
--
$jhi++; # http://www.iki.fi/jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: Thu, 24 Jun 1999 22:24:52 +0100
From: "Martin Quensel" <martin@adoma.se>
Subject: Re: WWWBoard for NT
Message-Id: <7ku5cr$h0m$1@zingo.tninet.se>
David Spivey skrev i meddelandet <37727687.0@news.hcs.net>...
>I am looking for somewhere that has a message board (WWWBoard) that I can
>download to use on my NT Server v. 4.0. All of the WWWboard's online are
>comaptible only with Unix and I need one that has been written with NT in
>mind.
And your Perl question is??
have you tried www.altavista.com ?
best regards martin quensel
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 6120
**************************************