[13600] in Perl-Users-Digest
Perl-Users Digest, Issue: 1010 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 7 05:05:44 1999
Date: Thu, 7 Oct 1999 02:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <939287109-v9-i1010@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 7 Oct 1999 Volume: 9 Number: 1010
Today's topics:
Re: (?p{}) was [Re: Backreference in Regex Code Block?] (Ilya Zakharevich)
Re: (?p{}) was [Re: Backreference in Regex Code Block?] <ltl@rgsun40.viasystems.com>
Apache::Session::File problem (David R. Saunders)
Re: Caliing method by reference with arrow operator <skilchen@swissonline.ch>
Re: Caliing method by reference with arrow operator (Anno Siegel)
Re: Call CGI Perl whithout Forms (ItsMe9905)
Re: CGI and directory permissions (I.J. Garlick)
Re: CGI Date Datebase? <dwoods@ucalgary.ca>
Re: Das GlasPerlenspiel <bowman@montana.com>
Re: Das GlasPerlenspiel <andrew.yuen@fujitsu.com.au>
Re: giving a file a variable name (Abigail)
Re: Help - Perl regular expression question! <ltl@rgsun40.viasystems.com>
Re: Help - Perl regular expression question! (Larry Rosler)
Help : Read in a file.list then copy (新寶島樂園)
Re: inserting new character <r42317@email.sps.mot.com>
Re: Net::SMTP <homelessinseattle@yahoo.com>
Re: odd or even numbers? <homelessinseattle@yahoo.com>
Re: Parsing through Multiple text lines <yosikim@lgeds.lg.co.kr>
Re: Perl & java (Abigail)
Re: Perl macros for vi (Abigail)
Re: Perplexed with newlines while sending mail <homelessinseattle@yahoo.com>
Re: Perplexed with newlines while sending mail <rra@stanford.edu>
Re: Perplexed with newlines while sending mail <homelessinseattle@yahoo.com>
Re: Rapid Repeated Ftp (Abigail)
Re: reading binary files (Abigail)
Security Query - remote_user <covinom@des.wa.gov.au>
Re: submitting data (Abigail)
Test if file contains certain text tomschenk@my-deja.com
Thanx guys <robert@bos.nl>
Use of unitialized value (Ghost)
Re: Very simple redirect script needed <homelessinseattle@yahoo.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 7 Oct 1999 03:22:39 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: (?p{}) was [Re: Backreference in Regex Code Block?]
Message-Id: <7th3lv$crm$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to lt lindley
<lee.lindley@bigfoot.com>],
who wrote in article <7th182$gac$1@rguxd.viasystems.com>:
> This looks like a recursion that continues as long as $foo continues
> to match. But $foo has to stop matching at some point. Why make the
> fact that $foo must fail eventually cause the entire re to return
> false? Make it DWIM.
DWIM is useful for scripting languages only. Scripting languages do
not need complicated RExen.
> (?p{$foo}) should always return true. Can you
> think of any time that it would be useful for it to return false?
If you mean FAIL, yes, I do. It is useless if it always succeeds.
Think about //.
> :>The "internal" match creates no backreferences. It is absolutely
> :>opaque from the point of view of the outer REx: "point" is moved,
> :>nothing else happens.
>
> "point" eq pos() ?
Yup. Forgot that I can call it this. :-(
Thanks,
Ilya
------------------------------
Date: 7 Oct 1999 04:01:05 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: (?p{}) was [Re: Backreference in Regex Code Block?]
Message-Id: <7th5u1$hjs$1@rguxd.viasystems.com>
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
:>[A complimentary Cc of this posting was sent to lt lindley
:><lee.lindley@bigfoot.com>],
:>who wrote in article <7th182$gac$1@rguxd.viasystems.com>:
:>> This looks like a recursion that continues as long as $foo continues
:>> to match. But $foo has to stop matching at some point. Why make the
:>> fact that $foo must fail eventually cause the entire re to return
:>> false? Make it DWIM.
:>DWIM is useful for scripting languages only. Scripting languages do
:>not need complicated RExen.
Sacrilege. This may be too much for my virgin ears. :-)
And you really didn't address my point, though I cannot discount
the possibility that you did so below, since I still don't
see it all yet.
:>> (?p{$foo}) should always return true. Can you
:>> think of any time that it would be useful for it to return false?
:>If you mean FAIL, yes, I do. It is useless if it always succeeds.
:>Think about //.
I'm looking at it. I don't see it. I suspect your point is
related to backtracking and greediness and all of the other
requirements of the re engine, but I need specific examples
at this point. Otherwise it is too esoteric for me to grok.
OTOH, it is late at night here and if you leave me to stew
for a couple of days, something might percolate to the surface.
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: 7 Oct 1999 07:28:36 GMT
From: drs8h@vincent.itc.Virginia.EDU (David R. Saunders)
Subject: Apache::Session::File problem
Message-Id: <7thi34$p6g$1@murdoch.acc.Virginia.EDU>
Folks,
I'm trying to use Apache::Session::File ... I have this test
program:
#!/usr/local/perl5.005_03/perl
use Apache;
use Apache::Session::File;
my $id = 1;
my $opts = { Directory => '/tmp' };
my %session;
tie %session,'Apache::Session::File', $id, $opts;
print "Content-type: text/plain\n\n";
if ($session{data} eq '') {
print "first time";
} else {
print "not first time";
}
$session{data} = 'x';
untie(%session);
exit;
and am getting this error message:
Invalid argument at /usr/local/perl5.005_03/lib/site_perl/5.005/Apache/Session/SysVSemaphoreLocker.pm line 46.
Anyone know why this is happening? Thanks for your help,
Dave Saunders
drs8h@virginia.edu
------------------------------
Date: Thu, 07 Oct 1999 06:05:15 GMT
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: Caliing method by reference with arrow operator
Message-Id: <vKWK3.22737$m4.83746904@news.magma.ca>
Abigail <abigail@delanet.com> schrieb in im Newsbeitrag:
slrn7vn6af.23p.abigail@alexandra.delanet.com...
> Igor V. Solodovnikov (siv@helpco.kiev.ua) wrote on MMCCXXVII September
> MCMXCIII in <URL:news:939208052.322601@Stalker.Alfacom.net>:
> ``
> `` Is it possible to call method if i have only a reference to it?
>
> If you read the documentation carefully, you know you cannot have
> a reference to a method. What you have is a reference to the
> subroutine in appropriate class. Slight, but essential difference.
Why? "subroutine in appropriate class" sounds very much like a
definition of "method".
> `` Do you know any workaround?
>
> RTFM. Use a closure.
>
As far as i understand every reference to a sub or method is a closure
(although sometimes nothing may be "closed").
So he already uses a closure.
As pointed out by Greg Bacon what Igor is looking for is probably:
$self->$methodref()
(which is the same as &$methodref($self) and $methodref->($self)
instead of:
$self->&{$methodref}();
My experiments with Gregs example resulted in the following
modification:
#! /usr/bin/perl -w
use strict;
{
package Foo;
my $count = 0;
sub new {
my $class = shift;
my $startval = shift;
bless { COUNT => $startval } => $class;
}
sub count {
$_[0]->{COUNT}++;
}
sub callmethod {
my $self = shift;
my $methodref = shift;
print "1: ", &$methodref($self), "\n";
print "2: ", $methodref->($self), "\n";
print "3: ", $self->$methodref(), "\n";
}
}
package main;
my $methodref = \&Foo::count;
&Foo::callmethod(Foo->new(555), $methodref);
my $foo = new Foo(666);
$foo->callmethod($methodref);
------------------------------
Date: 7 Oct 1999 08:55:44 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Caliing method by reference with arrow operator
Message-Id: <7thn6g$e1c$1@lublin.zrz.tu-berlin.de>
Samuel Kilchenmann <skilchen@swissonline.ch> wrote in comp.lang.perl.misc:
>Abigail <abigail@delanet.com> schrieb in im Newsbeitrag:
>slrn7vn6af.23p.abigail@alexandra.delanet.com...
>> Igor V. Solodovnikov (siv@helpco.kiev.ua) wrote on MMCCXXVII September
>> MCMXCIII in <URL:news:939208052.322601@Stalker.Alfacom.net>:
>> ``
>> `` Is it possible to call method if i have only a reference to it?
>>
>> If you read the documentation carefully, you know you cannot have
>> a reference to a method. What you have is a reference to the
>> subroutine in appropriate class. Slight, but essential difference.
>
>Why? "subroutine in appropriate class" sounds very much like a
>definition of "method".
The way I see it, there is no such thing as a method per se. A sub
is a method when it is intended to be called in a certain way. This
way of calling includes runtime lookup, so if you already have a
coderef, it's too late to call the thing as a method.
>> `` Do you know any workaround?
>>
>> RTFM. Use a closure.
>>
>As far as i understand every reference to a sub or method is a closure
>(although sometimes nothing may be "closed").
>So he already uses a closure.
I don't think so. You get a closure when you compile a subref in
a certain environment. Just saying sub a {...}; $ra = \&a;
doesn't make $ra a closure.
Anno
------------------------------
Date: 07 Oct 1999 03:45:50 GMT
From: itsme9905@aol.comnojunk (ItsMe9905)
Subject: Re: Call CGI Perl whithout Forms
Message-Id: <19991006234550.07848.00000116@ng-da1.aol.com>
Use SSI to call the CGI script. Within the CGI script have it print the things
(HTML tags, values, etc.) you want.
Place the SSI in the positon within your web page where you want the CGI script
to start adding whatever.
The call to the SSI lloks something like:
!--#exec cgi="pathtothescript/thescript.cgi--
(BTW, there should be a < before the !-- and a > after the second --. I did
not add them as I'm not sure how it would be rendered here.)
HTH,
gc
------------------------------
Date: Thu, 7 Oct 1999 08:15:08 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: CGI and directory permissions
Message-Id: <FJ8498.D5D@csc.liv.ac.uk>
In article <7tgbp7$bbk$1@kopp.stud.ntnu.no>,
"Peter M鷲lerud" <peterm@idi.ntnu.no> writes:
> Hi!
> I was wondering if there is a way to create a directory from within a CGI
> script that will give the oppurtunity to write files into the directory
> further into the script ? That is, is there a way to create a directory on
> the server with write access for "others" ? Usually that won't work when
> you're not owner, as you not are when operating from a browser, but maybe
> there is a little trick ? :=)
Hold on. You create the directory from the CGI script and then claim you
don't own the dir? True but the server that created it should and it can
do pretty much what it likes to the permissions and the group ownership.
So I don't see the problem.
perldoc -f mkdir
perldoc -f chmod
Mind you you could be unlucky and the sys admins could have speciffically
made it so everything created in a a pariculsr dir is owned by root, then
I can forsee problems.
Also I would go study the way permissions interact with directories on
unix I think you may be a little confused.
--
Ian J. Garlick
ijg@csc.liv.ac.uk
You probably wouldn't worry about what people think of you if you could
know how seldom they do.
-- Olin Miller.
------------------------------
Date: Wed, 06 Oct 1999 21:05:22 -0700
From: Dan Woods <dwoods@ucalgary.ca>
Subject: Re: CGI Date Datebase?
Message-Id: <7th30g$q1o@ds2.acs.ucalgary.ca>
> Since he is apparently required to use Unix (what good fortune!) this is
> every easy to do.
>
> To the original poster (or anyone else trying to do something like this):
> First, on your Unix machine, run "man cron" and "man crontab" to get an
> idea of how to schedule a periodic job. The man pages may be too technical
> for you, in which case you may want to go into a bookstore, find O'Reilly
> and Associates' book on (Unix) System Administration, and read the
> sections on cron and crontab (if you can't borrow it from a colleague;
> it's kind of big to buy just to learn how to do cron jobs).
However try finding a hosting company that
(1) allows telnet access
(3) if so, allows crontab entries (cron jobs)
(4) or even allows continous server programs to run
(don't even ask about permission to /etc/inetd.conf)
I have yet to find a reasonably priced hosting company to allow these.
And the only alternative (which I may do) is to get cable modem service
and host my website on a PC at home, with my own DNS server.
Of course, this option ain't cheap either... Ughhh !
Thanks...Dan.
http://www.4loops.com
------------------------------
Date: Wed, 06 Oct 1999 22:02:35 -0600
From: bowman <bowman@montana.com>
Subject: Re: Das GlasPerlenspiel
Message-Id: <37FC1B5B.4AFA290@montana.com>
Fujitsu Australia Limited wrote:
>
> One of Perl's greatest gifts is the sense of humour in the community.
> There's humour built into the language itself.
Oh. That's what it is? Despite being fairly proficient in a couple of OO
languages, I'm having some trouble figuring out how to bless my
thingies. Need a session with the Magister Ludi.
--
Bear Technology Making Montana safe for Grizzlies
http://people.montana.com/~bowman/
------------------------------
Date: Thu, 7 Oct 1999 16:23:23 +1000
From: "Fujitsu Australia Limited" <andrew.yuen@fujitsu.com.au>
Subject: Re: Das GlasPerlenspiel
Message-Id: <7the40$5ar@newshost.fujitsu.com.au>
bowman wrote in message
>Despite being fairly proficient in a couple of OO
>languages, I'm having some trouble figuring out how to bless my
>thingies. Need a session with the Magister Ludi.
There's a great article in The Perl Journal issue 14 - Building a Better
Hash, by Dan Schmidt. It introduces the whole blessed thing:
http://www.itknowledge.com/tpj/issues/vol4_2/ewtoc.html
You have to subscribe to get access, but it's well worth it. The Camel Book
has a decent section on objects. The Perl approach is very different. For
example- it just asks people to be considerate and follow the rules when
using modules, rather than having systems in place to prevent access to
private data.
------------------------------
Date: 7 Oct 1999 01:54:18 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: giving a file a variable name
Message-Id: <slrn7voheo.81.abigail@alexandra.delanet.com>
Kevin Monroe (kpmonroe@unity.ncsu.edu) wrote on MMCCXXVII September
MCMXCIII in <URL:news:37FBA5AD.F6E29325@unity.ncsu.edu>:
__
__ open(ORIG, '/mypath/this_file.txt') || die "Cannot open this_file.txt";
__ open(NEW, '>/mypath/this_file.\'$RealMonth.$DayOfMonth.$RealYear\'.txt')
__ || die "Cannot open this_file.$RealMonth.$DayOfMonth.$RealYear.txt";
__
__ @data = <ORIG>;
__ splice (@data,0,3);
__ foreach $line(@data){
__ chop;
__ print NEW "$line";
^ ^
| |
Don't do that.
You could just do:
chomp @data;
print @data;
Though I'm not sure why you want to lose the newlines.
__ }
__ close (ORIG);
__ close (NEW);
__
__ What happens is it creates a file but does not insert the variable
__ information, ie the Month,Day,Year into the file name.
That's because you do something wrong. Look at the argument for the
die function, that *will* do the interpolation. Can you see the
difference in the two strings?
Abigail
--
perl -we '$_ = q ;4a75737420616e6f74686572205065726c204861636b65720as;;
for (s;s;s;s;s;s;s;s;s;s;s;s)
{s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 7 Oct 1999 04:17:24 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: Help - Perl regular expression question!
Message-Id: <7th6sk$hjs$2@rguxd.viasystems.com>
Larry Rosler <lr@hpl.hp.com> wrote:
:>s/($bigger)|$pattern/defined $1 ? $1 : $replacement/ego;
Ilya and Rick Delany pointed out to me that there exists a bug
where $1 is not always reset on unsuccessful partial matches
(I can't think of a better phrase to describe it at the moment).
The bug makes me leary of depending on the defined'ness of $1.
Could you point out the specific deficiencies of the
solution I offered using negative lookahead and lookbehinds?
Potential missed overlaps was the only one I could think of
on first blush.
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: Wed, 6 Oct 1999 23:48:01 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Help - Perl regular expression question!
Message-Id: <MPG.1265e1fd3f2d496c98a054@nntp.hpl.hp.com>
In article <7th6sk$hjs$2@rguxd.viasystems.com> on 7 Oct 1999 04:17:24
GMT, lt lindley <ltl@rgsun40.viasystems.com> says...
> Larry Rosler <lr@hpl.hp.com> wrote:
>
> :>s/($bigger)|$pattern/defined $1 ? $1 : $replacement/ego;
>
> Ilya and Rick Delany pointed out to me that there exists a bug
> where $1 is not always reset on unsuccessful partial matches
> (I can't think of a better phrase to describe it at the moment).
> The bug makes me leary of depending on the defined'ness of $1.
Avoiding a bug is not a valid criterion for evaluating a potential
solution to a problem. Workarounds can be discussed afterwards.
Anyhow, the code works in my tests.
> Could you point out the specific deficiencies of the
> solution I offered using negative lookahead and lookbehinds?
I posted my approach before I saw yours, and included this: "This
works, but it feels odd. Perhaps someone can do better." I think you
did better, at least for fixed literal patterns.
I benchmarked both, and yours is more than twice as fast (not counting
any time required to split the larger pattern into three pieces).
> Potential missed overlaps was the only one I could think of
> on first blush.
I can't think of how that can happen with either approach.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 7 Oct 1999 03:13:27 GMT
From: taiwan@glink.net.hk (新寶島樂園)
Subject: Help : Read in a file.list then copy
Message-Id: <7th34n$ev3$1@unix2.glink.net.hk>
Hi,
I am very new to perl but as I have to write a script that work on NT
and UNIX so that I choose Perl.
Suppose I am in a dir: /usr/joe and I maintain a file called file.lst
which contains tons of filename (without abs. path) in each line. I want
to write a Perl script first to :
read in file.lst in my current dir
All the filename in file.lst are stored physcially in /usr/foo. I need
to copy all the files to dir. /usr/boo.
How to write this script ?
Thanks!
TH
-- < 新寶島樂園 > ------------ URL : http://www.glink.net.hk/~tristan
(A-mei) URL : http://www.glink.net.hk/~taiwan (PowerStation)
------------------------------
Date: Thu, 07 Oct 1999 14:54:38 +0800
From: Noira Hadi <r42317@email.sps.mot.com>
To: abigail@delanet.com
Subject: Re: inserting new character
Message-Id: <37FC43AD.28DA9B3E@email.sps.mot.com>
Thanks for your posting, Abigail. I appeciate that. I got result as below when
running your script:
A
B
B
D
A,B,B,C,D
A
B
D
A,B,B,C,D,A,B,C,D
A
B
B
B
B
B
D
A,B,B,C,D,A,B,C,D,A,B,B,B,B,B,C,D
It seems that your script is always adding C before D and prints the data when it
reached D.
My problem is that I have a variable data set for 'B' (say, up to maximum of 10
data). I want to process them and allocate 10 columns for 'B'. But, when the 'B'
data is less than 10, I will add 'C' to substitute the column allocated for 'B'. In
other words, can I have something like:
A,B,B,B,B,B,B,B,B,B,B,D
A,B,B,C,C,C,C,C,C,C,C,D
A,B,B,B,B,C,C,C,C,C,C,D
A,B,C,C,C,C,C,C,C,C,C,D
I know I will have to use loop but haven't been able to get it right.
Thanks and Regards,
hadi
Abigail wrote:
> Noira Hadi (r42317@email.sps.mot.com) wrote on MMCCXXVII September
> MCMXCIII in <URL:news:37FAEFB9.4A360B14@email.sps.mot.com>:
> ??
> ?? I have data as below:
> ??
> ?? A
> ?? B
> ?? B
> ?? D
> ?? A
> ?? B
> ?? D
> ??
> ?? I format them to have:
> ??
> ?? A,B,B,D
> ?? A,B,D
> ??
> ?? The question is how do I format them so that I can have:
> ??
> ?? A,B,B,D
> ?? A,B,C,D
>
> local $" = ",";
> my @array;
> while (<>) {
> chomp;
> push @array => "C" if $_ eq "D";
> push @array => $_;
> print "@array\n" if $_ eq "D";
> }
>
> Abigail
> --
> srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
> //=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
>
> -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
> http://www.newsfeeds.com The Largest Usenet Servers in the World!
> ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 7 Oct 1999 00:36:42 -0500
From: "homeless" <homelessinseattle@yahoo.com>
Subject: Re: Net::SMTP
Message-Id: <OeWK3.1900$V4.8947897@typhoon.stlnet.com>
nigh_postal wrote in message <7tcuj0$sv1$1@nnrp1.deja.com>...
>Hrm... I tried sending it to a yahoo.com email address and it got there
>fine. For such a simple program, this has proved to be a major pain in
>the neck. *sigh* Back to the drawing board.
Sorry to hear that......
Am I right in assuming that you're just mailing a message to a list of
folks?
If so, Lemme know, I'll send you the smtp module I wrote for win32 that
works
on linux too. One Package builds a mime file, the other package sends it.
So- It makes it easy to debug.
good luck,
--homeless
------------------------------
Date: Thu, 7 Oct 1999 02:48:30 -0500
From: "homeless" <homelessinseattle@yahoo.com>
Subject: Re: odd or even numbers?
Message-Id: <jaYK3.1906$V4.9015093@typhoon.stlnet.com>
Craig Berry wrote in message ...
>homeless (homelessinseattle@yahoo.com) wrote:
>: >Does anybody know if there is an easy way to check whether a scalar
value
>: >contains a odd or even integer?
>: $number =~ m/[13579]/ and $number_contains_odd_integer="TRUE";
>I'd tend to phrase it as 'contains an even numeral', and also change
>'_integer' to '_numeral' in the variable name.
I actually pondered my wording for a good half hour while trying to fall
asleep last night. (seriously). I really should have replaced $number with
$scalar_value. But, alas, I'm stickin to my guns with the "_integer" thing,
mostly 'cos "_numeral" sounds too British for my liking:)
--homeless
(FYI, I am completely wasted right now)
------------------------------
Date: Thu, 07 Oct 1999 13:34:57 +0900
From: Yongsik Kim <yosikim@lgeds.lg.co.kr>
Subject: Re: Parsing through Multiple text lines
Message-Id: <37FC22F1.57B6C267@lgeds.lg.co.kr>
> if (m/([0-9+]) : ([0-9]+) : ([0-9]+)/) {
> #does this match hr : min : sec ?
if (m/(\d+)\s*:\s*(\d+)\s*:\s*(\d+)/) {
and find more about the regular expression from
http://www.perl.com/CPAN/doc/manual/html/pod/perlre.html
------------------------------
Date: 7 Oct 1999 03:36:05 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Perl & java
Message-Id: <slrn7vondi.81.abigail@alexandra.delanet.com>
Surya P Kommareddy (surya@ucdavis.edu) wrote on MMCCXXVII September
MCMXCIII in <URL:news:7tggut$9o2$1@mark.ucdavis.edu>:
.. Hi all,
.. I would like to use Javascript inside perl programs. If this is possible
.. please inform me which version of Perl to be installed. I searched the web
.. but I could find only how to use perl script inside java.
Java, or Javascript? If you want to use Javascript, I guess you'll
have to parse and evaluate it yourself....
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 7 Oct 1999 03:40:01 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Perl macros for vi
Message-Id: <slrn7vonkv.81.abigail@alexandra.delanet.com>
Martien Verbruggen (mgjv@wobbie.heliotrope.home) wrote on MMCCXXVII
September MCMXCIII in <URL:news:slrn7vmf3e.2h3.mgjv@wobbie.heliotrope.home>:
-- On Wed, 6 Oct 1999 07:59:31 GMT,
-- I.J. Garlick <ijg@connect.org.uk> wrote:
--
-- > Do yourself a favour go get a better background gif.
--
-- use lynx, and you won't even see what sort of background he uses :)
I don't need to use lynx for that; I won't see it with Netscape either ;-)
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 7 Oct 1999 01:09:20 -0500
From: "homeless" <homelessinseattle@yahoo.com>
Subject: Re: Perplexed with newlines while sending mail
Message-Id: <oJWK3.1901$V4.8959985@typhoon.stlnet.com>
[done sent a reply to both here@news and thar@email]
Graham W. Boyes wrote in message <7tg8hn$9ue$1@nnrp1.deja.com>...
>I'm trying to open a file and send it to an e-mail address. The file
>is HTML based, so I want to ignore the newlines already in the HTML
>file, and replace all the <BR>'s with newlines. Ex,
Are the <BR>'s the only thing you're replacing??
If so, why not just send the message as
Content-Type: text/html
?
>I have tried different methods replacing <BR> with \n, (tr, s, etc...)
>but when I receive the e-mail with different clients, the result is not
>consistent.
There are "methods" for consistency.
And interesting one is called "quoted printable", kinda like a lazy mans
html. Check it out in the latest RFC's dealing with MIME if you keep
encountering inconsistencies. Also, for those files that end up as one long
string?
I use a module called Text::Format that wraps beautifully. Works with HTML
too.
Good luck
-- homeless
------------------------------
Date: 06 Oct 1999 23:11:40 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perplexed with newlines while sending mail
Message-Id: <yl3dvnbsyr.fsf@windlord.stanford.edu>
homeless <homelessinseattle@yahoo.com> writes:
> There are "methods" for consistency. And interesting one is called
> "quoted printable", kinda like a lazy mans html.
I don't understand what you mean by that. QP is an encoding mechanism for
non-ASCII characters and some forms of whitespace; it doesn't seem to me
to have any relationship to a markup language. Are you perhaps thinking
of text/enriched or format=flowed?
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Thu, 7 Oct 1999 03:20:21 -0500
From: "homeless" <homelessinseattle@yahoo.com>
Subject: Re: Perplexed with newlines while sending mail
Message-Id: <bEYK3.1907$V4.9031003@typhoon.stlnet.com>
Russ Allbery wrote in message ...
>homeless <homelessinseattle@yahoo.com> writes:
>
>> There are "methods" for consistency. And interesting one is called
>> "quoted printable", kinda like a lazy mans html.
>
>I don't understand what you mean by that.
Indeed. I'm not good at metaphores, mind you, or spelling, but I'm
practicing:)
> QP is an encoding mechanism for
>non-ASCII characters and some forms of whitespace; it doesn't seem to me
>to have any relationship to a markup language.
Well............What I **actually** meant to say was that QP is a reliable
way to preserve the original
CRLFs of the document (Kinda Like the way you can put CRLF's in html and let
the browser or parser
look for the <BR> to find out where the CRLF's are supposed to be.) ---
allowing you to fold
the text and mangle it up in order keep the message's lines around 76
characters as opposed
to the ambitious non-sleeping person's (politically correct mind you)
method, ( which is my favorite),
which entails base64 encoding everything by hand- drunk, naked and cold;)
--homeless
"There's a chunk of bread in your beard."
------------------------------
Date: 7 Oct 1999 03:44:57 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Rapid Repeated Ftp
Message-Id: <slrn7vonu6.81.abigail@alexandra.delanet.com>
Kristjan Varnik (kav200@omicron.acf.nyu.edu) wrote on MMCCXXVI September
MCMXCIII in <URL:news:66uK3.30$Gm4.3173@typhoon.nyu.edu>:
&&
&& Lastly, I am a bit new to perl.. are their any flags
&& I can use to make my perl programs run faster.
Yeah. There are 9 flags, -1 to -9. With -1, Perl runs the fastest,
but sloppy. It'll make mistakes. With -9, Perl won't make mistakes,
but it's slow.
The default, -5, is kind of a middle ground. Slow and sloppy.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 7 Oct 1999 03:45:41 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: reading binary files
Message-Id: <slrn7vonvj.81.abigail@alexandra.delanet.com>
heitkamp@attglobal.net (heitkamp@attglobal.net) wrote on MMCCXXVII
September MCMXCIII in <URL:news:37FAB3AF.B2521448@attglobal.net>:
!! I want to read a binary file written by a FORTRAN program.
!! The header of the file has floating point parameters inside a
!! FORTRAN record. I've tried using seek and unpack to
!! read the numbers but I'm getting garbage. Is is possible to
!! read FORTRAN records, or C structs for that matter from
!! binary files?
Use pack/unpack. They use their own little language.
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 07 Oct 1999 14:55:25 +0800
From: Mario Covino <covinom@des.wa.gov.au>
Subject: Security Query - remote_user
Message-Id: <37FC43DD.7A621EE4@des.wa.gov.au>
Our Internet/Intranet PERL applications rely heavily on the Environment
variable "remote_user" which is set by the web server when the user logs
in. Due to the internet being a stateless environment all environment
variables including the "remote_user" forms part of the HTML header
which is sent backwards and forwards from client to server. So my
question is, can the value of these environment variables be
changed/hacked at the client end, specifically the "remote_user". ?
In other words, all our CGI PERL scripts refer to the "remote_user"
environment variable before performing any functions, however if the
user could change the value of the "remote_user" the consequence would
be devastating. I have searched the Internet high and wide for proof one
way or another , can anyone with authority tel me the answer.
Could you please help?
------------------------------
Date: 7 Oct 1999 04:01:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: submitting data
Message-Id: <slrn7vootc.81.abigail@alexandra.delanet.com>
jaamaylem@usa.net (jaamaylem@usa.net) wrote on MMCCXXIV September
MCMXCIII in <URL:news:37F778FD.A0CCCB5E@usa.net>:
()
() How can I submit data to perl script in that way:
()
() http://www.myserver.com/dir/new.pl?name=andrew
You get yourself a nice HTTP daemon that understands CGI. You
configure it, and run it. Then, you telnet to the port the server
is listening, and you type:
GET /dir/new.pl?name=andrew HTTP/1.0
Now, the server will call your program using CGI, passing the
data around as specificied by CGI.
Personally, I would use command line arguments.
new.pl --name andrew
Much simpler.
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 07 Oct 1999 03:02:45 GMT
From: tomschenk@my-deja.com
Subject: Test if file contains certain text
Message-Id: <7th2ge$ssr$1@nnrp1.deja.com>
Hi-
I know this is probably easy, and yes, I have searched to find the
answer, but can't.
So--I am trying to write a script which accepts form input from a web
page, then checks a text file to see if that text is already in that
file. If it isn't, I want to add it to the end of the file. I already
know how to process the form, open the file, and write to the file, I
just can't figure out how to see if the text is already there. The
text file is just a list of words--that's all, one per line. Can
someone help??? Thanks!
Tom
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 07 Oct 1999 11:05:24 +0200
From: Robert Korteweg <robert@bos.nl>
Subject: Thanx guys
Message-Id: <37FC6254.CFBB51C4@bos.nl>
TNX for your help
Robert Korteweg wrote:
> How do i put a location of a librarie in my perl scripts
>
> for example the library GD.pm is used in my script but its directory
> isn't one of the standard directorys its
> /sites/www/scripts.bos.nl/cgi-bin/lib/
>
> Robert Korteweg
------------------------------
Date: Thu, 07 Oct 1999 07:50:39 GMT
From: ghost24@bctek.com (Ghost)
Subject: Use of unitialized value
Message-Id: <rvok6fo7bm171@corp.supernews.com>
I am having problems trying to use the MPEG::MP3Info module.
I am new to perl, and am not to familiar with modules or
refrences so I probably screwed something up!
I have tried multiple MP3 files. My source is a modification
of an example given in MPEG::MP3Info readme file.
I get an error: Use of unitialized value at test.pl line 10.
src is
#!/usr/bin/perl -w
use MPEG::MP3Info;
my $file = 'mac_daddy.mp3';
my $tag = get_mp3tag($file) or die "No TAG info!\n";
foreach $key (keys %$tag){
if (exists($tag->{$key})) { <-- err. line 10
print "$key: $tag->{$key}\n";
}else{
print "$key: <undefined>\n";
}
}
I added the exist part thinking maybee I was accessing an
undefined hash element. But still gives same error so I
can only think the unitialized value is $key. But it shouldnt
have been passed if invalid right?
Please help... A confuse newbie...
--
.................
name: ghost24 ...........
email: ghost24@bctek.com ......
web: www.bctek.com/~ghost24 .
--------------------------------
------------------------------
Date: Thu, 7 Oct 1999 01:14:36 -0500
From: "homeless" <homelessinseattle@yahoo.com>
Subject: Re: Very simple redirect script needed
Message-Id: <kOWK3.1902$V4.8963126@typhoon.stlnet.com>
[Done sent a copy to here@news and thar@email]
webmaster@film.tierranet.com wrote :
> need a very simple redirect script that uses a button to redirect a user
to
>a different web page. The HTML should look something like the following.
>
><form method="POST" action="/cgi-bin/redirect.cgi">
><input type="Hidden" value= "http://www.example.com/newpage.html">
><input type="button" value="Go To Redirect">
></form>
>
>As you noticed the web page it redirects to is in the hidden field. I
looked
>at all the free CGI sites and didn't see anything. Can anyone type up a
script
>for me or direct me to a place that has a basic script like this available?
Ummm, lemme take a stab at somethin, k?
You could replace the above form with the following one, and it would not
require a CGI-script.
<Form Method=GET action="http://www.example.com/newpage.html">
<input type=submit value="Go To Redirect">
</Form>
chow
--homeless
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 1010
**************************************