[9832] in Perl-Users-Digest
Perl-Users Digest, Issue: 3425 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 12 09:07:24 1998
Date: Wed, 12 Aug 98 06:00:52 -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 Wed, 12 Aug 1998 Volume: 8 Number: 3425
Today's topics:
Re: ===> Parsing Cobol in Perl (Dwight VandenBerghe)
Re: Access, ODBC and Linux <engel@cbn.net.id>
Re: Can't make flock work as described... (Sitaram Chamarty)
Re: checking if files exist <rra@stanford.edu>
Re: checking if files exist (Brendan O'Dea)
Re: dates in excess of 2037 (A Problem???) <rra@stanford.edu>
Re: File::Copy <rra@stanford.edu>
floating point number precision? (GEMINI)
Re: Help with script (If/Elsif/else) (Bob Trieger)
Re: how can I make my perl cgi script email to a newsgr <dhoffman@fzi.de>
Re: how can I make my perl cgi script email to a newsgr <flavell@mail.cern.ch>
Re: How to test for failed command open useing FileHand <rra@stanford.edu>
I =?iso-8859-1?Q?can=B4t?= run any perl prog. on my ser <vmachado@nt.com>
Re: I =?iso-8859-1?Q?can=B4t?= run any perl prog. on my (Bob Trieger)
Re: IMPORTANT: Proper Netiquette (Mike)
matching problem with (xx)? oc1658@my-dejanews.com
Re: passing variables (matt zandstra)
Re: passing variables <conservative-party@iname.com>
Re: perl question (please help...) <adam@fastfare.co.uk>
Re: Perl Style <tchrist@mox.perl.com>
Q:perlcc Cannot generate image successfully? (LAM Yee-fai ALEX)
Re: Run perl script "in-line"? <adam@fastfare.co.uk>
Re: Run perl script "in-line"? <adam@fastfare.co.uk>
Re: Self-printing code (Brendan O'Dea)
Re: setting env variable b_redeker@hotmail.com
Re: Upload file running on NT <perlguy@inlink.com>
Re: use strict problem with indirect file variables ? <tchrist@mox.perl.com>
Re: Using Perl scripts in perl scripts? <adam@fastfare.co.uk>
Re: variable interpolation <adam@fastfare.co.uk>
verify password <admin@kewl.com.au>
Re: What is the purpose of Perl (Paddy Spencer)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 12 Aug 1998 12:45:04 GMT
From: dwight@pentasoft.com (Dwight VandenBerghe)
Subject: Re: ===> Parsing Cobol in Perl
Message-Id: <35e18d19.1884869819@news.accessone.com>
On Tue, 11 Aug 1998 20:24:09 GMT, naji.mouawad@cmpx.saic.com (Naji
Mouawad) wrote:
>I have need to parse cobol modules (about 100 of them) and build a
>rather simple symbol table of identifiers.
>
>Anyone has written a cobol parser out there?
I wrote a COBOL parser many years ago, and it's not a trivial
task. But if all you need to do is to build a table of
identifiers, then you don't need a full parser. For example,
you could run a standard COBOL cross-reference tool, and
pick off the identifiers from its output.
Here's another approach. I'm quoting from a message sent
to comp.compilers a while ago; it may help you out:
/-----------------------------------------------------------/
>I searched the Comp.Compiler archives and learned that Cobol85 still
>seems to be a problem for parser generators and grammar developers. I
>have solved both of these problems.
>
>(1) LRGen 5.0 can handle Cobol85 (3 seconds to generate compressed
>matrix parser tables on a pentium 200 machine). It can even handle
>much larger grammars.
>
>(2) Cobol85 is about LALR(2) maybe LALR(3) depending on how you deal
>with the 'IS' 'ARE' and ',' (commas). By implementing a 3 level
>recognizer, I was able to make the phrase structure grammar (level 3)
>LALR(1). I had a Lexical grammar (level 1) for the tokens and a
>SuperLex grammar (level 2) for the phrases, (FILE IS SEQUENTIAL, FILE
>SEQUENTIAL, SEQUENTIAL, etc.) I spelled out all possible combinations
>in the SuperLex grammar and in the phrase structure grammar I used the
>complete phrase (FILE_IS_SEQUENTIAL, etc.) This worked out very well.
>One more thing, I ignored 'IS', 'ARE', and ',' (commas) -- they never
>got to level 2.
>
>The grammars are currently in a password protected directory, because
>I wanted to know if anybody was accessing my website. I'm kind of new
>to the idea of just giving stuff away to unknowns who don't even email
>me. I'll probably, be nice and give you the password, if you email
>me. Introduce yourself, get me a job, or something.
>
>I was planning to go after the Year-2000 problem with Cobol85, but
>it's more involved than just grammar issues, so I guess you can have
>the grammars. If you get rich off this stuff, could you send my a few
>hundred dollars??
>
>Paul Mann
>autom@earthlink.net
>http://www.earthlink.net/~autom
/--------------------------------------------------------------------/
Good luck.
Dwight
------------------------------
Date: Tue, 11 Aug 1998 18:36:30 +0700
From: Engelhard <engel@cbn.net.id>
Subject: Re: Access, ODBC and Linux
Message-Id: <35D02CBE.FD4EE3BC@cbn.net.id>
Brent Michalski wrote:
...
> > Does anyone succeded in acceding ODBC database via Perl ?
>
> AFAIK, you cannot use ODBC from a UNIX box to connect to an NT box that
> has an ODBC database on it.
>
> If anyone knows if and how this is possible, please post it. If you
> know why it isn't, please post that as well so that we are all
> enlightened.
>
> Brent
This URL was posted ago, how to connect to MS. Access from UNIX box,
http://www.minivend.com/minivend/faq/
06.09.How_can_I_use_MiniVend_with_Micr.html
(all in one line)
I haven't try it myself.
engel.
------------------------------
Date: 12 Aug 1998 12:26:35 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Can't make flock work as described...
Message-Id: <slrn6t0nn8.d6e.sitaram@diac.com>
On Mon, 10 Aug 1998 15:50:41 GMT, Randal Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "Todd" == Todd B <tbeaulieu@mediaone.net> writes:
>
>Todd> i have noticed that several of the "high profile" users in this
[snip]
>I have noticed that several of the "new" users in this group appear to
[snip]
>(Note: all strictly tongue-in-cheek... if you're offended, you
>must be easily offended. :-)
Why toungue-in-cheek? You phrased it very nicely and poiltely
(which is usual, for you - I have rarely, if ever, seen you go off
the deep end anyway). However, what you said there is perfectly
valid and true.
If someone takes offence, why then, perhaps the shoe fits!
------------------------------
Date: 12 Aug 1998 03:15:22 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: checking if files exist
Message-Id: <m3iujywlol.fsf@windlord.Stanford.EDU>
Tom Christiansen <tchrist@mox.perl.com> writes:
> Assuming that you bothered to install a reasonable operating system and
> traditional filesystem, the following is efficient and effective:
> $is_empty = (stat($dir))[3] == 2;
> If one of my premises is false, you're on your own.
Right. Note that in particular, this fails under AFS:
windlord:/afs/ir/site/leland> perl -e 'print ((stat "dist")[3], "\n")'
2
windlord:/afs/ir/site/leland> ls dist
maillocal newsyslog
--
#!/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: 12 Aug 1998 21:16:51 +1000
From: bod@compusol.com.au (Brendan O'Dea)
Subject: Re: checking if files exist
Message-Id: <6qrtj3$7l$1@duende.compusol.com.au>
In article <6qqse4$e6r$1@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, syarbrou@ais.net (Steve .) writes:
>:How do I go about checking if files exist in a directory? Thanks.
>
>Assuming that you bothered to install a reasonable operating system and
>traditional filesystem, the following is efficient and effective:
>
> $is_empty = (stat($dir))[3] == 2;
Perhaps this should be:
$has_no_subdirs = (stat($dir))[3] == 2;
As far as checking if files exist in a directory:
perldoc -f readdir
would be a start.
Regards,
--
Brendan O'Dea bod@compusol.com.au
Compusol Pty. Limited (NSW, Australia) +61 2 9809 0133
------------------------------
Date: 12 Aug 1998 04:45:24 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: dates in excess of 2037 (A Problem???)
Message-Id: <m3af5awhij.fsf@windlord.Stanford.EDU>
Craig Berry <cberry@cinenet.net> writes:
> In other words, if I have (in C)
> struct log_entry {
> time_t stamp;
> char data[BUFSZ];
> };
> which I'm reading and writing from/to external storage, or other apps,
> or whatever, then a silent change in the size of time_t will break
> everything quite thoroughly. I can't read my external stores, writing
> to them trashes them, other apps that haven't recompiled won't talk to
> mine, and so forth.
Of course, this is because you'd have been using poor coding practice, as
no one has ever guaranteed to you that time_t will be a set size. You
shouldn't have been doing this in the first place, and as soon as you try
to port to a 64-bit platform that increases the size of time_t, you'll
have to fix this problem, just like all the people who assumed that a
pointer would always be the same size as an int.
--
#!/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: 12 Aug 1998 04:58:25 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: File::Copy
Message-Id: <m37m0ewgwu.fsf@windlord.Stanford.EDU>
Peredina <peredina@progress.com> writes:
> Using this module, is there a way to copy the correct permissions,
> particularly the executable?
Nope. You need to read them in from the source file and reapply them to
the destination, and I don't know of a platform-independent way of doing
that. For Unix, you'd do something like:
use File::stat qw(stat);
$stats = stat $source or die "can't stat $source: $!";
copy ($source, $dest) or die "can't copy $source to $dest: $!";
chown ($stats->uid, $stats->gid, $dest) or die "can't chown: $!";
chmod ($stats->mode & 07777, $dest) or die "can't chmod: $!";
or the equivalent with an array and offsets or named variables with the
standard stat, but I find code using File::stat much easier to read.
--
#!/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: 12 Aug 1998 10:30:46 GMT
From: dennis@info4.csie.nctu.edu.tw (GEMINI)
Subject: floating point number precision?
Message-Id: <6qrqsm$kpe$1@netnews.csie.NCTU.edu.tw>
hi all,
I need to do calculation using floating point number in my perl
program. Execept for Math::BigFloat module,
do I have any option to decide the precision of the floating point number?
such as the float or double for C, or the
REAL*4, REAL*8, and REAL*16 for fortran?
thanks.
------------------------------
Date: Wed, 12 Aug 1998 12:02:03 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Help with script (If/Elsif/else)
Message-Id: <6qs0dc$m6f$1@strato.ultra.net>
[ posted and mailed ]
cka@jawa.org wrote:
-> 4: IF ($incominghost eq "www.jawa.org") {
-> 5: print("Location: http://www.jawa.org/default.htm\n\n");
-> 6: }
.. snippola ...
Perl is case sensitive. Why are you capitalizing IF, ELSIF and ELSE?
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972
Ext: 1949 and let the jerk that answers know
that his toll free number was sent as spam. "
------------------------------
Date: Wed, 12 Aug 1998 13:04:09 +0200
From: Dirk Hoffmann <dhoffman@fzi.de>
Subject: Re: how can I make my perl cgi script email to a newsgroup
Message-Id: <35D176A9.DE03192C@fzi.de>
use Net::NNTP;
$nntp = Net::NNTP->new("news.at.your.server");
$nntp->post();
$nntp->datasend("From: Dirk Hoffmann <dhoffman\@fzi.de>\n");
$nntp->datasend("Newsgroups: alt.test\n");
$nntp->datasend("Subject: Hoffi's test\n");
$nntp->datasend("\n");
$nntp->datasend("\n");
$nntp->datasend("Hi!\n");
$nntp->datasend("\n");
$nntp->datasend("This is the Body\n");
$nntp->datasend("seperated from the header by two newlines\n");
$nntp->datasend("\n");
$nntp->datasend("Hoffi\n");
$nntp->dataend();
$nntp->quit;
-- -------------------+ _\\|//_
+--------------------------------------+
| Dirk Hoffmann G105 | (` o-o ') | eMail:
dhoffman@fzi.de |
| Klosterweg 28 +-ooO-(_)-Ooo-+ or
hoffi@joy.net |
| 76131 Karlsruhe _______________ www:
www.uni-karlsruhe.de/~uk1s |
------------------------------
Date: Wed, 12 Aug 1998 13:42:08 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: how can I make my perl cgi script email to a newsgroup
Message-Id: <Pine.HPP.3.95a.980812134126.22792H-100000@hpplus01.cern.ch>
On Wed, 12 Aug 1998, Dirk Hoffmann wrote:
> $nntp->datasend("seperated from the header by two newlines\n");
I detected a perity error.
:-}
------------------------------
Date: 12 Aug 1998 05:05:29 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: How to test for failed command open useing FileHandle
Message-Id: <m34sviwgl2.fsf@windlord.Stanford.EDU>
Ephrayim \"EJ\" Naiman <Ephrayim> writes:
> use FileHandle;
> $fh = new FileHandle("non-existent-command |");
> if(!defined($fh))
> {
> die("Could not find command ...");
> }
> No matter what I do, the $fh still comes back defined. What can/should
> I test for?
There's nothing you can check for. You've already forked by the time you
try to exec, so your child is getting the error. Your child no longer has
a communications path to the parent to tell it that the exec failed, so
the most that it can do is die with a non-zero exit status and not write
anything to the pipe.
--
#!/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: Wed, 12 Aug 1998 09:22:46 -0300
From: Veronica Machado <vmachado@nt.com>
Subject: I =?iso-8859-1?Q?can=B4t?= run any perl prog. on my server
Message-Id: <35D18916.C7607C96@nt.com>
My server doesn=B4t accept any perl program .
Does anyone know why ??
------------------------------
Date: Wed, 12 Aug 1998 12:33:00 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: I =?iso-8859-1?Q?can=B4t?= run any perl prog. on my server
Message-Id: <6qs27b$m6f$2@strato.ultra.net>
Veronica Machado <vmachado@nt.com> wrote:
-> My server doesn=B4t accept any perl program .
-> Does anyone know why ??
Are you by chance writing the programs on 3x5 cue cards and trying to feed
them into the floppy drive?
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972
Ext: 1949 and let the jerk that answers know
that his toll free number was sent as spam. "
------------------------------
Date: 12 Aug 1998 11:09:47 GMT
From: schutzmd@SPAMFREEjmu.edu (Mike)
Subject: Re: IMPORTANT: Proper Netiquette
Message-Id: <6qrt5r$lgi$1@lark.jmu.edu>
I liked the "Be Brief" section.
------------------------------
Date: Wed, 12 Aug 1998 11:51:20 GMT
From: oc1658@my-dejanews.com
Subject: matching problem with (xx)?
Message-Id: <6qrvjo$42p$1@nnrp1.dejanews.com>
Suppose i need to match a substring which *could* be preceded by 'is'.
I'm trying:
m/(.+)(is)?(.*)
For example in
'The cat is over the table'
i need 'The cat' in $1
and in
'The cats are over the table'
i need 'The cats are over the table' in $1
Now i always obtain 'The cats are over the table' in $1.
I can't understand why (is)? doesn't match according to the 'greedy' perl
regexp default. I suspect it's something related to the first item (.+) but i
didn't find any solution out there.
Please, remember i don't need a generic solution to this example (there are
many trivial), but an opinion on the regexp pattern.
Can someone help me?
Thank you, Omar Cal
omar.cal@altavista.net
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Wed, 12 Aug 1998 10:30:18 +0100
From: matt@zink.demon.co.uk (matt zandstra)
Subject: Re: passing variables
Message-Id: <matt-1208981030180001@zink.demon.co.uk>
I don't think that you can do what you want with one invocation of your
perl script.
Once loaded, you could get your javascript to call your perl script again
with the dp variable.
The big problem I've found with JavaScript server communication is to
avoid reloading the current page every time you want to talk to your
script. The usual way round this is for your script to change the location
of a separate window or hidden frame -- adding parameters to the url.
I have written a perl module and javascript library to help with this --
though I haven't got round to testing or documenting these fully. Send me
mail if you get stuck, and I'll pass them on to you.
matt
In article <35D14710.223C182D@se.bel.alcatel.be>, Inge Soetens
<soetensi@se.bel.alcatel.be> wrote:
> Hi all,
>
>
> can somebody tell me if it is possible to pass variables which are
> assigned in a Javascript function, to a perl script.
>
> A part of the code of the perl script is included in here :
>
>
> print "Content-TYPE: text/html\n\n";
> print "<HTML><HEAD>\n";
> print "<SCRIPT LANGUAGE='JavaScript'> \n";
> print "<!-- \n\n";
> print " var dp ; \n ";
> print " function GetDp() { \n\n\n";
> print " dp =
parent.fraList.document.update.dp_name.value ; \n";
> print " return dp ; \n ";
> print " }\n";
> print "//--> \n";
> print "</script> \n";
> print "</HEAD>\n";
> print "<BODY ONLOAD=\"GetDp()\"> \n";
>
> print "</BODY></HTML>\n";
> print "<BR>\n";
>
> now, the next step in this perl script has to do with the parameter dp
> from the javascript function .
> How can i read it here ?
>
> Can somebody help me ?
>
>
> Thanks in advance
>
>
> Kind Regards
> Inge
--
matthew zandstra
http://www.corrosive.co.uk/zink/index.html
------------------------------
Date: Wed, 12 Aug 1998 14:32:48 +0200
From: "Michael W. Lancaster" <conservative-party@iname.com>
Subject: Re: passing variables
Message-Id: <35D18B70.BC2FC3E2@iname.com>
Wednesday, 12th August, 1998
Hello Inge,
In which way exactly do you wish to manipulate your 'dp' variable. You
can accomplish any operations therewith as you customarily would in HTML
only you need to incorporate those provisional HTML tags into 'print
"[...]\n";' statements. If you've been referring to, e.g. converting
such JS variables into strings, performing arithmetic operations etc. in
your CGI script, then to the best of my knowledge you couldn't do it.
Cheerio,
Michael W. Lancaster.
***** BEGIN *****
> can somebody tell me if it is possible to pass variables which are
> assigned in a Javascript function, to a perl script.
>
> A part of the code of the perl script is included in here :
>
[PERL code expurgated]
>
> now, the next step in this perl script has to do with the parameter dp
> from the javascript function .
> How can i read it here ?
***** END *****
--
Conservative and Unionist Party
Personal: http://www.serve.com/lordgovernor/
Official: http://www.tory.org.uk/
------------------------------
Date: Wed, 12 Aug 1998 12:56:03 +0000
From: Adam Ipnarski <adam@fastfare.co.uk>
To: Alexander Zurhorst <zurhorst@aol.com>
Subject: Re: perl question (please help...)
Message-Id: <35D190E3.47E25E6B@fastfare.co.uk>
Alexander Zurhorst wrote:
>
> 1.Is it possible to have a script, which shows you informations about your
> hard disc (e.g. free space) and more important:
> 2. show all programs running (like the taskmanager) a.) on a single
> computer
> b.)in a network
> (I need a perl script, which counts all open CAD-programs...)
> --
> Alexander Zurhorst (Germany)
> zurhorst@aol.com
What OS are you using?? What Network are you using??
If you are using UNIX, just use shell commands:
my $disk_full = qx!df!;
## Do whatever on $disk_full to find the right disk.
my $processes = qx!ps aux! ## Or ps -ef on a SysV Unix.
## Do whatever on $processes
For network processes, it is very difficult... you would probably have
to export /proc from the remote machine or something like that. Not a
desperately good idea to do that :-)
If you are using win32, you may be able to do something with the win32::
modules to call one of the system DLLs, but it won't be easy.
--adam
Adam Ipnarski
Senior Programmer, Faresearch
adam@fastfare.co.uk | www.travelselect.com
------------------------------
Date: 12 Aug 1998 12:51:50 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Style
Message-Id: <6qs356$efm$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Scott.L.Erickson@HealthPartners.com (Scott Erickson) writes:
:I, for one, believe
:that using 'or' is much more readable than ||,
Do you also believe that `plus' is more readable than `+' comma
or that `BEGIN' is more readable than `{' question mark
--tom
--
You want it in one line? Does it have to fit in 80 columns? :-)
--Larry Wall in <7349@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: 12 Aug 1998 11:48:31 GMT
From: ccalam@cpccux0.cityu.edu.hk (LAM Yee-fai ALEX)
Subject: Q:perlcc Cannot generate image successfully?
Message-Id: <6qrvef$7p3@news1.cityu.edu.hk>
Hello All,
I get the latest perl (5.005_001) and want to convert
perl script into native EXE under WIN32 environment.
I try a simple perl script (hello world) as follows:
C:\>type hello.pl
print "Hello World\n";
The script run fine with perl hello.pl
Q1.When I try to perlcc it, I get "Couldn't open !"
ERROR (Listed as follows:) Any Help Please?
Q2. Do I have to install a backend compiler, such as VC++
or BC++ in order to have the image compiled?
C:\>perlcc hello.pl
-----------------------------------------------------------------------
Compiling hello.pl:
-----------------------------------------------------------------------
Making C(hello.pl.c) for hello.pl! C:\PERL\5.005\BIN\MSWIN3~1\PERL.EXE
-IC:\PERL\5.005\lib/MSWin32-x86-object -IC:\ PERL\5.005\lib
-IC:\PERL\site\5.005\lib/MSWin32-x86-object -IC:\PERL\site\5.005\ lib
-IC:\PERL\site\lib -I. -MO=CC,-ohello.pl.c hello.pl hello.pl syntax OK
Compiling C(hello) for hello.pl!
Couldn't open !
^^^^^^^^^^^^^^^
Thanks in advance for any advise!
Best Regards,
Alex
------------------------------
Date: Wed, 12 Aug 1998 12:11:16 +0000
From: Adam Ipnarski <adam@fastfare.co.uk>
To: lee.davies@saaconsultants.com
Subject: Re: Run perl script "in-line"?
Message-Id: <35D18664.97633228@fastfare.co.uk>
Lee Davies wrote:
>
> Is there a neat way to run a perl script in-line in much the same way as
> Javascript can be embedded?
>
> I have a perl script which collects some server details (hostname, port, OS
> version etc.) and want this information echoed into the current document.
> This has to happen without user intervention.
>
> Any suggestions?
Not unless you write a Web browser to do that!
Scripting Languages are run at the client (i.e. Browser) end, so it
would mean having to build a Perl interpreter into the browser, and
develop a cut-down form of Perl - PerlScript :-) to prevent access to
local machine resources.
--adam
Adam Ipnarski
Snior Programmer, Faresearch
adam@fastfare.co.uk | www.travelselect.com
------------------------------
Date: Wed, 12 Aug 1998 12:43:40 +0000
From: Adam Ipnarski <adam@fastfare.co.uk>
Subject: Re: Run perl script "in-line"?
Message-Id: <35D18DFC.4E3F98FB@fastfare.co.uk>
lee.davies@saaconsultants.com wrote:
>
> Good point. Badly worded question on my part!
>
> However... say that I have a cgi script (shell, perl etc.) that collects some
> system information such as hostname, port number, etc.
>
> What if I have a HTML page that needs to display the results of this script, but
> without user intervention. Say a page that displays certain host details at the
> top of each page.
>
> Can I force the HTML to execute the script automatically, without the
> user having to click anything...?
>
> Lee.
Hmmm... It's possible, but not easy :-).
You could do the same thing as Perl counters do: Include an image in
the HTML file, who's src is that of your cgi script. The problem is
that your program will have to return the information in gif/jpg/png
format!! This is difficult, but you could probably find source to a Perl
counter and hack it.
Alternatively, you could use Server Side Includes, which would prevent
you having to use Perl at all. I don't know much about SSI, but look at
http://www.apache.org/docs/mod/mod_include.html
Basically SSIs fill in information based on Server-specific tags that
you include into your HTML document. The problem is that a) It may not
have everything you want, and b) A lot of servers have it switched off,
as it isn't used much.
Apart from that, you could generate the entire HTML document in Perl,
and print it out, like:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html><body><h1>Your Information</h1><p>\n";
print &get_information();
print "</body></html>\n";
1;
This is probably the easiest one to use.
--adam
Adam Ipnarski
Senior Programmer, Faresearch
adam@fastfare.co.uk | www.travelselect.com
------------------------------
Date: 12 Aug 1998 20:49:53 +1000
From: bod@compusol.com.au (Brendan O'Dea)
Subject: Re: Self-printing code
Message-Id: <6qrs0h$6k$1@duende.compusol.com.au>
In article <6qn9un$d0t$1@nnrp1.dejanews.com>,
Robin Houston <robin.houston@guardian.co.uk> wrote:
>Last week there was a thread about perl programs which print their
>own source (without reading it in). Someone perceptively pointed
>out that the shortest such program was the null script - a
>zero-length file.
>
>Aside from this trivial case, what's the shortest such program?
>I've found two short, fairly neat examples.
>The first is a one-liner:
>
>print map "$_, q{$_}\n", q{print map "$_, q{$_}\n"}
>
>Are there any shorter such programs?
How 'bout:
$_=q(print qq(\$_=q($_);eval\n));eval
Regards,
--
Brendan O'Dea bod@compusol.com.au
Compusol Pty. Limited (NSW, Australia) +61 2 9809 0133
------------------------------
Date: Wed, 12 Aug 1998 11:00:47 GMT
From: b_redeker@hotmail.com
Subject: Re: setting env variable
Message-Id: <6qrskv$r8h$1@nnrp1.dejanews.com>
In article <6qpmop$9ti$2@msunews.cl.msu.edu>,
Dan Nguyen <nguyend7@egr.msu.edu> wrote:
> Dan Nguyen <nguyend7@egr.msu.edu> wrote:
> : Brad Legge <blegge@iafrica.com> wrote:
> : : I am having problems setting an environment variable with the value of an
> : : array. I am using perl5.003 on SunOs with Apache.
>
> : : How do I go about setting an environment variable with the value of an
> : : array. I have tried using the setenv with a system call but it doesn't
seem
> : : to accept my array as an argument.
[snip]
>
now I don't know exactly what you want to do, so ignore me if I'm being
stupid, but I think you have @myparams = ('/s','/d','/f'); # or whatever now
if you call system ("myprogram.exe ".@myparams); # runs myprogram 3, so wrong
system ("myprogram.exe @myparams"); # runs myprogram /s/d/f, maybe wrong
system ("myprogram.exe ".join(' ',@myparams)); # runs myprogram /s /d /f
does that help?
--
Boudewijn
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Wed, 12 Aug 1998 11:56:51 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: Upload file running on NT
Message-Id: <35D18303.E0E3627A@inlink.com>
Step 1:
use CGI;
Step 2:
You will need to use the "binmode" function on your file handle.
Try this:
open(MYHANDLE,">ldjfdjfsjdfjsdj");
binmode(MYHANDLE);
...rest of program here
Here is the quote from Lincoln Stein's CGI.pm page: The whole document
can be found at: http://stein.cshl.org/WWW/software/CGI/cgi_docs.html
"If you find that binary files get slightly larger when uploaded but
that text files remain the same, then binary made is not correctly
activated. Be sure to set the $OS variable to 'NT' or 'WINDOWS'. If you
continue to have problems, make sure you're calling binmode() on the
filehandle that you use to write the uploaded file to disk. "
HTH,
Brent
------------------------------
Date: 12 Aug 1998 12:48:35 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: use strict problem with indirect file variables ?
Message-Id: <6qs2v3$efm$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, phil@ackltd.demon.co.uk (Phil Taylor) writes:
:Apologies for making you Grrrrr, your help is appreciated. I'm not
:sure where I'm going wrong, the book says I would have tought myself
:Perl by now. I'm well over the 21 days.
My first guess is choice of book. Also, remember that its title is a
trademarked marketing gimmick, not a realistic time estimate. I would
suggest other books, but I'd just get in trouble. :-)
--tom
http://perl.oreilly.com/
--
"No, I'm not going to explain it. If you can't figure it out,
you didn't want to know anyway..." --Larry Wall
------------------------------
Date: Wed, 12 Aug 1998 12:40:10 +0000
From: Adam Ipnarski <adam@fastfare.co.uk>
To: clarkj5@boat.bt.com
Subject: Re: Using Perl scripts in perl scripts?
Message-Id: <35D18D2A.86B98183@fastfare.co.uk>
Jason clark wrote:
>
> I am trying to call a perl script from withing another perl script using
> the below syntax.
> However each time i run this, the condition is always true. if somthing
> in "config.pl" script has failed I will want the calling script to know
> this by somehow returning a code.
> (return(0); do not appear to work?).
> -[snip]-
Ummm... First of all, don't bother backticking a script to call it. use
'require("myfile.pl");'. This will load myfile.pl, execute it, and then
return control to your program. Don't forget that myfile.pl will run in
the same package as your currently executing program - so you might want
to declare a new package in your called file.
Secondly, how to detect if errors have ocurred, stick the require in an
'eval{};' statement. This runs whatever is within the enclosing braces
in a 'protected' space. So, if an error occurs, rather than halting
execution, execution is passed to outside the eval block, and you can
test for an error by seeing if $@ is set. Thus:
eval {
require("myscript.pl");
};
if ($@) {
## Did not work
print STDERR "Error:$@\n";
return(0);
}
return (1);
You might want to read through the perl man pages. 'man perlsub'
ontains a way of creating a 'try {} catch {}' syntax , a la C++/Java.
This might be of use to you. If you don't have access to a UNIX box,
try: http://language.perl.com/info/documentation.html
And follow links.
Hoep this helps.
--adam
Adam Ipnarski
Senior Programmer, Faresearch
adam@fastfare.co.uk | www.travelselect.com
------------------------------
Date: Wed, 12 Aug 1998 12:05:11 +0000
From: Adam Ipnarski <adam@fastfare.co.uk>
To: bday@cbr.eng.sun.com
Subject: Re: variable interpolation
Message-Id: <35D184F7.D15E9321@fastfare.co.uk>
Brian Day wrote:
>
> Does anyone know if there is a way to have a variable name interpolated inside
> another variable name ? i.e.:
> -[snip]-
Yes, you can use symbolic references (See man perlref). Here's some
simple code to do what you asked for:
use strict 'vars';
use vars qw($sandwich_count $drinks_count);
$sandwich_count = 0;
$drinks_count = 0;
my $sandwich = "sandwich";
my $drinks = "drinks";
tally ($sandwich); tally($drinks); tally($drinks);
print "After Tallying: $sandwich:$sandwich_count,
$drinks:$drinks_count\n\n";
sub tally {
my $count_name = $_[0]."_count";
$$count_name++; ## Sets $xx_count.
}
This will print: After Tallying: sandwich:1, drinks:2
Remember that 'use strict' will produce errors with symbolic references
unless you use 'no strict 'refs'' or only 'use strict 'vars'' (as I've
done).
Hope this helps.
--adam
Adam Ipnarski
Senior Programmer, Faresearch
adam@fastfare.co.uk | www.travelselect.com
------------------------------
Date: Wed, 12 Aug 1998 20:51:27 +1000
From: "Craig Nuttall" <admin@kewl.com.au>
Subject: verify password
Message-Id: <6qrs2k$phv$1@nswpull.telstra.net>
I am trying to verify user passwords on a linux system with shadow passwd
file
Ultimately, the script will be called from a web form but I have scripted a
console
version for the purpose of testing and simplicity.
#!/usr/bin/perl
print "what is your username? ";
$name = <STDIN>; chomp ($name);
print "what is your password? ";
$guess = <STDIN>; chomp ($guess);
$passwd = (getpwnam ($name))[1];
$salt = $passwd, 0, 2;
if (crypt ($guess, $salt) ne $passwd) {
print "the encrypted password for $name is $passwd you guessed
$guess\n";
} else {
print "good guess\n";
}
This works perfectly under a root login, but under any other login, $passwd
returns "x"
obviously this is coming from the /etc/passwd file....
the easy fix would be to chmod the shadow file, but I am reluctant to for
security......
is there a better way ????
can I make this script run AS root ?????
------------------------------
Date: Wed, 12 Aug 1998 09:58:54 GMT
From: paddy.spencer@parallax.co.uk (Paddy Spencer)
Subject: Re: What is the purpose of Perl
Message-Id: <902915934.614596@red.parallax.co.uk>
Kello Tue, 11 Aug 1998 16:49:55 -0400, John Porter <jdporter@min.net>
kirjoittanut:
: Craig Berry wrote:
: >
: > I just had the weird image of the immediately post-big-bang Perlverse
: > consisting of undifferentiated typeglobs, then as the energy density
: > falls, there's a symmetry break into scalars and composites, then as it
: > falls still further, composites subdivide into hashes and lists.
: I think data types are more like fundamental particles.
: Operators are guage interactions.
I think I'm on the verge of a new newsgroup law:
"Any thread on a newsgroup, if it exists for long enough, will
degenerate into a discussion of particle physics."
Of course "long enough" is an inifinitely moveable feast and scales
non-linearly with newsgroup hierarchy.
--
Paddy Spencer
Parallax Solutions Ltd (http://www.parallax.co.uk/)
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3425
**************************************