[7605] in Perl-Users-Digest
Perl-Users Digest, Issue: 1231 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 26 21:07:12 1997
Date: Sun, 26 Oct 97 18:00:42 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 26 Oct 1997 Volume: 8 Number: 1231
Today's topics:
Re: A little help, please. (Frankie K.T. Chu)
Re: Accessing Oracle DB using Perl - What do I need? (Bill D. McAdam)
Re: Adding html to URLs (News Service)
Re: Are Perl perform well in NT Server Platform?? (Jeremy D. Zawodny)
Re: awk style field variables in perl <ajohnson@gpu.srv.ualberta.ca>
BUG in WinPerl; OK in Unix Perl <pfortin@cisco.com>
Re: CGI tools (Connie Wang)
Re: detection of first execution since login <chenyang@mashie.ece.jhu.edu>
Re: detection of first execution since login (E.None Archibald)
Re: Displaying X-based applications? (marduk)
Re: HELP: Registration with .htaccess ???? (YOSHIFUJI, Hideaki)
Re: initgroups(2) Support - Why not? <rootbeer@teleport.com>
Re: Memory problems - how can I fix? (Ilya Zakharevich)
Re: Memory problems - how can I fix? (Ryan)
No DBsub error message? (Forrest W. Christian)
Re: Opening a network connected drive from dos w/ perl (Martien Verbruggen)
Re: OR v. Randal: Employees have no 1st Amendment Right (Martien Verbruggen)
Perl 5 and here documents (Steve Walker)
perl and pgp <bell@idi.ntnu.no>
Re: question: C-to-Perl variable passing (Andrew M. Langmead)
SOLVE and you'll be a GOD (in my eyes atleast) <mi@bitwiser.dk>
Re: SOLVE and you'll be a GOD (in my eyes atleast) (Steve Frost)
sorting question <mwatkins@carol.net>
Re: sorting question <joegottman@worldnet.att.net>
Re: sorting question (Martien Verbruggen)
the lwp module for a ms-dos/win95 platform... <darrik@uakron.edu>
Re: the lwp module for a ms-dos/win95 platform... (Eric Bohlman)
Re: Using // (Andrew M. Langmead)
Re: Wanted: Wall/Schwartz book (1st ed) (Bill D. McAdam)
Your opinion on The Perl Journal (TPJ) ? (John Robson)
Re: Your opinion on The Perl Journal (TPJ) ? <merlyn@stonehenge.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 26 Oct 1997 23:31:05 +0800
From: fktchu@glink.net.hk.WEBMASTER (Frankie K.T. Chu)
Subject: Re: A little help, please.
Message-Id: <MPG.ebde313db9a6b589896bd@milky>
In article <62unhm$724$1@dbtsvr2.dbtech.net>, Jeremy Leigh <"jvleigh"@_no
spam_kih.net> says...
> I am very new to perl programming. I have read books on it with not
> alot of success.
Just wanting to comment on learning materials for Perl beginners.
I wanted to put something together to deal with abuses of the regional
Usenet newsgroups. I am fluent in Fortran and Pascal, tried to learn C
while I was at university but never got the hang of it (I did
aeronautical engineering so Fortran was all I needed). I considered C and
Delphi, and found them to be too complicated for what I wanted to do.
Then I went to a bookshop and flicked thru "Learning Perl" by Randal
Schwartz et al. from ORA. The book was good so I bought it together with
the Camel book. A few chapters into the Llama book and everything just
clicked. A week later I had two perl scripts counting EMP and ECP. It's
only three weeks or so from then and now my ECP program also emails the
offenders. I also have a perl script that scans thru rogue-cancel mesgs
and grab copies of the original mesgs if available.
Any Perl beginner not using Randal's Llama book is probably working too
hard...
Cheers,
Frank.
--
*N$Q - $$$eCQZ;-xCQ%4
ASCII and BIG5 Readable...
Remove ".WEBMASTER" from email address when replying.
ICQ: 1214488
------------------------------
Date: 22 Oct 1997 19:17:47 GMT
From: bdmcadam@ford.wdi.disney.com (Bill D. McAdam)
Subject: Re: Accessing Oracle DB using Perl - What do I need?
Message-Id: <62ljgr$p43@louie.disney.com>
Matthew Rapaport (mjr@crl.crl.com) wrote:
: I am looking for a way to access an Oracle 7.x DB using Perl. I have a
: sample script that uses something called oraperl, but I'm wondering if
: I can do this with my /usr/bin/perl 5.x implementation by acquiring some
: include files and other such things. I'm hoping someone out there will
: tell me what I need to get in order to do this.
Check out DBI and DBD::Oracle at
http://www.hermetica.com/technologia/perl/DBI/index.html
------------------------------
Date: Sun, 26 Oct 97 23:34:22 GMT
From: newsXXXY@wdni.com (News Service)
Subject: Re: Adding html to URLs
Message-Id: <a1a7cd$112613.395@usenet.weyer.com>
Check out The Perl Journal Spring 1996 (vol 1 issue 1) page 25. It has what
your seek. you can go there directly
http://orwant.www.media.mit.edu/tpj/programs/Issue_1_HTMLregexps/urlify
hpe that helps!
In article <877734649.31401@dejanews.com>, harry_murphy@sfbayguardian.com
wrote:
> I have a list of 1,000 URLs in MSWord that I want to
>put on a Web page. I need to put the HTML coding in
>each URL so that when I click on a URL, it will bring up
>a Web page.
> It would probably take me 20 hours to type in the
>html coding for each URL. However, I understand that
>if I use BBedit and regular expressions, I can have all
>of this done automatically.
> I have tried to use the following regular expression
>but can't seem to get it to work to add the html coding
>for each URL. Can anyone advise me on how to do this
>and what is wrong with my coding:
>Search: (^.*//([^/]+)/.*)
>Replace: <ahref="/1">/2</a>
>
>-------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
>
------------------------------
Date: Sun, 26 Oct 1997 20:33:08 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: Are Perl perform well in NT Server Platform??
Message-Id: <3453a8f4.13919805@woody.wcnet.org>
[original author automagically cc'd via e-mail]
On Sun, 26 Oct 1997 21:12:31 +0800, Kevin <lhchiu5@ie.cuhk.edu.hk>
wrote:
>I want to write a CGI program on Window NT platform. Is Perl perform
>well on NT plaform??
Depends who you ask.
I think it performs okay.
Jeremy
--
Jeremy D. Zawodny jzawodn@wcnet.org
Web Server Administrator www@wcnet.org
Wood County Free Net (Ohio) http://www.wcnet.org/
------------------------------
Date: Sun, 26 Oct 1997 13:40:57 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: awk style field variables in perl
Message-Id: <34539CC9.7151A241@gpu.srv.ualberta.ca>
Waqar Hafiz wrote:
>
> This probably is a simple question for some of you:
>
> In awk, fields within each record/line can be accessed
> through awk variables $1, $2 ...
> Is there such mechanism in perl?
in perl you can use the split() function
to split a record on some delimiter or pattern...
from the command line, with -n or -p you can use the
-a option to autosplit into the @F array, and you can
supply a pattern to split on using the -F option.
see:
for info on the split() function:
perldoc -f split (or 'man perlfunc' and seach for split)
for info on command line switches such as -a -F and -n -p:
perldoc perlrun (or 'man perlrun')
hope it helps
regards
andrew
------------------------------
Date: Sun, 26 Oct 1997 19:58:29 -0500
From: Pierre Fortin <pfortin@cisco.com>
Subject: BUG in WinPerl; OK in Unix Perl
Message-Id: <3453E734.77CF2F94@cisco.com>
There is a bug in WinPerl wherein a file which contains 0x1A can't be
read past that point...
I've included a script to illustrate the problem... This works fine on
a Unix system.
Pierre
#!/usr/local/bin/perl5
#
# 'WinPerlBug.pl'
#
# BUG: Files containing 0x1A cannot be processed by WinPerl.
# This works OK on Unix version.
#
open BUGFILE1, '>Bugfile1';
writefile(BUGFILE1,0,256); # includes 0x1A
close BUGFILE1;
open BUGFILE2, '>Bugfile2';
writefile(BUGFILE2,32,256);
close BUGFILE2;
open THIS_SCRIPT, '<WinPerlBug.pl'; # excludes 0x1A
open BUGFILE1, '<Bugfile1';
open BUGFILE2, '<Bugfile2';
readfile(THIS_SCRIPT);
readfile(BUGFILE1);
readfile(BUGFILE2);
close;
exit;
sub writefile {
local($file, $init, $limit) = @_;
for ($i = $init; $i < $limit; $i++) {
printf $file chr $i;
}
}
sub readfile {
local($file) = @_;
$i = 0;
while (read $file, $c, 1) {
$i++;
($v = ord $c);
($v > 127) ? $v - 128 : $v;
printf STDOUT "%2lx",ord $c if !($v < 32);
}
printf STDOUT "\nChars read/printed=$i(%lx)\n", $i;
}
------------------------------
Date: Sun, 26 Oct 1997 20:22:50 GMT
From: c0w0461@unix.tamu.edu (Connie Wang)
Subject: Re: CGI tools
Message-Id: <3453a54c.11043419@news.tamu.edu>
I know all you guy said is correct. The thing is I am doing a project
on dynamic database. I prefer to use win32odbc, but my boss prefer to
use cold fusion.
Bcause Cold fusion is labeled as easy to learn and easy to use, and
most people thought it is difficult to learn pearl. I don't know how
to persuade him.
Connie
------------------------------
Date: Sun, 26 Oct 1997 11:23:07 -0500
From: Chenyang Xu <chenyang@mashie.ece.jhu.edu>
Subject: Re: detection of first execution since login
Message-Id: <Pine.SGI.3.91.971026111836.23320A-100000@mashie.ece.jhu.edu>
On Sun, 26 Oct 1997, Tom Phoenix wrote:
> On Sat, 25 Oct 1997, Chenyang Xu wrote:
>
> > On UNIX, is there a way for a perl script to find out whether its
> > current execution is the first execution since the recent user login?
>
> In general, no, since Unix doesn't remember what programs have been run.
> In practise, though, you might be able to get what you need. For example,
> you could call the script from .profile (or whatever) so that it's run
> upon startup. If that won't do what you want, can you let us know what
> you're trying to accomplish? Good luck!
>
Many thanks for your input. I am using a SGI workstation. What I am trying
to accomplish is to write a simple message script using perl. The script
is put in the .login (or .cshrc). I only want my message to be displayed
when I login. Without a detection of first execution since login, my
message will be displayed everytime when I open a new window which is
quite annoying. I have tried to put it in the .profile but it doesn't
work. I suspect it is because I am using "tcsh" instead of "sh" although I
am not sure.
Any other input or alternative way to achieve this will be greatly
appreciated!
-Chenyang
------------------------------
Date: 26 Oct 1997 20:59:08 GMT
From: yevgene@xochi.tezcat.com (E.None Archibald)
Subject: Re: detection of first execution since login
Message-Id: <630aus$f2h$1@tepe.tezcat.com>
<many snips>
Chenyang Xu <chenyang@mashie.ece.jhu.edu> wrote:
: On Sun, 26 Oct 1997, Tom Phoenix wrote:
: > On Sat, 25 Oct 1997, Chenyang Xu wrote:
: > > On UNIX, is there a way for a perl script to find out whether its
: > > current execution is the first execution since the recent user login?
: > you could call the script from .profile (or whatever) so that it's run
: quite annoying. I have tried to put it in the .profile but it doesn't
: work. I suspect it is because I am using "tcsh" instead of "sh" although I
^^^^^^
There's your problem right there...use bash. [ Ed. note: JUST KIDDING.
I AM NOT STARTING A SHELL ADVOCACY WAR. THANKS. ]
Seriously - use .login with tcsh for once-only evaulation.
yevgene tezcat.net
Reed, quake and heroin are the greatest enemies of our time.-J.D.F
PGP fingerprint: 90 95 12 32 62 51 61 18 EF 39 2B B8 7B A1 84 E9
------------------------------
Date: 26 Oct 1997 17:40:12 GMT
From: marduk@gte.net (marduk)
Subject: Re: Displaying X-based applications?
Message-Id: <62vv9s$ol2$1@gte1.gte.net>
Jared Evans says:
>What you would want to use is have the web server make RPC calls to the
>machine you are on (you can obtain the IP address by using the
>$ENV{REMOTE_HOST}) to execute programs on your local machine. Granted this
>will mean you will have to design a RPC server and install it on machines you
>will be at. But it will work.
I don't think this is what Pete wanted. It seems that he wanted the process
(i.e. the xterm) to be running on the host server and to be displayed on
the clients X display.
The previous posting about xauth (or xhost which is what I use) should do
the trick.
-=-marduk-=-
--
------------------------------------------------------------------------------
marduk http://home1.gte.net/marduk/index.html
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d(+) s(-): a-- C+++$ ULA++++>$ P+>$ L+++>$ E-@ W--(+++)$@>+++ N>++
o? K--? w(--)$ !O M- V--$ PS+ PE Y+ PGP- !t--(--) !5 X++ !R-- tv b !DI
!D- G e h+ r--? y--**(+)
------END GEEK CODE BLOCK------
------------------------------
Date: Mon, 27 Oct 1997 01:00:46 GMT
From: yoshfuji@ecei.tohoku.ac.jp (YOSHIFUJI, Hideaki)
Subject: Re: HELP: Registration with .htaccess ????
Message-Id: <EIoqtA.98K@yagi.ecei.tohoku.ac.jp>
In article <344FB734.7730DDB3@horizon.nl>, T. de Konink <tkonink@horizon.nl> says...
>- If someone has logged in (.htacces or ????) and starts a script within
>the zone (of scripts and pages), can I identify (within a Perl-script)
>the person by getting his Loginname somehow.
Use 'REMOTE_USER' environment.
>- Can I use Cookies (getting/sending/deleting) within Perl-scripts ?
Use 'HTTP_COOKIE' environment to get cookies.
Use 'Set-Cookie' response header to set and/or delete cookies.
--
YOSHIFUJI, Hideaki
E-Mail : <URL:mailto:yoshfuji@ecei.tohoku.ac.jp>
Web Page : <URL:http://www.ecei.tohoku.ac.jp/~yoshfuji/>
------------------------------
Date: Sun, 26 Oct 1997 14:09:22 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Ingo L|tkebohle <ingo@blank.pages.de>
Subject: Re: initgroups(2) Support - Why not?
Message-Id: <Pine.GSO.3.96.971026140840.20244G-100000@usertest.teleport.com>
On Sat, 25 Oct 1997, Ingo L=FCtkebohle wrote:
> =09Is there a reason for the absence of initgroups(2) support?
I think nobody has gotten around to adding it. If you wish to submit a
patch, it could go into a future version of Perl. Good luck!
--=20
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 26 Oct 1997 21:31:23 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Memory problems - how can I fix?
Message-Id: <630crb$dd5$1@agate.berkeley.edu>
In article <Pine.GSO.3.96.971026075857.12522L-100000@usertest.teleport.com>,
Tom Phoenix <rootbeer@teleport.com> wrote:
> > I have a bit of code that does a wonderful job of sucking up
> > tons of memory when I don't really think it should.
>
> > for (1..100000) {
>
> In the current implementation, that line will create a list of 100000
> scalars, and keep that list around until the end of the loop. Ouch! :-)
No, it will keep it eternally. flip/flop is constant-folded.
Ilya
------------------------------
Date: Mon, 27 Oct 1997 01:26:45 GMT
From: wwolfe@netcom.com (Ryan)
Subject: Re: Memory problems - how can I fix?
Message-Id: <wwolfeEIos0L.816@netcom.com>
Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh (bsa@void.apk.net) wrote:
: In <wwolfeEIMvyv.LG5@netcom.com>, on 10/26/97 at 12:56 AM,
: wwolfe@netcom.com (Ryan) said:
: +-----
: | I have a bit of code that does a wonderful job of sucking up
: | tons of memory when I don't really think it should.
: | for (1..100000) {
: +--->8
: You are aware that "1 .. 100000" builds a list containing the elements "1",
: "2", ... "99999", "100000" and then iterates over that list?
forgot to put in one line that should be free'ing up the pointered hash.
%{$name{group}->{$var}} = ();
Essentially this is a small example of what is going on in something else
I've written.
I create a key value pair in $name{group} that points to an anonymous
hash that is keyed with $var.
for SOME reason, no matter what I do, I can't clear the memory that
is used by the anonymous hash. By clear I mean, free it up so that
the program can use it for the next hash to come around.
I realise that perl can't free() up a block of memory back to the
OS, but shouldn't perl be able to reuse memory it's already allocated?
-Ryan
: --
: brandon s. allbery [Team OS/2][Linux] bsa@void.apk.net
: cleveland, ohio mr/2 ice's "rfc guru" :-) KF8NH
: Warpstock '97: OS/2 for the rest of us! http://www.warpstock.org
: Memo to MLS: End The Burn Scam --- Doug Logan MUST GO! FORZA CREW!
------------------------------
Date: 27 Oct 1997 00:34:26 GMT
From: forrestc@lewis.mt.net (Forrest W. Christian)
Subject: No DBsub error message?
Message-Id: <630nii$ca1$1@helena.mt.net>
I'm trying to get SmallProf to run to try to optimize a chunk of perl
code.
However, when I try to run it, I get:
# perl -d:SmallProf test.pl
No DBsub routine at /opt/LWperl/lib/strict.pm line 87.
BEGIN failed--compilation aborted at
/opt/LWperl/lib/site_perl/Devel/SmallProf.pm line 4.
BEGIN failed--compilation aborted.
Any ideas about how I can fix this?
For your reference:
This is perl, version 5.003 with EMBED
built under solaris at Mar 12 1997 03:06:34
+ suidperl security patch
(I know, I should upgrade to 5.004. I'm going to get that done any day
now)
-forrestc@imach.com
------------------------------
Date: 27 Oct 1997 00:54:11 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Opening a network connected drive from dos w/ perl
Message-Id: <630onj$2g3$1@comdyn.comdyn.com.au>
In article <3447BA14.414B@geocities.com>,
James Patton <thedon@geocities.com> writes:
> I currently running Win 95' and using the PC version of Perl. I was
> wondering if there is some way to have my perl script open up a network
> drive? I just wrote a very simple find script, I run it from c: and want
> it to connect to a network drive and exe. the script, and then post the
> results on c:......Is this possible?????
If you have 'attached' to that network drive, simply use the letter.
If you haven't, you might try using the network name.. something like
\\machine\share. I don't know if that will work through perl. You can
also use system calls to 'net use ...'.
> open(LOG, ">c:\temp\find.log"); #putting the info on c:\temp
Just use '/', should work. If you prefer a backslash, you'll have to
double them, to escape them.
Also: ALWAYS, always check the return value of an open(). It might
give you a lot of information about WHY the open failed. Always run
perl with the -w option. Always use 'use strict'.
So, if your 'network' drive is t: (which might be mapped to anywhere):
#!/usr/local/bin/perl -w
use strict;
require 'find.pl';
# (I would prefer to 'use File::Find')
# ... Other code
open(LOG, ">c:/temp/find.log") or die "Cannot open file: $!";
find('t:/somewhere');
or, alternatively, but uglier
open(LOG, ">t:\\temp\\find.log") or die "Cannot open file: $!";
find('t:\\somewhere');
# Other code...
(silly MSDOS *sigh*)
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | A Freudian slip is when you say one
Commercial Dynamics Pty. Ltd. | thing but mean your mother.
NSW, Australia |
------------------------------
Date: 27 Oct 1997 01:07:53 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: OR v. Randal: Employees have no 1st Amendment Rights
Message-Id: <630ph9$2g3$2@comdyn.comdyn.com.au>
In article <Pine.SOL.3.96.971022222713.26200A-100000@eqsun.geo.arizona.edu>,
"Nathanael T. Brooks-English" <nenglish@geo.Arizona.EDU> writes:
> I was very interested to read the post concerning Mr. Randall.
> Please elaborate on the facts of the case as you know them.
Have a look at:
http://www.lightlink.com/fors
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
Date: 26 Oct 1997 23:59:55 GMT
From: steve@nospam.thisdomain.com (Steve Walker)
Subject: Perl 5 and here documents
Message-Id: <630lhr$ad2@news.onramp.net>
I'm having problems with a script that uses lots of here documents. I keep
getting the error:
Can't find string terminator " end_of_html" anywhere before EOF at
class_ad_test.cgi line 905.
But the terminator IS there...here is a snippet of code that gives an
error:
print <<" end_of_html";
<HTML><HEAD><TITLE>The Classified Ad Manager</TITLE></HEAD>
<BODY BGCOLOR = "FFFFFF" TEXT = "000000">
<CENTER>
<IMG SRC = "/Images/frontpage.gif">
etc. etc.
</CENTER></BODY></HTML>
end_of_html
exit;
I've tried various terminators with and without leading spaces (indents)
and none work.
There are about 30 places in the script where this is used, and none of
them work. If I remove them and replace them with print " ... " statements,
they work.
But then the here documents in cgi-lib.pl generate the same errors...and
presumably so will the other lib files I'm using.
Arrggghhhhh!
Any ideas?
Thanks,
Steve
Please remove the nospam part to reply by email....
------------------------------
Date: Mon, 27 Oct 1997 00:37:25 +0100
From: Runar Bell <bell@idi.ntnu.no>
Subject: perl and pgp
Message-Id: <Pine.GSO.3.95.971027003505.17238D-100000@drue.idi.ntnu.no>
The following works:
@out = `less textfile.txt |pgp -fae recipient`;
But, how do I do this if I want to use the variable/array @text instead of
the file textfile.txt?
Thanks,
Runar
_________________________________________________________________________
Runar Bell URL : http://www.stud.ntnu.no/~runarbel
Berg Studentby O-22 Phone : (+47) 73 88 68 34
7016 Trondheim Office: (+47) 73 59 14 69
Norway
------------------------------
Date: Sun, 26 Oct 1997 17:39:13 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: question: C-to-Perl variable passing
Message-Id: <EIo6DE.Cqo@world.std.com>
Chief Boot Knocka <natedogg@webbnet.com> writes:
>It seems that it would be tricky for a perl routine to call a C program
>and try to get more than one value returned from it. I was wondering if
>anyone had any methods to do this.
Under the Unix program model, and it is very similar in many other
operating systems, a _program_ can only return a single numeric exit
status, and output to some sort of output stream.
>What I'm trying to do is syscall(cprogram, var1, var2, etc...). Then
>there are three values that cprogram has to return. It would be great if
>perl could pass pointers to those variables through the syscall; then C
>could modify the values pointed to, then just exit.
First, take a look at what syscall() is, I don't think its doing what
you think. (What is that quote from "The Princess Bride" that Randal
uses all the time?) syscall() executes operating system functions, but
by number instead of name. A good chunk of the C library on a unix
machine is just there to turn calls like open(filename,mode) into
something like syscall(SYS_open, filename, mode).
To start a C program as a separate process, you need to use either the
system() function, the open() function with the pipe option, or the
backticks (``) operator. As a separate process, of course, it has no
access to your perl programs memory. The C program can print to an
output stream and your program can read it. (open() and `` are good
for this because it redirects standard output for your perl script to
read.)
If the stuff you want to call that is written in C is just a function,
and not a complete program, you might want to take a look at perl's XS
feature. This will allow you to add functions of code (written in C or
some other "compile to machine language" language) for your perl
script to call. This gives you much more flexibility, passing and
returning variables, and whatnot. See the perlxs and perlxstut man
pages for details.
--
Andrew Langmead
------------------------------
Date: Mon, 27 Oct 1997 00:17:58 +0100
From: Michael Isaksen <mi@bitwiser.dk>
Subject: SOLVE and you'll be a GOD (in my eyes atleast)
Message-Id: <3453CFA6.B1849114@bitwiser.dk>
in making as script which makes list of links to perlscripts
eks:
<A
HREF="JavaScript:Open('http://bitwiser.dk/cgi-local/jai.pl/aparametertothescript/')">
but i would like to be able to make a parameter (after jai.pl),
containing blanks.
eks
<A HREF="JavaScript:Open('http://bitwiser.dk/cgi-local/jai.pl/a
parameter with blanks/')">
but only the first word ends up in the $ENV{'PATH_INFO'}
So I desided to replace the blanks to either a serie of letter or just
another character.
The milliondollar question is
why does this code not work (or how to do):
$astring = "a parameter with blanks";
&Addparameter($astring);
sub Addparameter
{
my($parameter) = @_;
$dummyheader =~ s/ /+/g;
# $dummyheader =~ s/&nbp;/BB/;
# $headerparam = s/ /BB/g;
$parameter =~ tr/ /+/;
print qq|\n<B><A
HREF="JavaScript:Open('http://bitwiser.dk/cgi-local/jai.pl/$parameter/')">$header</A></B><BR>|;
}
the inserted parameter does get affected by the tried replace
The funny thing is that the code works perfectly if i try to replace
normal character.
I have tried
$parameter =~ tr/\s/+/;
$parameter =~ tr/ /+/;
$parameter =~ s/ /+/g;
$parameter =~ s/[ ]/+/g;
$parameter =~ s/\s/+/g;
HELP HELP HELP HELP HELP HELP HELP HELP HELP
thanks
------------------------------
Date: Mon, 27 Oct 1997 01:22:45 GMT
From: frostbyt@shell02.ozemail.com.au (Steve Frost)
Subject: Re: SOLVE and you'll be a GOD (in my eyes atleast)
Message-Id: <630qeh$g5o$1@reader1.reader.news.ozemail.net>
Some time ago Michael Isaksen <mi@bitwiser.dk> wrote:
>in making as script which makes list of links to perlscripts
>eks:
><A
>HREF="JavaScript:Open('http://bitwiser.dk/cgi-local/jai.pl/aparametertothescrip
>t/')">
>
>but i would like to be able to make a parameter (after jai.pl),
>containing blanks.
Have you tried something like %20 instead of a space and
then convert %20 to spaces in your script? e.g.
http://www.frostbyte.com.au/frostbyte/cgi-bin/env.pl?some%20param
Steve
------------------------------
Date: Sun, 26 Oct 1997 15:59:37 -0500
From: Michael Watkins <mwatkins@carol.net>
Subject: sorting question
Message-Id: <3453AF39.569C@carol.net>
Can someone please demonstrate how to sort an array by an element of the
array, ie:
I have an array @stuff which contains:
($number, $price, $items, $description)
I need to be able to change the sort order by any of the first three
fields.
@sorted = sort(@stuff); sorts by $number, but what about the other
fields?
Thanks in advance,
michael
------------------------------
Date: Sun, 26 Oct 1997 18:24:07 -0500
From: Joe Gottman <joegottman@worldnet.att.net>
Subject: Re: sorting question
Message-Id: <3453D117.1129@worldnet.att.net>
Michael Watkins wrote:
>
> Can someone please demonstrate how to sort an array by an element of the
> array, ie:
> I have an array @stuff which contains:
> ($number, $price, $items, $description)
>
> I need to be able to change the sort order by any of the first three
> fields.
>
> @sorted = sort(@stuff); sorts by $number, but what about the other
> fields?
>
> Thanks in advance,
> michael
The sort function will take an optional parameter describing the sort
order. To
sort by the second array element, do
@sorted = sort {$a->[1] <=> $b->[1]} @stuff;
Similarly to sort by other array elements (I am assuming that your array
contains
references to other arrays that contain the actual data. If this is the
case, then
in order to sort by $number you will have to do this trick also, using 0
instead
of 1.)
--
Joe Gottman
joegottman@nospam.worldnet.att.net
[Remove nospam to reply]
------------------------------
Date: 27 Oct 1997 01:37:31 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: sorting question
Message-Id: <630r8r$2op$1@comdyn.comdyn.com.au>
In article <3453AF39.569C@carol.net>,
Michael Watkins <mwatkins@carol.net> writes:
> Can someone please demonstrate how to sort an array by an element of the
> array, ie:
perldoc perlfaq4:
How do I sort an array by (anything)?
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Inside every anarchy lurks an old boy
Commercial Dynamics Pty. Ltd. | network - Mitchell Kapor
NSW, Australia |
------------------------------
Date: Sun, 26 Oct 1997 18:38:45 -0500
From: darrik mazey <darrik@uakron.edu>
Subject: the lwp module for a ms-dos/win95 platform...
Message-Id: <3453D485.D278DC36@uakron.edu>
hello friends... can anyone tell me if there is such a thing, and if so,
where to get it? i checked the cpan but i could only find a unix-based
lwp module. also, does the Socket module that comes standard with perl
work on an ms-dos/win95 platform over a dial-up ppp connection?
thanks, and much love...
darrik
darrik@uakron.edu
------------------------------
Date: Sun, 26 Oct 1997 23:47:22 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: the lwp module for a ms-dos/win95 platform...
Message-Id: <ebohlmanEIonEy.C7M@netcom.com>
darrik mazey (darrik@uakron.edu) wrote:
: hello friends... can anyone tell me if there is such a thing, and if so,
: where to get it? i checked the cpan but i could only find a unix-based
: lwp module. also, does the Socket module that comes standard with perl
: work on an ms-dos/win95 platform over a dial-up ppp connection?
Gurusamy Sarathy's Win32 port, available on CPAN, contains a version of
LWP that works for Win32.
------------------------------
Date: Mon, 27 Oct 1997 00:45:43 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Using //
Message-Id: <EIoq47.Jss@world.std.com>
Gerben_Wierda@RnA.nl writes:
> I'd like to use (for speed):
>===============================================
>/$matchline/;
>foreach my $headerline (@header) {
> if ($headerline =~ //) {
>===============================================
>but as some people have explained to me, that doesn't work because // only
>uses the pattern that was last used *succesfully*. Alas, that is not what I
>want. And $matchline *does* contain a regex, so it probably doesn't match
>itself.
Of course, if you never change $matchline, you could just use the /o
modifer, but if you do change it, you still have other options. How
about creating an anonymous subroutine at runtime that will perform
the match.
for my $matchline (@matchlist) {
$match = eval "sub { \$_[0] =~ m/$matchline/};"
for my $headerline (@header) {
print "$headerline\n" if &$match($headerline);
}
}
The eval is time consuming, but the end result may be a win if the
@header list is big enough.
Also, if you can reverse the two loops (So the outer loop is @header),
then you can get rid of the @matchlist loop entirely, by the "match
many" method shown in <URL:http://www.perl.com/CPAN/doc/manual/html
/pod/perlfaq6/How_do_I_eficiently_match_many_.html>
--
Andrew Langmead
------------------------------
Date: 22 Oct 1997 19:13:18 GMT
From: bdmcadam@ford.wdi.disney.com (Bill D. McAdam)
Subject: Re: Wanted: Wall/Schwartz book (1st ed)
Message-Id: <62lj8e$p43@louie.disney.com>
Sitaram Chamarty (sitaram@diac.com) wrote:
: On 09 Oct 1997 19:54:02 +0200, Oliver Flimm <flimm@ph-cip.uni-koeln.de> wrote:
: >I got my panther book here in germany on 16.9. - and I like it a lot ;-)
: Err, umm, what is the panther book? Am I behind in my purchase of Perl books
: (from ORA only, I may add)? :-)
"Advanced Perl Programming"
http://www.ora.com/catalog/advperl/noframes.html
------------------------------
Date: 26 Oct 1997 20:02:31 GMT
From: as646@FreeNet.Carleton.CA (John Robson)
Subject: Your opinion on The Perl Journal (TPJ) ?
Message-Id: <6307kn$i7o@freenet-news.carleton.ca>
The Perl Journal seems to be the only magazine dedicated to Perl. I went
to its website, read some reviews and it looks to me like a fine journal
except for the fact that it's published only 4 times a year (quarterly).
I would like to hear your opinions on it. Do you find it useful? Is it
slanted toward the beginner or the expert, or both? Does it have only
Perl code, or does it also have fun anecdotal stories about how people use
Perl creatively?
What do you like best about the Perl Journal?
Any comments, personal experience are appreciated! (No sales pitch
please! ;)
------------------------------
Date: 26 Oct 1997 18:54:02 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: as646@FreeNet.Carleton.CA (John Robson)
Subject: Re: Your opinion on The Perl Journal (TPJ) ?
Message-Id: <8cbu0ckm2t.fsf@gadget.cscaper.com>
>>>>> "John" == John Robson <as646@FreeNet.Carleton.CA> writes:
John> I would like to hear your opinions on it. Do you find it
John> useful? Is it slanted toward the beginner or the expert, or
John> both? Does it have only Perl code, or does it also have fun
John> anecdotal stories about how people use Perl creatively?
The Perl Journal is the *only* publication that arrives on my doorstep
that I read *cover* to *cover*, and I anticipate the next delivery!
Seriously.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 309 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
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@ora.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: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
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 1231
**************************************