[11186] in Perl-Users-Digest
Perl-Users Digest, Issue: 4786 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 30 18:07:19 1999
Date: Sat, 30 Jan 99 15:00:20 -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 Sat, 30 Jan 1999 Volume: 8 Number: 4786
Today's topics:
Bytecode sharing between interpreters <minaret@sprynet.com>
Re: Can't assign an array to a hash key in a dbm file? <rick.delaney@home.com>
Re: Can't assign an array to a hash key in a dbm file? <rick.delaney@home.com>
Comments in Perl code (BloodStone)
Date and Time handling routines in Perl risermun@hotmail.com
Re: Fixed width, but varying # of fields - better way? scraig@my-dejanews.com
How does 'mail' program works <nishants@usc.edu>
Re: How to e-mail Web Form Data? <jjarrett@ecpi.com>
Re: how to pass scalars AND variables to a sub? <ruedas@geophysik.uni-frankfurt.de>
Re: how to pass scalars AND variables to a sub? scraig@my-dejanews.com
how to return a CGI while program is still running? zirconx@my-dejanews.com
How to support both short and long option styles? (Marc Haber)
Re: impossible configure perl CGI on IIS4? (Chris Jones)
Re: IO::Socket and peerhost() usage (Ronald J Kimball)
Is there a way to check if a called subroutine actually <ra1593@email.sps.mot.com>
Re: Is there a way to check if a called subroutine actu <ra1593@email.sps.mot.com>
local($_) - why not "my"? <goldstern@tuwien.ac.at>
need help with perlcc <tedshieh@monmouth.com>
Re: NPH script and 403 Forbidden header (Ronald J Kimball)
Re: ok please don't shoot me for this question <eugene@snailgem.org>
Re: perlxs problem <estabroo@ispn.com>
Re: Remove all non a-z characters? (Tad McClellan)
replying to forms queston; stucked <karl@nospamaddYproline.at>
Re: Sending email (Ronald J Kimball)
Using Post but Query String appearing in URL <bcompson@yahoo.com>
Re: Using Post but Query String appearing in URL <staffan@ngb.se>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 30 Jan 1999 14:53:20 -0500
From: "Geoff Mottram" <minaret@sprynet.com>
Subject: Bytecode sharing between interpreters
Message-Id: <78vo0d$lae$1@juliana.sprynet.com>
I've got a web based Perl application that eats up about 4 megabytes of
RAM for the data portion of the program. The bulk of this ought to be
compiled bytecodes as the Perl scripts are on the large size. Now I want
to scale this application up from 20 to 200 simultaneous users but don't
like the memory requirements that result (200 x 4 MB = 800 MB).
One solution that seems promising is the idea of a shared memory segment
where all Perl compiled byte code on a machine would be stored. It would
perform the same funcation as a shared library does for binary code. It
should also hopefully result in faster load times for Perl scripts if
included modules are already compiled and in the shared memory space.
Does anyone have any thoughts on this approach?
Does anyone know of any code that does something like this?
Thanks in advance.
Geoff Mottram
minaret@sprynet.com
------------------------------
Date: Sat, 30 Jan 1999 21:58:45 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Can't assign an array to a hash key in a dbm file?
Message-Id: <36B3826E.73EF1442@home.com>
Cameron Kaiser wrote:
>
> fox-at-enchanter-net@SPAM.BLOCK (Brian Kendig) writes:
>
> >If I can only store references to the arrays, does this mean I can only
> >store scalar values in a DBM file? That doesn't seem very useful, so I
> >must be missing something. (A lesson I've learned: if it's a choice
> >between me being wrong or Perl being wrong, it's not Perl being wrong.)
>
> No, you can continue to access the arrays, you just have to dereference them.
Except that we're talking about dbm files here, so there's not going to
be anything to dereference.
> Try
>
> my @dog;
> $dog[0] = 5;
> @{ \@dog }[0] = 10;
I find it interesting that this doesn't produce a warning, whereas
@dog[0] = 10;
does. Regardless, you should still write
${ \@dog }[0] = 10;
> print $dog[0];
>
> \@dog, as you probably already know, takes the reference to @dog. You
> dereference it and you have your array back, ready for subscripting.
>
> >>Most importantly, have you considered that you are not providing a pattern to
> >>split()?
He is providing a pattern, just not the right one.
> >That shouldn't be a problem, because I want to split on whitespace (\n
> >is the only whitespace in the input), and 'split' defaults to splitting
> >on whitespace.
>
> That hasn't been my experience:
>
> $hi = "wiffle doodle";
> print scalar(split($hi)), "\n";
> print scalar(split(/\s+/, $hi)), "\n";
>
> You get 0 and 2. They are not the same. In fact, the 0 tells you it
> didn't split at all. In any case, I wouldn't bank on this, even if it
> does work for you.
The reason the first split produces 0 elements is because the variable
you are trying to split on is undefined. That variable is $_ and
running this under -w would have told you there was an unitialized
variable. The syntax for split is
split /PATTERN/,EXPR,LIMIT
In the above example, $hi is the PATTERN in the first split. $_ is used
as the string to split if EXPR is omitted, which it was.
perldoc -f split
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Sat, 30 Jan 1999 22:47:28 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Can't assign an array to a hash key in a dbm file?
Message-Id: <36B38DCD.4FE9053F@home.com>
Brian Kendig wrote:
>
> Neither I nor any other pairs of eyes who have looked at this here
> have been able to figure it out.
>
> (1) I want to take a multi-line field from a web form submission, turn
> it into an array, and store that in a hash in a DBM file.
If you *really* want to do that you should look into MLDBM on CPAN.
> Here's my code to do that:
>
> dbmopen(%DB, $db, undef);
> $listname = $input{'listname'}; $listcontents = $input{'listcontents'};
> $DB{$listname} = [ split($listcontents) ];
> dbmclose(%DB);
You're splitting the wrong thing there. You should run ALL programs
under -w.
split(' ', $listcontents);
perldoc -f split
You should also check that the dbmopen was successful.
dbmopen(%DB, $db, undef) or die "Can't dbmopen $db: $!\n";
>
> Page 267 of the blue camel book leads me to believe that this should
> work. However, the actual value which gets assigned to the hash key
> is the string "ARRAY(0x1005fae4)". Why is this?
>
> The only explanation I can think of is that it's trying to store the
> array by reference instead of by value, and it's useless to store a
> reference in a data file -- the referenced array will be long gone the
> next time the program runs.
Correct. But I believe MLDBM gets around this by storing perl code that
can be eval'ed to recreate your array. I've never used this module so
I'm not totally sure about this, but I'm pretty sure you want to look
into it since it says so in perlfaq4, "How can I store a
multidimensional array in a DBM file?"
>
> (2) Just for kicks I tried storing the value as a string instead of an
> array, but that didn't work either:
Also suggested by the FAQ.
>
> dbmopen(%DB, $db, undef);
> $listname = $input{'listname'}; $listcontents = $input{'listcontents'};
> $DB{$listname} = join(' ', split($listcontents));
> dbmclose(%DB);
>
> I do a 'split' in a 'join' to change $listcontents from
> newline-delimited to space-delimited; it's not the most efficient way,
> but it should work, shouldn't it? It doesn't -- the 'join' function
> isn't returning anything. What am I doing wrong here?
Same thing as above, however why not just store the string with the
newlines?
$DB{$listname} = $listcontents;
Then you can always split it when accessing the data, if you need to.
my @contents = split ' ', $DB{$listname};
>
> (3) For future reference, how do I translate 'dbmopen'/'dbmclose'
> calls into 'tie'/'untie' calls? I see that 'dbmopen' is deprecated in
> Perl 5, but there are so many options to 'tie' that I don't know what
> to use to achieve the same exact functionality of 'dbmopen'.
This might not be _exactly_ the same functionality, but it's pretty
close.
#!/usr/local/bin/perl -w
use strict;
use AnyDBM_File;
use Fcntl;
my $filename = 'dogs';
my %hash;
tie %hash, 'AnyDBM_File', $filename, O_CREAT|O_RDWR, 0666
or die "Can't open $filename: $!\n";
print $hash{Biff};
$hash{Biff} = "Woof!\n";
untie %hash;
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Sat, 30 Jan 1999 22:26:34 GMT
From: aaron.smith@home.com (BloodStone)
Subject: Comments in Perl code
Message-Id: <36b3869d.27063406@news>
Do comments in codes slow down there processing? And if so, how much?
Thanks.
BloodStone
------------------------------
Date: Sat, 30 Jan 1999 17:47:02 GMT
From: risermun@hotmail.com
Subject: Date and Time handling routines in Perl
Message-Id: <78vgik$2ed$1@nnrp1.dejanews.com>
I am looking for routines that will find the difference between two dates and
return an integer value and/or the day of the week. Also routines which give
you the difference between two time values and return number of seconds and a
routine which will add seconds to a time value (e.g. 13:30) and give you the
time after addition.
I am hoping there is a public domain library out there which includes routines
like above. If it helps, I am programming on UNIX.
Thanks in advance for any reply.
risermun@hotmail.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 30 Jan 1999 20:36:22 GMT
From: scraig@my-dejanews.com
Subject: Re: Fixed width, but varying # of fields - better way?
Message-Id: <78vqg5$ah7$1@nnrp1.dejanews.com>
In article <36B23BDD.99E1FA9F@home.com>,
Terry Haroldson <tharoldson@home.com> wrote:
> How can I parse out this data that is somewhat fixed in length, but not
> all fields are always present.
Use unpack().
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 30 Jan 1999 14:57:06 -0800
From: Nishant Shah <nishants@usc.edu>
Subject: How does 'mail' program works
Message-Id: <Pine.GSO.4.02.9901301453470.9479-100000@nunki.usc.edu>
hello
i am writing a perl program which uses pipe to send mail to many persons.
Now i am able to send the mails but without subject.
Is there any 'command line' option with mail program which allows me to
write the subject field. Or is there any option in Perl to do so.
Please help me out
Thx
-Nishant
------------------------------
Date: Sat, 30 Jan 1999 13:46:25 -0500
From: "John T. Jarrett" <jjarrett@ecpi.com>
To: Tom Bellmer <tbellmer@sky.net>
Subject: Re: How to e-mail Web Form Data?
Message-Id: <36B35380.F18281EC@ecpi.com>
Tom Bellmer wrote:
>
> I have seen this done before, now I just need the
> generic code to utilize this on my UNIX based system
> home page. Can anyone forward this code or recommend
> a web site that might be what I am after?
>
http://www.bignosebird.com is a good place to start out and has a
generic mail form script
http://www.cgi101.com has a more in-depth tutorial to show what you are
doing as you write your own
> Please respond to me directly via e-mail as I will
> not be a regular read of this newsgroup. Thanks so
> much!
That's kind of rude, actually, to suggest that the answer to your
question might not be posted where others could find it, for one, you
won't come back to see if you got answered for two, and for three this
is the wrong news group for this question anyway - try
comp.infosystems.www.authoring.cgi in the future.
And hope the links above help.
John
------------------------------
Date: Sat, 30 Jan 1999 19:32:31 +0100
From: Thomas Ruedas <ruedas@geophysik.uni-frankfurt.de>
Subject: Re: how to pass scalars AND variables to a sub?
Message-Id: <36B3503F.4DAA@geophysik.uni-frankfurt.de>
Hello,
thank you very much for your replies, the problem was in fact the
@dummy=split(/ /,$_);
Following your suggestion, I replaced it with
split ' ', $_; resp. @dummy=split (' ',$_);
which seems to be the same. I didn't even know this kind of split
exists, but now it works.
BTW, the dataset I have to handle doesn't contain initial spaces (as I
admit, this could not be seen from my posting).
Best regards,
Thomas
--
--------------------------------------------
Thomas Ruedas
Institute of Meteorology and Geophysics,
J.W. Goethe University Frankfurt/Main
Feldbergstrasse 47 D-60323 Frankfurt/Main, Germany
Phone:+49-(0)69-798-24949 Fax:+49-(0)69-798-23280
e-mail: ruedas@geophysik.uni-frankfurt.de
http://www.geophysik.uni-frankfurt.de/~ruedas/
--------------------------------------------
------------------------------
Date: Sat, 30 Jan 1999 20:59:34 GMT
From: scraig@my-dejanews.com
Subject: Re: how to pass scalars AND variables to a sub?
Message-Id: <78vrrj$bi4$1@nnrp1.dejanews.com>
In article <36B25314.3359@geophysik.uni-frankfurt.de>,
Thomas Ruedas <ruedas@geophysik.uni-frankfurt.de> wrote:
> Each entry of @all looks like this:
> 9901251819 17. 4.29 N 75.68 W 33 5.8 COLOMBIA
> @dummy=split(/ /,$_);
> It happens that the wrong array elements of @dummy are taken and that
> $dummy[7] is empty in most cases although it should be e.g. 5.8 (in the
> example line above).
The split above uses a single space as the pattern. If two spaces appear
together then the empty string between them is one of the items returned.
Another potential problem are leading spaces. The empty strings at the
beginning would be returned, throwing off the count.
The default behavior of split with no arguments avoids these problems. i.e.,
split;
skips leading whitespace, then splits $_ on /\s+/.
If the fields are always in the same column positions, it is also possible to
use unpack() instead.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 30 Jan 1999 18:55:16 GMT
From: zirconx@my-dejanews.com
Subject: how to return a CGI while program is still running?
Message-Id: <78vkih$5nl$1@nnrp1.dejanews.com>
Hello.. I'd am writing a CGI that sends email to a list of users.
The way it is now, the browser says "host contacted, waiting for reply"
for as long as it takes to complete the email, then the CGI returns
and the success page is displayed. Is there anyway I can return
somehow and let the program continue on with its business?
I think it may involve signals but I am new to those. Thanks a
lot for any help.
I'm pretty good at perl so I'm not asking for a lot of help here
just a pointer. Thanks,
Ryan
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 30 Jan 1999 18:25:46 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: How to support both short and long option styles?
Message-Id: <78vira$orf$1@news.rz.uni-karlsruhe.de>
Hi!
I am trying to write a program that supports a command line like
myprogram [-dv] [-f|--force] [-s|--state <file>] <config_file>
I believe that I need to use both Getopt::Std and Getopt::Long since
Getopt::Std does not support "long" options and Getopt::Long does not
support aggregating "short" options.
I have code like this:
|my %shortopts;
|
|print "\@ARGV: @ARGV\n";
|getopts( 'dvf:s:', \%shortopts );
|print map{ "$_ => $shortopts{$_}\n" } keys %shortopts;
|
|print "\@ARGV now: @ARGV\n";
|
|my $force = 0;
|my $stateFile = $STATEFILE;
|my $verbose = 0;
|my $debug = 0;
|
|GetOptions( "d" => \$debug,
| "v" => \$verbose,
| "force" => \$force,
| "state=s" => \$stateFile ) or die "can't get long options";
|
|print "\@ARGV: @ARGV\n";
|print "\$verbose == $verbose\n";
|print "\$force == $force\n";
|print "\$stateFile == $stateFile\n";
If I process the short options first, I can't use any long options
since getopts complains about a unknown option "-". If I process the
long options first, GetOptions barfs if I try to aggregate one-letter
options like "myprogram -df".
The docs for getopts and GetOptions show clearly how to use these
functions, the examples from the Camel book and the Perl Cookbook say
the same. But nowhere is explained how to use both functions together.
Do I have any chance to get by without having to parse the command
line myself?
Any hints will be appreciated.
Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Karlsruhe, Germany | Beginning of Wisdom " | Fon: *49 721 966 32 15
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29
------------------------------
Date: Sat, 30 Jan 1999 20:35:11 GMT
From: cj@interlog.com (Chris Jones)
Subject: Re: impossible configure perl CGI on IIS4?
Message-Id: <36b36c63.17837018@news.interlog.com>
Interesting following this thread. I am just today trying to get CGI
to work with Personal WEB Server on my Win95 laptop. I had nothing
but trouble trying to get PWS to recognize itself. I suppose it will
be a struggle to get CGI to work.
I was using Xitami which installed and worked in about 15 minutes.
CGI worked immediately without any trouble. Unfortunately, the client
I am working want to use IIS, oh well....
------------------------------
Date: Sat, 30 Jan 1999 14:01:32 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: IO::Socket and peerhost() usage
Message-Id: <1dmg4ya.qg97ek1pv6r58N@bay1-58.quincy.ziplink.net>
Marquis de Carvdawg <carvdawg@patriot.net> wrote:
> while (($new_sock,$ip) = $sock->accept() ) {
>
> < What do I need to do here to determine the IP of connecting
> station???>
>
> }
I do something like this in one of my scripts, using the IO::Socket
module:
$client = $sock->accept();
$iaddr = $client->peerhost();
$naddr = gethostbyaddr($client->peeraddr(), PF_INET);
$iaddr is the IP address (i.e. 206.151.9.7)
$naddr is the name (i.e. patriot.net)
--
_ / ' _ / - aka - rjk@linguist.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Fri, 29 Jan 1999 14:28:56 -0600
From: Patrick Svatek <ra1593@email.sps.mot.com>
Subject: Is there a way to check if a called subroutine actually exists?
Message-Id: <36B21A08.E08E23B9@email.sps.mot.com>
Hey all,
I'm trying to use a variable name (user defined via web submission)
and am having success calling it like so:
$var_name = $Form{'user_requested_name'};
and then calling the sub like:
print &$var_name;
No problemo. NOW, how can I verify that this subroutine exists?
I have the following code but it does not work... Thanks in advance!
-Pat, ra1593@email.sps.mot.com
#### BEGIN Snippet of code...
if (!$Form{'user_requested_name'}) {
print "No User Defined data entered<P>\n";
print "You must make a request selection!<P>\n";
exit;
}
else {
$var_name = $Form{'user_requested_data'};
print "User request is $Form{'user_requested_data'} <P>\n";
if (!&$var_name) {
print "Subroutine does not exist!\n";
exit;
}
else {
print "Request is VALID\n";
print &$request_type;
}
}
##### END Snippet of code...
------------------------------
Date: Fri, 29 Jan 1999 15:37:13 -0600
From: Patrick Svatek <ra1593@email.sps.mot.com>
Subject: Re: Is there a way to check if a called subroutine actually exists?
Message-Id: <36B22A09.C123510D@email.sps.mot.com>
I figured it out... I changed the following...
if (!&$var_name) {
to
if (!defined(&$var_name)) {
-Patrick
Patrick Svatek wrote:
>
> Hey all,
>
> I'm trying to use a variable name (user defined via web submission)
> and am having success calling it like so:
>
> $var_name = $Form{'user_requested_name'};
>
> and then calling the sub like:
>
> print &$var_name;
>
> No problemo. NOW, how can I verify that this subroutine exists?
> I have the following code but it does not work... Thanks in advance!
> -Pat, ra1593@email.sps.mot.com
>
> #### BEGIN Snippet of code...
>
> if (!$Form{'user_requested_name'}) {
> print "No User Defined data entered<P>\n";
> print "You must make a request selection!<P>\n";
> exit;
> }
> else {
> $var_name = $Form{'user_requested_data'};
> print "User request is $Form{'user_requested_data'} <P>\n";
> if (!&$var_name) {
> print "Subroutine does not exist!\n";
> exit;
> }
> else {
> print "Request is VALID\n";
> print &$request_type;
> }
> }
>
> ##### END Snippet of code...
------------------------------
Date: 30 Jan 1999 20:14:36 GMT
From: Martin GOLDSTERN <goldstern@tuwien.ac.at>
Subject: local($_) - why not "my"?
Message-Id: <78vp7c$2qk$1@news.tuwien.ac.at>
Why is "my $_" not allowed?
"man perlsub" tells me:
Only alphanumeric
identifiers may be lexically scoped--magical builtins like
$/ must currently be localized with "local" instead.
Does "currently" mean that in some later version of perl this will
change? Where is the difficulty?
Martin.Goldstern@tuwien.ac.at
------------------------------
Date: Sat, 30 Jan 1999 14:02:07 -0500
From: "Ted Shieh" <tedshieh@monmouth.com>
Subject: need help with perlcc
Message-Id: <78vkf4$al8$1@news.monmouth.com>
Can someone show me how to compile "Hello World" with perlcc on Win 95?
This is what I get when I try:
> cd C:\apps\dev\perl\src\perlcc
> perlcc hw.pl
C:\apps\dev\perl\src\perlcc>perlcc hw.pl
hw.pl syntax OK
----------------------------------------------------------------------------
----
Compiling hw.pl:
----------------------------------------------------------------------------
----
Making C(hw.pl.c) for hw.pl!
C:\APPS\DEV\PERL\BIN\PERL.EXE -IC:\APPS\DEV\PERL\lib -IC:\APPS\DEV\PERL\site
\lib -I. -MO=CC,-ohw.pl.c hw.pl
Compiling C(hw) for hw.pl!
Couldn't open !
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::
Couldn't open what?!
This is my Hello World program:
#!\apps\dev\perl\bin\perl
print "Hello world";
It produces the expected output with perl hw.pl, so I think I have
ActivePerl properly installed.
It also produces a file called hw.pl.c, which looks like this (long):
#include "EXTERN.h"
#include "perl.h"
#ifndef PATCHLEVEL
#include "patchlevel.h"
#endif
/* Workaround for mapstart: the only op which needs a different ppaddr */
#undef pp_mapstart
#define pp_mapstart pp_grepstart
static void xs_init _((void));
static PerlInterpreter *my_perl;
#ifdef BROKEN_STATIC_REDECL
#define Static extern
#else
#define Static static
#endif /* BROKEN_STATIC_REDECL */
#ifdef BROKEN_UNION_INIT
/*
* Cribbed from cv.h with ANY (a union) replaced by void*.
* Some pre-Standard compilers can't cope with initialising unions. Ho hum.
*/
typedef struct {
char * xpv_pv; /* pointer to malloced string */
STRLEN xpv_cur; /* length of xp_pv as a C string */
STRLEN xpv_len; /* allocated size */
IV xof_off; /* integer value */
double xnv_nv; /* numeric value, if any */
MAGIC* xmg_magic; /* magic for scalar array */
HV* xmg_stash; /* class package */
HV * xcv_stash;
OP * xcv_start;
OP * xcv_root;
void (*xcv_xsub) _((CV*));
void * xcv_xsubany;
GV * xcv_gv;
GV * xcv_filegv;
long xcv_depth; /* >= 2 indicates recursive call */
AV * xcv_padlist;
CV * xcv_outside;
#ifdef USE_THREADS
perl_mutex *xcv_mutexp;
struct perl_thread *xcv_owner; /* current owner thread */
#endif /* USE_THREADS */
U8 xcv_flags;
} XPVCV_or_similar;
#define ANYINIT(i) i
#else
#define XPVCV_or_similar XPVCV
#define ANYINIT(i) {i}
#endif /* BROKEN_UNION_INIT */
#define Nullany ANYINIT(0)
#define UNUSED 0
#define sym_0 0
Static OP op_list[2];
Static LISTOP listop_list[2];
Static SV sv_list[2];
Static XPV xpv_list[1];
Static XPVAV xpvav_list[1];
static OP * pp_main _((ARGSproto));
static OP op_list[2] = {
{ 0, 0, pp_main, 0, 0, 65535, 0x0, 0x0 },
{ 0, 0, pp_enter, 0, 176, 65535, 0x0, 0x0 },
};
static LISTOP listop_list[2] = {
{ (OP*)&listop_list[1], 0, pp_print, 0, 208, 65535, 0x5, 0x0, 0, 0, 1 },
{ 0, 0, pp_leave, 0, 177, 65535, 0xd, 0x0, &op_list[1],
(OP*)&listop_list[0], 3 },
};
static SV sv_list[2] = {
{ &xpvav_list[0], 2, 0xa },
{ &xpv_list[0], 2, 0x4840004 },
};
static XPV xpv_list[1] = {
{ 0, 11, 12 },
};
static XPVAV xpvav_list[1] = {
{ 0, -1, -1, 0, 0.0, 0, Nullhv, 0, 0, 0x1 },
};
static int perl_init()
{
dTHR;
{
SV **svp;
AV *av = (AV*)&sv_list[0];
av_extend(av, 0);
svp = AvARRAY(av);
*svp++ = (SV*)&PL_sv_undef;
AvFILLp(av) = 0;
}
xpv_list[0].xpv_pv = savepvn("Hello world", 11);
PL_main_root = (OP*)&listop_list[1];
PL_main_start = &op_list[0];
PL_curpad = AvARRAY((AV*)&sv_list[0]);
return 0;
}
#include "cc_runtime.h"
static
PP(pp_main)
{
MAGIC *mg;
SV **svp, *sv, *src, *dst, *left, *right;
I32 oldsave;
djSP;
lab_95d4e0:
PL_op = &op_list[1];
DOOP(pp_enter);
TAINT_NOT;
sp = PL_stack_base + cxstack[cxstack_ix].blk_oldsp;
FREETMPS;
PUSHMARK(sp);
EXTEND(sp, 1);
PUSHs((SV*)&sv_list[1]);
PL_op = (OP*)&listop_list[0];
DOOP(pp_print);
DOOP(pp_leave);
PUTBACK;
return 0;
}
int
#ifndef CAN_PROTOTYPE
main(argc, argv, env)
int argc;
char **argv;
char **env;
#else /* def(CAN_PROTOTYPE) */
main(int argc, char **argv, char **env)
#endif /* def(CAN_PROTOTYPE) */
{
int exitstatus;
int i;
char **fakeargv;
PERL_SYS_INIT(&argc,&argv);
perl_init_i18nl10n(1);
if (!PL_do_undump) {
my_perl = perl_alloc();
if (!my_perl)
exit(1);
perl_construct( my_perl );
}
#ifdef CSH
if (!PL_cshlen)
PL_cshlen = strlen(PL_cshname);
#endif
#ifdef ALLOW_PERL_OPTIONS
#define EXTRA_OPTIONS 2
#else
#define EXTRA_OPTIONS 3
#endif /* ALLOW_PERL_OPTIONS */
New(666, fakeargv, argc + EXTRA_OPTIONS + 1, char *);
fakeargv[0] = argv[0];
fakeargv[1] = "-e";
fakeargv[2] = "";
#ifndef ALLOW_PERL_OPTIONS
fakeargv[3] = "--";
#endif /* ALLOW_PERL_OPTIONS */
for (i = 1; i < argc; i++)
fakeargv[i + EXTRA_OPTIONS] = argv[i];
fakeargv[argc + EXTRA_OPTIONS] = 0;
exitstatus = perl_parse(my_perl, xs_init, argc + EXTRA_OPTIONS,
fakeargv, NULL);
if (exitstatus)
exit( exitstatus );
sv_setpv(GvSV(gv_fetchpv("0", TRUE, SVt_PV)), argv[0]);
PL_main_cv = PL_compcv;
PL_compcv = 0;
exitstatus = perl_init();
if (exitstatus)
exit( exitstatus );
exitstatus = perl_run( my_perl );
perl_destruct( my_perl );
perl_free( my_perl );
exit( exitstatus );
}
static void
xs_init()
{
}
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::
Any ideas on what is going on (why no executable is produced)?
Thanks,
Ted
Not speaking for the company that advised Exxon on the
largest M&A transaction in history ($75.3 B purchase)
Programming Language Comparison,
http://odin.bio.sunysb.edu/tedshieh/software
New: Java and Perl source code obfuscators
------------------------------
Date: Sat, 30 Jan 1999 14:01:33 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: NPH script and 403 Forbidden header
Message-Id: <1dmg6em.ut9kfwul7lkwN@bay1-58.quincy.ziplink.net>
Bob MacBob <b_macbob@NOSPAM.hotmail.com> wrote:
> #!/usr/bin/perl
> print "$ENV{'SERVER_PROTOCOL'} 403 Forbidden\n";
> print "Server: $ENV{'SERVER_SOFTWARE'}\n";
> print "Content-type: text/html\n\n";
I believe you should also have a
Status: 403 Forbidden
header in there.
Other than that, I think you're all set.
--
_ / ' _ / - aka - rjk@linguist.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sat, 30 Jan 1999 14:03:37 -0500
From: Eugene Sotirescu <eugene@snailgem.org>
Subject: Re: ok please don't shoot me for this question
Message-Id: <36B35789.BF9E8E57@snailgem.org>
Jeff Kerrigan wrote:
>
> It seems like people on this channel waste more time delivering sarcastic
> answers than the 2 seconds it takes to help out a newbie. Try Matt's Scripts
> Archive at:
>
> http://www.worldwidemart.com/scripts/
You may be right. Thanks for helping this newbie.
Please hang around for when the questions about this and that not
working in Matt's scripts start coming in.
--
Eugene
"Light is the all-exacting good,
That dry, forever virile stream
That wipes each thing to what it is,
The whole, collage and stone, cleansed
To its proper pastoral."
Alvin Feinman
------------------------------
Date: Thu, 28 Jan 1999 14:28:58 -0600
From: Eric Estabrooks <estabroo@ispn.com>
To: Daniel Olson <olsondan@ohsu.edu>
Subject: Re: perlxs problem
Message-Id: <36B0C88A.C4DA6840@ispn.com>
Daniel Olson wrote:
>
> I'm just starting to play with perlxs. The project which it applies to
> involves accessing existing C functions from external files. I went
> through each step of the tutorial, and made some slight mods to Example
> 4 to implement my own particular file. Everything was going fine until I
> ran "make test", whereupon I got the following amongst the output:
>
> stem.c:26: sysfuncs.h: No such file or directory
>
> Yes, there is an '#include sysfuncs.h' in the file I'm trying to use.
> The tutorial states that there is no good solution to this right now. Is
> this still the case? Or have others come up with workarounds that would
> apply in this case?
If your sysfuncs.h file is not in /usr/include or the local directory
you need to add information to the Makefile.PL file.
typical Makefile.PL
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
'NAME' => 'Module_Name',
'VERSION_FROM' => 'Module_Name.pm', # finds $VERSION
'LIBS' => [''], # e.g., '-lm'
'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
'INC' => '-I.', # e.g., '-I/usr/include/other'
'OBJECT' => q[Module_Name$(OBJ_EXT)],
);
In the 'INC' Line just add the path to where the sysfuncs.h file is
located
'INC' => '-I/path/to/other/headers',
Hope this helps,
Eric
estabroo@ispn.com
------------------------------
Date: Sat, 30 Jan 1999 15:39:57 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Remove all non a-z characters?
Message-Id: <d7uv87.071.ln@magna.metronet.com>
Owen Cook (rcook@pcug.org.au) wrote:
: On Mon, 25 Jan 1999 21:26:57 -0800, lr@hpl.hp.com (Larry Rosler) wrote:
: timethese(1 << (shift || 0), {
^^^^^^^^^^^^^^^^
That shifts 1 (...000000000001) to the left the number of
positions given by the (shift || 0) part.
Shifting one bit to the left is multiplying by two (2**1)
Shifting two bits to the left is multiplying by four (2**@)
If an argument is given in @ARGV, then that is used as the
number of bits to shift.
If there is no argument, then 1 is shifted zero bits, and
you time a single iteration.
: I tried this with build 509 of ActiveState perl and had to increase the
: "1" in timethese(1 << (shift || 0), to 100000 before I could elimimate
: an warning message which read;
: (warning: too few iterations for a reliable count)
You should have just given it an argument then.
: How come "1" is used and 262144 iterations are made, yet I have to use
: 262144, or is there something I should be reading?
I guess you should be reading about shift() and the
high-precedence logical or (||)
: 65536=2**16 and 262144=2**18 , so maybe there is a clue in there.
Looks like arguments of 16 and 18 were used :-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 30 Jan 1999 20:03:15 +0100
From: "Karl" <karl@nospamaddYproline.at>
Subject: replying to forms queston; stucked
Message-Id: <78vl1c$kgh$1@fleetstreet.Austria.EU.net>
i hav to make a programm replying to www forms. the main programm wor4ks
fine meanwhile with LWP. there is only the final question:
how to parse the page, fill in the fields and return the form to the remote
web server.
any help is greatly appreziated.
many thanks,
karl
karl@NOSPAMDELproline.at
------------------------------
Date: Sat, 30 Jan 1999 14:01:34 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Sending email
Message-Id: <1dmg6nt.1y6owuydq0jlcN@bay1-58.quincy.ziplink.net>
<info@gadnet.com> wrote:
> >> >You don't check the return value when you open the file.
> >>
> >> True, but that's not causing the problem.
> >
> >How do you know? You said that no mail is being sent. If this open
> >fails, then the array you assign the input to is empty, and the text you
> >pipe to your mail program looks like this:
>
> You are, of course, correct. That was indeed at least part of the
> problem. What should my code look like if I want to ignore that record
> and carry on with the loop if the open fails?
Usually, when you try to open a file, and it fails, you would die with
an error message.
open(FOO, $file) or die "Can't open $file: $!\n";
However, in this case you want to ignore that record and get on with the
loop.
open(FOO, $file) or next;
Although you still might want to log an error message.
open(FOO, $file) or do { warn "Could not open $file: $!\n"; next }
--
_ / ' _ / - aka - rjk@linguist.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 30 Jan 1999 19:50:21 GMT
From: "Quentin Compson" <bcompson@yahoo.com>
Subject: Using Post but Query String appearing in URL
Message-Id: <01be4c89$6ba29440$2105440c@brmptrue>
Hello
This is odd.
I think.
I'm using
<FORM ACTION="cgi-bin/mailer2.pl" METHOD="post">
and then
<INPUT TYPE="SUBMIT" NAME="SUGGEST" VALUE="Submit">
and the script works but I get a query string in the URL
http://revdwj.virtualave.net/suggest.html
------------------------------
Date: Sat, 30 Jan 1999 22:39:37 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: Using Post but Query String appearing in URL
Message-Id: <36B37C19.530814E9@ngb.se>
Quentin Compson wrote:
> This is odd.
> I think.
>
> I'm using
> <FORM ACTION="cgi-bin/mailer2.pl" METHOD="post">
>
> and then
> <INPUT TYPE="SUBMIT" NAME="SUGGEST" VALUE="Submit">
>
> and the script works but I get a query string in the URL
No you don't. But you have a lot of broken images there... :)
Actually, there was no query string -- that would have been seen in the
location field in the browser.
Staffan
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4786
**************************************