[12535] in Perl-Users-Digest
Perl-Users Digest, Issue: 6135 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 26 11:20:31 1999
Date: Sat, 26 Jun 99 08:00:22 -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 Sat, 26 Jun 1999 Volume: 8 Number: 6135
Today's topics:
Re: "Slurping" a .jpg file <gellyfish@gellyfish.com>
Re: 2 simple (not to me tho) questions zenin@bawdycaste.org
Re: A month behind using localtime(time) ? (markus)
Re: Beginner's Question <edenkers@ktis.net>
Re: can't save process output.. <gellyfish@gellyfish.com>
Re: Determining limit on size of data that a Perl CGI p (Benjamin Franz)
Re: dynaloader <gellyfish@gellyfish.com>
Re: FAQs and attitudes (was Re: How can I read a whole (M.J.T. Guy)
Re: faqs, beginner question <gellyfish@gellyfish.com>
Re: Having a little problem with changing multiple line <gellyfish@gellyfish.com>
Re: hello looking for script <gellyfish@gellyfish.com>
HELP recursion, directories & PCNFS <william_holmes@nospamrocketmail.com.nospam>
help with Net::Telnet (Daniela Dumitru)
how to store tree structure <nedred@my-deja.com>
Re: how to store tree structure <gellyfish@gellyfish.com>
Multiple user login <dschoen@adelphia.net>
Net::RawIP <korjoan1@babylon.dat.tele.fi>
Re: Newbie - Using Perl & Digital Teamlinks (Darren Millin)
Newbie question about Net::Ping (Darren Millin)
Re: Newbie question about Net::Ping <gellyfish@gellyfish.com>
Re: newbie: Grab URL into PERL? <stephen@scriptsavant.com>
Re: Piping through Less. <gellyfish@gellyfish.com>
Re: Send e-mail using Perl?? <gellyfish@gellyfish.com>
Re: The Perlfaq Man Can! <gellyfish@gellyfish.com>
Re: Using Tk or Win32::GUI in Win32 <gellyfish@gellyfish.com>
Re: validating a regexp from a CGI form (Randal L. Schwartz)
Very easy integer question <cal@spacemoose.com>
Re: Very easy integer question <rick.delaney@home.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Jun 1999 12:16:37 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: "Slurping" a .jpg file
Message-Id: <7l2gb5$26a$1@gellyfish.btinternet.com>
On Sat, 26 Jun 1999 14:48:22 +0500 Faisal Nasim wrote:
> Rich Campbell <rcampbel@gbtech.net> wrote in message
> news:01bebf6c$26ca06e0$c5dfffcc@upstairs...
>> I want to modify some of the internal stuff in a ".jpg" file:
>>
>> open(FD, "picture.jpg");
>>
>> undef $/;
>>
>> $file = <FD>;
>>
>> but no go (but it works fine for a .txt file)
>>
>
>
> open FILE , "blah.jpg";
> binmode FILE;
> $content = join '' , <FILE>;
>
I cant see any point in doing that join when the original poster had
it right with the:
undef $/;
All that he was missing was the binmode().
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 26 Jun 1999 13:52:25 GMT
From: zenin@bawdycaste.org
Subject: Re: 2 simple (not to me tho) questions
Message-Id: <930405378.242945@thrush.omix.com>
Daniel Grisinger <dgris@moiraine.dimensional.com> wrote:
: ebohlman@netcom.com (Eric Bohlman) writes:
:> Olivier Dehon [8026867] (odehon@in-csg58.uk.jpmorgan.com) wrote:
:> : What about double-quoted strings where no interpolation is needed?
:> : Is that a bad practice and should one use single quotes instead?
:>
:> It's purely a matter of style.
: <snip>
:
: Lately I've been using q() and qq() instead of '' or "". I've
: even been using them in place of heredocs because I can avoid
: the ugly left-justified end token.
You mean like this?
{
print <<" TheEnd";
some text
TheEnd
}
Although I'm not sure if this is a good thing or not. :-/
--
-Zenin (zenin@archive.rhps.org) "Hey, are you one of those Linux coders?"
"Nyet. Linux coder in next office."
"Good man. Ignore the screams."
--www.userfriendly.org
------------------------------
Date: 26 Jun 1999 14:09:56 GMT
From: drbrain@ziemlich.org (markus)
Subject: Re: A month behind using localtime(time) ?
Message-Id: <slrn7n9npk.82k.drbrain@josefine.ben.tuwien.ac.at>
In article <slrn7n0t7l.k1b.abigail@alexandra.delanet.com>, Abigail wrote:
>perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
> ${qq$\x5F$} = q 97265646f9 and s g..g;
> qq e\x63\x68\x72\x20\x30\x78$&eggee;
> {eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'
Holy shit ! Where the heck do you have the signatuers from ? Or, how
do you create a new every time ? If i remember correctly you don't post
signature with perl code more than time.
I guess you have some script which generates, isnt it that way ? :-)
cheers,
Markus
--
(0- OpenSource
//\ join the revolution
v_/_
------------------------------
Date: Sat, 26 Jun 1999 09:49:19 -0500
From: "Erik Denkers" <edenkers@ktis.net>
Subject: Re: Beginner's Question
Message-Id: <7l2p0f$fd4$1@dumber.ktis.net>
I am beginning to understand about references. Thanks
to all who have taken to time to respond and who have
given me some examples to help an old programmer
learn a new language.
Again, many thanks!
Erik
Erik Denkers <edenkers@ktis.net> wrote in message
news:7l0cpp$g33$1@dumber.ktis.net...
> I understand how to define/create scalar variables/arrays. I understand
how
> to define/create references to variables/arrays. Why would you create and
> use
> references when you could just call the variable by it's original name?
>
> Sorry if I'm being anal!
>
> Erik
> edenkers at kits.net
>
>
------------------------------
Date: 26 Jun 1999 12:58:44 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: can't save process output..
Message-Id: <7l2iq4$26n$1@gellyfish.btinternet.com>
On Fri, 25 Jun 1999 15:43:11 GMT amidalla@my-deja.com wrote:
> If the program being initiated is a simple perl script with output, it
> works just fine, but with this program running, it's output just gets
> displayed to the screen and never saved to the $output variable..
>
> I'm trying to gather output like this..
>
<snip code that doesnt work>
>
> why doesn't this work?? Suspect looper.exe writes to STDERR but still
> can't capture it's output. I tried just about every method listed in
> perlfaq8-> "How can I capture STDERR from an external command?"
>
> my ultimate goal is to see if the process (looper.exe) has run to
> completion. I use Win32::Process::Create to start the process, but I
> can't seem to get different exit code for a process that is terminated
> via the $ProcessObj->Kill function as opposed to a proper exit due to
> the process successfully ending.
If the program that you are running is a Win32 application then it may
well be that it has a completely different idea of STDIN & STDOUT
(if any) to that of your Perl program - in that case all bets are off.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 26 Jun 1999 13:50:58 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: Determining limit on size of data that a Perl CGI program can receive from a textarea form element
Message-Id: <6V4d3.2107$or1.150949@typhoon-sf.snfc21.pbi.net>
In article <wt0d3.1309$vP.9248@ozemail.com.au>,
Neale Morison <nmorison@ozemail.com.au> wrote:
>
>I have put together a Perl CGI script that uses a series of HTML Forms for
>web page management. It does everything I want, except for the bit where I
>want to allow users to edit the contents of the web page in a textarea form
>element.
[...]
>It seems to happen if the data exceeds a certain size, which varies between
>15K and 40K.
>I'd love to edit files up to about 200K.
>Can anyone set me on the right track? Does the limitation come from:
[...]
>- The browser
Most browser implementations have fairly low limits (~32K) on the size
of 'TEXTAREA' fields. The limit is even lower for 'INPUT TYPE=TEXT'
fields. Additionally, 'GET' forms have low implementation limits on
many web browsers (and some web servers) - as low as ~256 bytes on
some browsers.
--
Benjamin Franz
------------------------------
Date: 26 Jun 1999 12:37:23 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: dynaloader
Message-Id: <7l2hi3$26g$1@gellyfish.btinternet.com>
On Wed, 23 Jun 1999 12:31:20 GMT francesc_guasch@my-deja.com wrote:
> I'm trying to install a module and it complains this way:
> install_driver(mysql) failed: Can't load
> '../blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mysql: File not
> found at /usr/lib/perl5/5.00503/i586-linux/DynaLoader.pm line 169.
I would say that you havent previously installed your MySQL correctly
- I havent got it here to try right now. I think you will need to
download the MySQL distribution from wherever it comes from
(<http://www.tsx.com> ? I cant remember) and install that first on
your machine - I recall that it also installs the DBD module too ..
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 26 Jun 1999 14:20:51 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: FAQs and attitudes (was Re: How can I read a whole file in one go ?)
Message-Id: <7l2nk3$i65$1@pegasus.csx.cam.ac.uk>
Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
>Tom Christiansen <tchrist@mox.perl.com> wrote:
>
>> % man perlfaq5
>>
>
>> This tiny but expedient solution is neat, clean, and portable to
>> all systems that you've bothered to install decent tools on,
>> even if you are a Prisoner of Bill. For those die-hards PoBs
>> who've paid their billtax and refuse to use the toolbox, or who
>> like writing complicated code for job security, you can of
>> course read the file manually.
>>
>
>I hope that this is Tom's own private copy of the FAQs, and that terms
>such as "Prisoner of Bill" and "billtax" are not actually present in
>Perl's standard documentation, where they would be entirely
>inappropriate.
It's in the current development version perl5.005_57 .
Mike Guy
------------------------------
Date: 26 Jun 1999 13:15:01 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: faqs, beginner question
Message-Id: <7l2jol$29t$1@gellyfish.btinternet.com>
On Sat, 26 Jun 1999 03:15:57 GMT Jon Bell wrote:
> David Cassell <cassell@mail.cor.epa.gov> wrote:
>>
>>In fact, Perl has snitched good things from a slew of different
>>programming languages and tools.
>
> In other words, Perl is a "mongrel". :-)
>
> (Not that there's anything *wrong* with that...)
>
Well most of us would prefer to describe it as 'selective breeding'.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 26 Jun 1999 14:22:31 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Having a little problem with changing multiple lines in an html file
Message-Id: <7l2nn7$49v$1@gellyfish.btinternet.com>
On Mon, 21 Jun 1999 21:51:17 -0300 Vox wrote:
> I am making a program that can read the beginning and end of tags and
> replace the text in between, but I ran into a problem when reading more than
> one line
>
If you are looking to manipulate HTML then you really should be looking
at using the module HTML::Parser available from CPAN - you will find
very quickly that HTML as she is commonly writ is too complicated for
a simple regular expression ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 26 Jun 1999 12:28:52 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: hello looking for script
Message-Id: <7l2h24$26d$1@gellyfish.btinternet.com>
On Tue, 22 Jun 1999 09:48:41 -0700 David Cassell wrote:
> P-aCMa-N@webtv.net wrote:
>>
>> theres a script that lets you Upload to any server that has ftp access
>> to your account on that server. theres places called TransLoader and
>> FreeLoader. can someone please find this fo rme. i need it and im on
>> webtv which is a needed thing. heres one of the addys.
>> http://transload.starblvd.net i dont know if u can view the page but if
>> u need more info please post or email me. thannx :^)
>
<snip>
> Furthermore, if you're using a WebTV, will you be able to
> *use* any such script on your machine? The WebTV is
> extremely limited in its utility and its system capabilities.
> I hope that you've looked into this already adn know that it
> will work for you.
>
I think that is actually the point - the WebTV *is* extremely limited
and some of its slightly more clever users have struck upon the
possibility that some of its shortcomings might be overcome by using
programs under the CGI on some webserver to supply this lack. Of course
some of these requirements are plain ridiculous - remember the 'telnet
as a CGI' madman ? - but they will try (and are often trying too :)
and, perhaps due to some mindset peculiar to the WebTV user, get a
bit funny when we try to disabuse them of some of the strange notions
they have acquired ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Wed, 23 Jun 1999 13:28:15 -0700
From: william <william_holmes@nospamrocketmail.com.nospam>
Subject: HELP recursion, directories & PCNFS
Message-Id: <3771435F.931636AD@nospamrocketmail.com.nospam>
Hi,
my goal is to write a cgi script that will display available directories
as HREF links
given a static directory to recurse down.
I have been using from the cookbook.
#!/usr/bin/perl -w
@dirname ="/WWW"
use File::Find;
find sub{print $File::Find::name, -d && '/', "\n"}, @dirname;
This works fine on the SUN, but as soon as I change the
@dirname to a PC NFS link all I get is the directory names
and file name directly under that directory. It no longer
recurses down into the sub directories.
Any pointers, help, information gladly accepted.
Thank you
William.
------------------------------
Date: Sat, 26 Jun 99 15:56:05 GMT
From: ddumitru@lucent.com (Daniela Dumitru)
Subject: help with Net::Telnet
Message-Id: <7l2po5$620@nntpb.cb.lucent.com>
Hi,
I'm trying to use the telnet module from CPAN but I can't read the output of
the commands issued while in telnet session.
I've used the dump_log method to debug it and I can see in the log the
commands sent (echoed) and some data (the result of the commands), but I can't
capture it in the script. I've also, checked that I have a sucessfull
connection and the commands are executed by redirecting the output of the
command on the remote machine.
To save the output of the commands, I've tried to use:
@output1 = $t->cmd("dir");
@output1 = $t->cmd("dir",@output2);
but, both @output1 and @output2 return empty arrays.
I'm using perl version 5.005_02, on Windows NT.
Any help is greatly appreciated
Thanks,
Daniela
------------------------------
Date: Sat, 26 Jun 1999 12:22:59 GMT
From: Nedret <nedred@my-deja.com>
Subject: how to store tree structure
Message-Id: <7l2gn0$uts$1@nnrp1.deja.com>
Any ideas how to store tree structure? Then how can reach info in the
tree, searches, storing of new data...
--
Nedret
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 26 Jun 1999 14:00:29 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: how to store tree structure
Message-Id: <7l2mdt$477$1@gellyfish.btinternet.com>
On Sat, 26 Jun 1999 12:22:59 GMT Nedret wrote:
> Any ideas how to store tree structure? Then how can reach info in the
> tree, searches, storing of new data...
>
You might want to start by looking at the manpages :
perldata
perlref
perldsc
perllol
Wherein you will find described the ways that complex data structures
can be handle in Perl.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 26 Jun 1999 14:01:16 GMT
From: "David Schoen" <dschoen@adelphia.net>
Subject: Multiple user login
Message-Id: <M25d3.4793$ll5.36576@server1.news.adelphia.net>
Hello:
Can anyone help me with what should be an easy thing, but is beyond my
novice abilities? I have constructed a form that calls on a script that
requires that a password and user number by typed in, before allowing access
to some information that the script will feed the person.
Here is the key line:
if (($input{'pass'} ne "library") || ($input{'id'} != "123"))
This script works with the line like this. If you type on the form
"library" as the password and then the number "123" as the ID, the action
is processed in the way I want it to be.
The problem is that I will have multiple ids, so how do I write that line so
that
the computer will look for "library as the password and either of any of a
series of numbers that I enable ahead of time. In regular boolean logic:
library and (123 or 125 or 120 or 130)
I have tried a variety of ways to string id numbers with the II operator to
the last part of the statement, but I am failing. Any guidance would be
appreciated.
Thanks a lot for your time,
David Schoen
dschoen@adelphia.net
------------------------------
Date: Sat, 26 Jun 1999 14:36:01 GMT
From: Antti-Jussi Korjonen <korjoan1@babylon.dat.tele.fi>
Subject: Net::RawIP
Message-Id: <lz5d3.55$rC5.181@read2.inet.fi>
Hi!
Is it possible to specify ethernet frame checksum using RawIP module?
I'm able to specify source and destination mac addresses, but cannot
specify FCS checksum. Does anybody else know a way to generate otherwise
valid ethernet packet except the FCS being faulty?
--
__/ __/ __/ __/ Antti-Jussi Korjonen
__/ __/ __/ __/ __/__/ Kaarikatu 15-17 A9
__/ __/ __/ __/ __/__/ 33100 TAMPERE, FINLAND
__/ __/ __/__/__/ __/ __/ tel. +358-(0)40-538 5730
Antti-Jussi.Korjonen@sonera.fi
------------------------------
Date: Sat, 26 Jun 1999 13:22:52 GMT
From: D.Millin@BTInternet.com (Darren Millin)
Subject: Re: Newbie - Using Perl & Digital Teamlinks
Message-Id: <3774d0c8.393827@news.btinternet.com>
On Fri, 25 Jun 1999 14:27:37 -0700, David Cassell
<cassell@mail.cor.epa.gov> wrote:
>Darren Millin wrote:
>>
>> I am trying to write a script that will allow me to send e-mail to
>> accounts on held on a Digital Teamlinks system. As far as
>> i am aware, this system uses x400 mail. Can anyone give
>> me some pointers to resources, modules or docs that would
>> help ?
>>
>> I have looked throught the FAQ's, CPAN, RFC's and 'Learning Perl'.
>> These cover the use SMTP and sendmail, but I did not see
>> anything on linking to any e-mail system other than
>> POP & SMTP.
>
>I must be missing something. You say that you want to send
>e-mail to those accounts. Even if they are using X.400, you
>should be able to send them e-mail the same way you send e-mail
>to anyone else. You'll just have to get the addressing correct
>in your To: line. And if they're all on a single Teamlinks
>system, then won't they all have identical ADMD and PRMD
>values in that format? So you won't have to do any substitutions
>in that part of the address string.
>
>HTH,
>David
David,
Thanks for replying. I've been experimenting with Perl for the
last couple of week. I wasn't sure wether I could use the same
same method as sending internet e-mail. I think that I also
need to re-install ActiveState 517 as scripts working in the
house don't run in work.
Thanks again,
Darren
------------------------------
Date: Sat, 26 Jun 1999 13:29:25 GMT
From: D.Millin@BTInternet.com (Darren Millin)
Subject: Newbie question about Net::Ping
Message-Id: <3775d430.1266105@news.btinternet.com>
I am using ActiveState 517 on a machine running Windows 95.
This machine is connected to a network that allows users to
access and oracle database running on unix.
I am currently trying to create a script that will ping all the
machines on the network. So far this script works at home :
use Net::Ping;
# file containing ip addresses
$Input = 'ip.txt';
open (IN,$Input);
$p = Net::Ping->new("icmp");
while(<IN>){
if ($p->ping($_,2)){
print "$_ is alive.\n"
}
}
$p->close();
close(IN);
$Pause = <STDIN>;
When I use this script in work, half the machines that I ping
don't respond. When I ping using the ping command in windows,
the machines that don't respond are reachable.
I have tried various timeout values and protocol, but this does
not make a difference. Does anyone have any suggestions.
Thanks in advance,
Darren Millin
------------------------------
Date: 26 Jun 1999 14:37:05 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Newbie question about Net::Ping
Message-Id: <7l2oih$4a2$1@gellyfish.btinternet.com>
On Sat, 26 Jun 1999 13:29:25 GMT Darren Millin wrote:
>
> I am currently trying to create a script that will ping all the
> machines on the network. So far this script works at home :
>
>
You should put a shebang line with -w *even* on Windows,
current thought would have it that you should use the 'strict' pragma
as well.
> use Net::Ping;
>
> # file containing ip addresses
> $Input = 'ip.txt';
>
> open (IN,$Input);
>
You really *must* check whether your open succeeded or not - in this
case carrying on with your program would be useless so you should:
open(IN,$Input) || die "Cant open $Input - $!\n";
> $p = Net::Ping->new("icmp");
>
> while(<IN>){
>
You missed out the chomp() here - IP addresses dont have newlines
on the end.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 26 Jun 1999 13:47:08 GMT
From: "Stephen Brown" <stephen@scriptsavant.com>
Subject: Re: newbie: Grab URL into PERL?
Message-Id: <wR4d3.46$fj6.95@news.flash.net>
If all you need is the URL, and don't have any need of the other wonderful
functions of CGI.pm, try simply using the variable $ENV{HTTP_REFERER}. Here
is a bit of code I use to see what all the environment varialbes are on the
server I am using. Call it with a web form to make sure that keys like
HTTP_REFERER are available.
# !/usr/local/bin/perl
# Stephen Brown <stephen@scriptsavant.com>
use strict vars;
print "Content-Type: text/html\n\n";
print <<EndPrint1;
<html><head><title>Environment Variables</title></head>
<body bgcolor=#FFFFFF>
<h1>Environment Variables (\%ENV)</h1>
EndPrint1
print "Using Perl version $]<br>\n";
foreach (sort keys %ENV) {
print "$_ = $ENV{$_}<br>\n";
}
print "<h1>Search Paths (\@INC)</h1>";
foreach (@INC) {
print "$_<br>\n";
}
print "</body></html>";
Stephen Brown
In article <z2uc3.1284$Sl3.69430@nuq-read.news.verio.net> , "R. Moose"
<radmoose@spam.spam.spam.not.bigfoot.com> wrote:
>Thanks for the reply. Please see my comments inline...
>
>
>Kazuma <kazuma@my-deja.com> wrote in message
>news:7krm13$k1m$1@nnrp1.deja.com...
>>
>> > My problem is:
>> > I want to grab the calling URL and parse it inside of PERL.
>> > [...]
>> > YOU ARE HERE >> BOOKS >> BN >> PERL
>> > [...]
>> > But the main part that has me stuck is getting the
>> > full URL into the PERL script.
>[SNIP]
>> my $url = "http://www.myurl.it/dir/page.html";
>> my ($protocol, $site, @infos) = split(/\/+/, $url);
>[SNIP]
>
>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.
>
>> The last "if" is important because you can have a url
>> like "http://www.myurl.it"...
>>
>
>Thanks for the actual code and information as well as the info about the
>possible problem of it being called from a base URL. I apreciate the
>direction and feedback.
>
>
>
>
------------------------------
Date: 26 Jun 1999 13:54:49 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Piping through Less.
Message-Id: <7l2m39$472$1@gellyfish.btinternet.com>
On Mon, 21 Jun 1999 17:47:48 -0500 ktb wrote:
> I have the following script which works fine but I can't figure out how
> to pipe the output from the program to 'less' on my Linux system so I
> can view all the output. I've found I can use,
Having looked at the rest of this thread I just couldnt bear it any more
so here is my take on the matter :
#!/usr/bin/perl -w
use strict;
my $command = '/usr/bin/zgrep -i';
my $path = '/usr/man/man1/perl*gz';
my $pager = '/usr/bin/less';
my $string = shift;
unless($string)
{
print 'Please enter your search string : ';
$string = <STDIN>;
chomp($string);
}
$SIG{PIPE} = sub {
close(IN) if *IN;
close(OUT) if *OUT;
exit;
};
open(IN,"$command $string $path 2>/dev/null|")
|| die "Couldnt fork for $command - $!\n";
open(OUT,"| $pager ")
|| die "Couldnt fork for $pager - $!\n";
$| = 1;
while (<IN>)
{
print OUT ;
}
close(OUT) || die "Error in $pager - $!\n";
close(IN) || die "Error in $command - $!\n";
You will notice that I have left out the processing in the read loop
because I could work out what you were trying to there - also the
more astute observer will notice that while I have handled the
'Broken pipe' to less I have swept that of zgrep under the carpet
because it is itself a shell script and I gave up trying to handle
that ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 26 Jun 1999 12:49:34 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Send e-mail using Perl??
Message-Id: <7l2i8u$26k$1@gellyfish.btinternet.com>
On 24 Jun 1999 16:46:37 -0700 Tom Christiansen wrote:
> Prisoners of Bill seek to teach pigs to sing ,,,
But if we could get them to teach the pigs 'The Perlfaq man' then this
will have two great benefits a) that the enterprise will consume
so much time they will have none left to post FAQs here b) that the
message will perhaps sink home after the necessary repetition (on
the Pigs if not the PoBs - 'In Cyberspace no-one knows you are a Pig' ).
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 26 Jun 1999 13:06:49 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: The Perlfaq Man Can!
Message-Id: <7l2j99$26s$1@gellyfish.btinternet.com>
On Sat, 26 Jun 1999 10:59:49 GMT Bart Lateur wrote:
> Tom Christiansen wrote:
>
>> David Cassell <cassell@mail.cor.epa.gov> writes:
>>:"Tom Christiansen IS Gene Wilder!" - Rex Reed
>>
>>Thank God. I was afraid it'd be Barry Manilow.
>
> Hmmm... I would have tought it was Sammy Davis Jr.
>
I was thinking more James Coburg ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 26 Jun 1999 14:04:25 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Using Tk or Win32::GUI in Win32
Message-Id: <7l2ml9$47a$1@gellyfish.btinternet.com>
On Fri, 25 Jun 1999 07:31:19 GMT R.Joseph wrote:
> I recently downloaded ActivePerl from ActiveState.com. I got it
> working fine, but it says in the documentation that there is a way to
> use the Tk module to do GUI programming in Win! Also, I downloaded a
> module called Win32::GUI. I was able to produce a MsgBox call with it
> and get it to actually DO a message box...but that was about it =).
> Any help on this wierd yet interesting subject is greatly appreciated!
>
The example code that comes with Win32::GUI shows how to do quite a
variety of the things that you would want to do - on the other hand
if you are looking at making code that is portable between Unix and
Win32 then you probably will want to use Tk - you can install the
Tk module for Activestate with PPM however beware as it does take a
while ....
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 26 Jun 1999 06:20:24 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: validating a regexp from a CGI form
Message-Id: <m1d7yjcd47.fsf@halfdome.holdit.com>
>>>>> "Bart" == Bart Lateur <bart.lateur@skynet.be> writes:
Bart> Randal L. Schwartz wrote:
Bart> Try eval(). Actually, try something like:
>>
Bart> $sub = eval "sub { /$regexp/ }";
>>
>> I wouldn't do that. What if $regexp is "/; system 'rm -rf /'; /" ?
Bart> Touchi. At first glance, I can see two ways out of this.
Bart> A) Make it "safe", by disarming the slash. Something like:
Bart> $regexp =~ s{(\\.)|/}{ $1 || "\\/" }ges;
That's not enough. What if $regexp is
"@{[system q{rm ...}]}"
And you can't tell me you'll now backwhack all @ and $, because we
need $ for end-of-string.
Bart> B) Delay the compilation of the regex. Hey, I might throw in closures as
Bart> well. :-)
Bart> sub regexsub ($) {
Bart> my($regex) = @_;
Bart> return eval "sub { /\$regex/o }";
Bart> }
Yes, this looks extremely familiar. :)
[See Effective Perl Programming.]
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Sat, 26 Jun 1999 23:14:59 +0900
From: Cal Bond <cal@spacemoose.com>
Subject: Very easy integer question
Message-Id: <3774E063.29DB@spacemoose.com>
Hi-
Could anyone tell me the command/prefix or whatever to get a number from
a calculation to be calculated to 2 decimal places. Ive just cut and
pasted bits of code in so don't know how to actually change this myself,
right now Ive got
$blah=int($x/$y)
but I'd like it to go to 2 decimals. Thanks lots if you can help me out
Cal
------------------------------
Date: Sat, 26 Jun 1999 14:51:12 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Very easy integer question
Message-Id: <3774E8A3.7A987CA3@home.com>
[posted & mailed]
Cal Bond wrote:
>
> Hi-
> Could anyone tell me the command/prefix or whatever to get a number from
> a calculation to be calculated to 2 decimal places.
perldoc -f sprintf
--
Rick Delaney
rick.delaney@home.com
------------------------------
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 6135
**************************************