[16470] in Perl-Users-Digest
Perl-Users Digest, Issue: 3882 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 2 09:05:26 2000
Date: Wed, 2 Aug 2000 06:05:15 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <965221515-v9-i3882@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 2 Aug 2000 Volume: 9 Number: 3882
Today's topics:
A DOS box question <jamesmckay@MailAndNews.com>
Re: A DOS box question <elephant@squirrelgroup.com>
Re: A DOS box question <martin@fez.dk>
Re: A DOS box question <gellyfish@gellyfish.com>
Re: A DOS box question <jmaggard@va.mediaone.net>
Re: A DOS box question <martin@fez.dk>
Re: Beginner CGI question (lliacopo)
Re: Breaking up strings into arbitrary lengths (Keith Calvert Ivey)
Can't catch die() when calling mg_get or mg_set <andreas@dwl.co.uk>
Re: Can't catch die() when calling mg_get or mg_set <gisle@ActiveState.com>
Re: Copy a hash and const? (Jens)
Copying from the web: Problems with a script <jmaggard@va.mediaone.net>
Re: day_of_week() and age() without using Date::Calc ? (Keith Calvert Ivey)
Re: Difference between a .cgi file and a .pl file? <skv@iis.nsk.su>
Re: formating output <cingram-at-pjocs-dot-demon-dot-co-dot-uk>
Re: formating output <buggerm@de.ibm.com>
How to Post a message to a newsgroup using Perl ? (Rui Anastácio)
Re: htaccess and cgi script nobull@mail.com
non-blocking read from fifo <kenny_saltiel@icomverse.com>
Re: Perl Module in C - Question. fortinj@attglobal.net
Re: Perl Module in C - Question. fortinj@attglobal.net
Re: Perl Module in C - Question. fortinj@attglobal.net
Re: POSIX::mktime <jbroz@transarc.com>
Re: posting in newsgroup using perl script? (Anno Siegel)
Price look up procedure in Perl (part 2) <globalcon2isnot@myhouse.com>
Re: Problems with require nobull@mail.com
Re: question about a Regular Expression nobull@mail.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 2 Aug 2000 06:41:49 -0400
From: James <jamesmckay@MailAndNews.com>
Subject: A DOS box question
Message-Id: <398A3C0E@MailAndNews.com>
Hi All,
Quick question: Is there a way to force a Perl script to run in a DOS
box? The script I've written flashes it's error messages on screen too fast
to read, then closes it's DOS box. I want to have the DOS box remain on
screen after the script completes.
Thanks in advance
James
------------------------------
Date: Wed, 02 Aug 2000 11:04:13 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: A DOS box question
Message-Id: <MPG.13f29d8565431d959896aa@news>
James writes ..
> Quick question: Is there a way to force a Perl script to run in a DOS
>box? The script I've written flashes it's error messages on screen too fast
>to read, then closes it's DOS box. I want to have the DOS box remain on
>screen after the script completes.
groan
open the "DOS box" and THEN run your program
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 02 Aug 2000 13:15:41 +0200
From: Martin Mouritzen <martin@fez.dk>
Subject: Re: A DOS box question
Message-Id: <jl0gos0q22hmc1n634ls31o95eb1o5ula2@4ax.com>
On Wed, 2 Aug 2000 06:41:49 -0400, James <jamesmckay@MailAndNews.com>
sneezed and this is what came out:
>Is there a way to force a Perl script to run in a DOS
>box? The script I've written flashes it's error messages on screen too fast
>to read, then closes it's DOS box. I want to have the DOS box remain on
>screen after the script completes.
What about executing the script *in* dosmode, rather than through
windows?
--
Martin Mouritzen
- If you have any questions,
please direct them to a nearby wall.
------------------------------
Date: Wed, 02 Aug 2000 12:14:15 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: A DOS box question
Message-Id: <rgUh5.882$82.46944@news.dircon.co.uk>
On Wed, 02 Aug 2000 13:15:41 +0200, Martin Mouritzen Wrote:
> On Wed, 2 Aug 2000 06:41:49 -0400, James <jamesmckay@MailAndNews.com>
> sneezed and this is what came out:
>
>>Is there a way to force a Perl script to run in a DOS
>>box? The script I've written flashes it's error messages on screen too fast
>>to read, then closes it's DOS box. I want to have the DOS box remain on
>>screen after the script completes.
>
> What about executing the script *in* dosmode, rather than through
> windows?
It wont run in DOS mode if you are using ActivePerl.
/J\
------------------------------
Date: Wed, 02 Aug 2000 12:58:09 GMT
From: Jason Maggard <jmaggard@va.mediaone.net>
Subject: Re: A DOS box question
Message-Id: <39881AEA.C8AF7671@va.mediaone.net>
Two methods:
1: put a sleep at the end of your script "sleep 60 ; return 0"
2: The following two lines should be self explanatory:
print "Press enter to continue..." ;
<STDIN> ;
Also, create a batch file with the line "perl myprog.pl" and then set up a .pif
(or shortcut) and set the properties for the dos box there.
HamNRye
James wrote:
> Hi All,
> Quick question: Is there a way to force a Perl script to run in a DOS
> box? The script I've written flashes it's error messages on screen too fast
> to read, then closes it's DOS box. I want to have the DOS box remain on
> screen after the script completes.
> Thanks in advance
> James
------------------------------
Date: Wed, 02 Aug 2000 15:00:48 +0200
From: Martin Mouritzen <martin@fez.dk>
Subject: Re: A DOS box question
Message-Id: <8q6gos861kh43s9lgafl4icgd5alsf1k3g@4ax.com>
On Wed, 02 Aug 2000 12:14:15 GMT, Jonathan Stowe
<gellyfish@gellyfish.com> sneezed and this is what came out:
>It wont run in DOS mode if you are using ActivePerl.
Uhm, why not ?
I'm using ActivePerl as it is now.
'perl script.cgi' works phine here?
--
Martin Mouritzen
- If you have any questions,
please direct them to a nearby wall.
------------------------------
Date: Wed, 02 Aug 2000 12:22:09 GMT
From: Lucas (lliacopo) <lliacopo8088@my-deja.com>
Subject: Re: Beginner CGI question
Message-Id: <8m93pd$l2t$1@nnrp1.deja.com>
Thanks all!
In article <slrn8oesdg.fkd.efflandt@efflandt.xnet.com>,
efflandt@xnet.com wrote:
> On Tue, 01 Aug 2000 20:37:30 GMT, David Tsai
<templar318@earthlink.net> wrote:
> >
> >The most "airtight" way would be to make your users register and
make them
> >confirm their email address. That can be a hassle and would
probably make
> >most of your users just not participate in your poll. The only other
> >hassle free ways for your users is to use cookies and log their ip.
> >However, most users will have dynamic IP addresses so cookies with
> >temperary IP logging would be the best way to do it.
>
> I wouldn't call confirming an e-mail address airtight. I can have an
> unlimited number of e-mail addresses at several domains. Checking
for a
> unique IP would lockout any other users that use the same proxy (for
> example all AOL users go through a proxy) or firewall or happen to
end up
> with the same dynamic IP. Just about any other method might lock out
> potential users or could be easily forged with a simple Perl script.
>
> Although, repeated entries in a short period of time with same IP and
> everything else being equal may be a sign of forged entries.
>
> >> Hello,
> >>
> >> I'm creating a form that is basically a voting ballot. I'd like to
know
> >> if there is an airtight way of preventing users from voting more
than
> >> once.
> >>
> >> --
> >> Thanks! :)
> >>
> >> PS: to the idiot who thinks I'm doing my homework: don't reply to
this
> >> idiot!
> >>
> >> Sent via Deja.com http://www.deja.com/
> >> Before you buy.
> >
> >--
> >
> >Best Regards,
> >David Tsai
> >CGI Paradise
> >http://www.web-consult.com/scripts/
> >
> >
>
> --
> David Efflandt efflandt@xnet.com http://www.de-srv.com/
> http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
> http://hammer.prohosting.com/~cgi-wiz/ http://cgi-
help.virtualave.net/
>
>
--
Thanks! :)
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 02 Aug 2000 12:04:00 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Breaking up strings into arbitrary lengths
Message-Id: <398d0c98.37032976@news.newsguy.com>
logan@cs.utexas.edu (Logan Shaw) wrote:
>Keith Calvert Ivey <kcivey@cpcug.org> wrote:
>> sub cutupline {
>> my $string = shift;
>> my @chunks = $string =~ /.{1,3072}/gs;
>> }
>
>True. Parenthesis would help, though:
>
> my @chunks = $string =~ /(.{1,3072})/gs;
Did you try it without the parentheses?
>Also, you could just return the match directly without using a
>temporary variable:
>
> sub cutupline3072
> {
> my $string = shift;
> return ($string =~ /(.{1,3072})/gs);
> }
True, but if you're eliminating unnecessary variables why not
get rid of $string too? Also, your version gives a different
result if called in scalar context. I think my return value is
more useful.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Wed, 2 Aug 2000 12:13:25 +0100
From: "Andreas Damm" <andreas@dwl.co.uk>
Subject: Can't catch die() when calling mg_get or mg_set
Message-Id: <965214772.3241.0.nnrp-02.c29f1f7c@news.demon.co.uk>
I am embedding perl into our in house language which uses exception handling.
Therefore when calling into perl the G_EVAL flag is set, so that a die() can be
converted into an exception. How can I have a similiar behaviour when calling
mg_get or mg_set on elements of a tied hash or array? Right now the program will
just exit if the associated magic methods die().
------------------------------
Date: 02 Aug 2000 14:19:27 +0200
From: Gisle Aas <gisle@ActiveState.com>
Subject: Re: Can't catch die() when calling mg_get or mg_set
Message-Id: <m366pjc0ts.fsf@eik.g.aas.no>
"Andreas Damm" <andreas@dwl.co.uk> writes:
> I am embedding perl into our in house language which uses exception handling.
> Therefore when calling into perl the G_EVAL flag is set, so that a die() can be
> converted into an exception. How can I have a similiar behaviour when calling
> mg_get or mg_set on elements of a tied hash or array? Right now the program will
> just exit if the associated magic methods die().
I am struggling with the same thing for my python/perl integration
project. Currently I am playing with code like this to catch
exceptions. I am still far from certain that this code actually does
the right thing. And it is ugly :-(
--------------------------------------------------------------------------
#include <EXTERN.h>
#include <perl.h>
void
do_something()
{
static int c = 0;
if (c++ % 3 == 0)
croak("Did you catch this");
}
void eval_do_something()
{
dJMPENV;
LOGOP myop;
int status;
PERL_CONTEXT *cx;
I32 gimme;
volatile I32 oldscope;
Zero(&myop, 1, LOGOP);
myop.op_flags |= OPf_WANT_SCALAR;
myop.op_next = Nullop;
PL_op = (OP*)&myop;
gimme = GIMME_V;
oldscope = PL_scopestack_ix;
ENTER;
SAVETMPS;
push_return(Nullop);
PUSHBLOCK(cx, (CXt_EVAL|CXp_TRYBLOCK), PL_stack_sp);
PUSHEVAL(cx, 0, 0);
PL_eval_root = PL_op;
PL_in_eval = EVAL_INEVAL;
sv_setpvn(ERRSV, "", 0);
JMPENV_PUSH(status);
switch (status) {
case 0:
//////////////////////////////////////////
do_something();
//////////////////////////////////////////
break;
case 3:
//printf("caugth longjmp 3\n");
break;
default:
printf("should not happen, status = %d\n", status);
}
JMPENV_POP;
if (PL_scopestack_ix > oldscope) {
PMOP *newpm;
I32 optype;
SV **newsp;
POPBLOCK(cx,newpm);
POPEVAL(cx);
pop_return();
PL_curpm = newpm;
}
FREETMPS;
LEAVE;
}
int main(int argc, char**argv, char**env)
{
int i;
char *embedding[] = {"", "-e", "0"};
PerlInterpreter *my_perl = perl_alloc();
perl_construct(my_perl);
perl_parse(my_perl, NULL, 3, embedding, NULL);
perl_run(my_perl);
/* I want to do the equivalent of:
eval { do_something() };
if ($@) {
....
}
in C.
This is my first try:
*/
for (i = 0; i < 1000; i++) {
printf("do_something()\n");
eval_do_something();
if (SvTRUE(ERRSV))
printf("$@ is '%s'\n", SvPV_nolen(ERRSV));
printf("%d\n", cxstack_ix);
}
printf("continuing...\n");
}
/*
Compile with: cc ctry.c `perl -MExtUtils::Embed -e ccopts -e ldopts`
*/
--
Gisle Aas
------------------------------
Date: Wed, 02 Aug 2000 13:18:44 +0200
From: "Ellegiers, J. M. (Jens)" <jellegie@ford.com>
Subject: Re: Copy a hash and const?
Message-Id: <39880394.9D7E375D@ford.com>
Hi,
Dietmar Staab wrote:
>
> In article <8m7k0h$79i$10$1@news.t-online.com>, "Dietmar Staab"
> <dietmar.staab@t-online.de> wrote:
>
> > In article <8m7dip$etk$1@nnrp1.deja.com>, Brian Lavender
> > <blavender@spk.usace.army.mil> wrote:
> >
> >> I have the following code which has a subroutine that works on a hash
> >> that is passed to it. I first tried passing the hash to the sub
> >> key_remove, but that would not work, so I tried passing a reference. I
> >> discovered though, that if I modified the hash in the subroutine, that
> >> it modified the original hash in main. I would like to make a copy of
> >> this hash, and leave the original hash in main untouched.
> >
> Hi Brian,
> here are the changes to your example: voila
>
> ------------ code ---------------
> my %foo = ('father','barney','mother','betty','child','pebbles');
>
> print "The beginning\n\n";
>
> foreach (keys %foo) {
> print "Key: $_ Value: $foo{$_}\n";
> }
>
> print "Call key_remove which prints family except the child \n\n";
>
> key_remove(%foo); <----- reference removed
>
> print "\n Back in Main\n"; print "Is pebbles gone?\n\n";
>
> foreach (keys %foo) {
> print "Key: $_ Value: $foo{$_}\n";
> }
>
Here's my suggestion for the subroutine apart from an error in the
original subroutine which I've
marked below.
sub key_remove {
my %family = @_;
# This copies the original %family hash to a private %family hash in
# the sub
delete $family{child};
map { print "Sub Key: ".$_." Value: ".$family{$_}."\n";} keys %family;
# --------------------------------------------^ here was an error in the
# previous versions of this sub
}
> sub key_remove {
> # Can I make $family so it stays constant?
> local %family = shift; <---------------- use local
This does *not* work at all as you assign just the first key of
%main::family to %key_remove::family. You have to pass a hash using
my %family = @_;
Perl doesn't know any difference between passing a scalar, a hash or an
array to a subroutine. It's you who determines how it arrives there. A
hash is passed as a list of values and assigning it to hash in the
subroutine means that the values at even indices of the list (
0,2,4,...) are the keys while it's values are at the odd indices (
1,3,...).
> # Make a copy of %$family
> # Is this good?
> #my %cp_family = %$family; <----- not necessary
>
Using the above construct you copied the hash to another namespace than
the original hash.
> delete $family{'child'}; <----- use local variable in the next lines
> foreach (keys %family) {
> print "Sub Key: $_ Value: %family{$_}\n";
An item of a hash is accessed using a $ sign in front of the variable
name.
> }
> return (0);
> }
>
> ------------ snip ----------------
>
> it delivers the same result as your solution.
>
> Try it - pebbles isn't gone ;-)
>
It doesn't as it doesn't work!
> Greetings, Dietmar
--
Viele Gruesse, regards, saludos
Jens Ellegiers
---------------------------------------------------------------
FORD-Werke AG, Spessartstrasse, 50725 Koeln
Jens Ellegiers Email: jellegie@ford.com /"\
Engineer (I-Engine CAE) Phone: +49-221-90-31467 \ /
Mail Sym: D-ME/PN-S Fax : +49-221-90-33025 X
ASCII Ribbon campaign against HTML E-mail & Usenet News >------> / \
------------------------------
Date: Wed, 02 Aug 2000 12:51:35 GMT
From: Jason Maggard <jmaggard@va.mediaone.net>
Subject: Copying from the web: Problems with a script
Message-Id: <39881960.CED6CBC6@va.mediaone.net>
Howdy everybody,
I've written this script to get all the links from a web page and it
works fine on my Linux box. A friend asked me for a copy for his
windoze machine, but the files get corrupted in the download process.
Is there a workaround to this?? This is a real basic script, and I'm
not really up on the finer details of perl, so any help would be
appreciated. I guess now I know what Larry said, "There's more than one
way to do it, and that's good, because under Windows most of them don't
work."
Thanks,
Jason Maggard
jmaggard@linuxstart.com
#! /usr/bin/perl
##########################################################################
# wwwcp.pl a perl script for getting all links of one type from a
webpage
#
##########################################################################
use Getopt::Std;
use LWP::Simple;
use HTML::LinkExtor;
use LWP::UserAgent;
getopt('dfulp'); # d will be directory, f file type, u URL , l user name
# p is password
if (!defined($opt_d)) { $opt_d = "." ; }
if (!defined($opt_f)) { $opt_f = jpg ; }
if (!defined($opt_u)) {
die "I did not get the page name. Did you pass one as an argument with
\
\"-u\"? \n\nThis error is in the main loop for processing command line
\
arguments." ;
}
$f = 0 ; $l = 0 ;
$foo = rindex ($opt_u, "/") ; $foo++ ;
$baseurl = substr ($opt_u, 0, $foo) ;
print "Baseurl is: $baseurl\n" ;
@bar = split (/\//, $opt_u) ;
$domain = join ("/", $bar[0], $bar[1], $bar[2]) ;
$ua = new LWP::UserAgent ;
$req = new HTTP::Request('GET', $opt_u);
if (defined($opt_l)) {
$req->authorization_basic($opt_l, $opt_p);
}
$return = $ua->request($req);
$html = $return->{_content} ;
$link_extor = HTML::LinkExtor->new(\&handle_links) ;
$link_extor->parse($html) ;
print "$l links scanned.\n$f files downloaded to $opt_d.\n\n" ;
sub handle_links
{
($tag, %links) = @_;
if ($tag eq 'a') {
foreach $key (keys %links) {
$l++ ;
if ($key eq 'href') {
if ($links{$key} =~ m/($opt_f)$/) {
$url = $links{$key} ;
if ($url =~ m/^\//) {
$url = join ("", $domain, $url);
} elsif ($url =~ m/^*:\/\//) {
} else {
$url = join ("", $baseurl, $url);
}
$fn = $links{$key} ;
$i = split (/\//, $fn) ;
$i-- ;
$filename = ((split (/\//, $fn))[$i]) ;
print "Url: $url" ;
print "Filename: $filename\n" ;
open FH, ">$opt_d/$filename" ;
$user_agent = new LWP::UserAgent ;
$request = new HTTP::Request('GET', $url);
if (defined($opt_l)) {
$request->authorization_basic($opt_l, $opt_p);
}
$response = $user_agent->request($request);
print FH $response->{_content};
close FH;
$f++ ;
}
}
}
}
}
------------------------------
Date: Wed, 02 Aug 2000 11:41:59 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: day_of_week() and age() without using Date::Calc ?
Message-Id: <398c0877.35976047@news.newsguy.com>
Bart Lateur <bart.lateur@skynet.be> wrote:
> $time = timegm(0, 0, 0, 2, 8-1, 2000);
That works, but it's not documented, as far as I know.
I'd prefer to show it as
$time = timegm(0, 0, 0, 2, 8-1, 2000-1900);
to remind people of how gmtime works.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Wed, 2 Aug 2000 18:49:16 +0600
From: "Konstantin Stupnik" <skv@iis.nsk.su>
Subject: Re: Difference between a .cgi file and a .pl file?
Message-Id: <8m91q5$1kcn$1@nl.novosoft.ru>
Hi!
> > Alan> The server can be given a list of file names to try for the
default
> > Alan> document: index.html, index.cgi, index.shtm, Welcome.htm
>
> > Yup. That's OK. But it's scary when I end up seeing a URL in my
> > location bar of "foo.pl" or "index.py" or "whatever.tcl" though.
> > Gives away more than it needs to give.
>
> some of those are scary no matter how you configure the server :)
>
> however, a server admin with too much time on their hands might
> map all of those extensions to something else. not that i've
> ever used mod_rewrite to do such a thing.
My guess is that it doesn't matter for apache under unix
what extension file have (if it is not explicitly configured
to handle some extensions in a special way).
The only thing required is executable permissions.
The trick is in first line of script.
#!/path/executable -options
If first line of file aaa.xxx is something like this:
#! /usr/bin/perl -w
this command will be executed:
/usr/bin/perl -w aaa.xxx
Apache under win32 work in almost the same way,
but I need to add handler for cgi extensions
(ie files that should be treated as cgi SCRIPTS).
--
Best regards,
Konstantin.
Brainbench MVP for perl.
------------------------------
Date: Wed, 2 Aug 2000 11:23:23 +0100
From: "Clyde Ingram" <cingram-at-pjocs-dot-demon-dot-co-dot-uk>
Subject: Re: formating output
Message-Id: <965211475.11366.0.nnrp-07.9e98e5bc@news.demon.co.uk>
Sven <buggerm@de.ibm.com> wrote in message
news:3987D99B.29105543@de.ibm.com...
>
> ₫======================
> ^^
>
> Where does this come from ?????
>
> every page exept the first gets a stupid character at first place
Not a stupid character, but clearly a thorn in your side, so to speak ...
Clyde
------------------------------
Date: Wed, 02 Aug 2000 12:40:07 +0200
From: Sven <buggerm@de.ibm.com>
Subject: Re: formating output
Message-Id: <3987FA87.B90F2CBE@de.ibm.com>
Clyde Ingram wrote:
> Not a stupid character, but clearly a thorn in your side, so to speak ...
>
> Clyde
Thanks for the advise it did not remove the "thorn" but ...Thanks
------------------------------
Date: Wed, 02 Aug 2000 12:41:50 GMT
From: ranastacio@mail.telepac.pt (Rui Anastácio)
Subject: How to Post a message to a newsgroup using Perl ?
Message-Id: <398816c4.674859125@news.telepac.pt>
Hi !
Can anyone tell-me how to post a message a a newsgroup using Per ?
Thanks
Rui Anastácio
------------------------------
Date: 02 Aug 2000 12:15:12 +0100
From: nobull@mail.com
Subject: Re: htaccess and cgi script
Message-Id: <u9punr9anz.fsf@wcl-l.bham.ac.uk>
slandman@my-deja.com writes:
> I'm going to switch a site from a NT server to a UNIX server if you
> folks answer my question. I need to password protect some pages of a
> cgi script. I haven't used .htaccess before, but I assume that I will
> be able to do this with .htaccess. Am I correct?
Note that protecting "some pages" of _a_ CGI script is a somewhat odd
statement. You mean the script has PATH_INFO and you want to password
protect some of the virtual URL space? You are going to need to use
<Location> sections to do this. I can't recall if <Location> sections
work in .htaccess files - I doubt it as the .htaccess files can't be
consulted until the request processing has got past the location stage.
This has nothing whatever to do with Perl.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 02 Aug 2000 14:24:21 +0300
From: Kenny Saltiel 5744 <kenny_saltiel@icomverse.com>
Subject: non-blocking read from fifo
Message-Id: <398804E4.CD7AEEA@icomverse.com>
Hi.
I'm trying to obtain the output of three external programs which I
start-up from within a perl script
using the Proc::simple module. The external programs write to 3
named-pipes which I open filehandles for.
The problem is that since the read from a filehandle blocks while
waiting for input, I can not read the other fifo's until something comes
in on the fifo I am waitng on.
Is there anyway I can check the fifo before reading from it? Should I
have the external programs send data in a
different way. I'm using the Proc::Simple module since I need to run the
external programs in the background
while monitoring if they are alive, in addition to other things the perl
script needs to do.
Thanks
------------------------------
Date: Wed, 02 Aug 2000 07:27:14 -0400
From: fortinj@attglobal.net
Subject: Re: Perl Module in C - Question.
Message-Id: <39880592.68800FC6@attglobal.net>
> No. Just because not having documentation seems to be acceptable for
> the prisoners of Bill doesn't make that Activeperl doesn't provide
> documentation. It might not be called 'man', and have some point and
> drool interface, but it's still there.
The point being that there are several different "methods" for the
documentation. Abigail's and several others response to type 'man ...'
or 'look at the man pages' assume a unix perspective. Windows users
have different methods, including HTML, to paraphrase Abigail:
"To be enjoyed with the pains of a web browser."
Of course there is always the cygwin perl port...
John
------------------------------
Date: Wed, 02 Aug 2000 07:30:37 -0400
From: fortinj@attglobal.net
Subject: Re: Perl Module in C - Question.
Message-Id: <3988065D.D1C0C638@attglobal.net>
Logan Shaw wrote:
>
> In article <nneeoschbm15pski7lpdcrpdqlo1dcm4uu@4ax.com>,
> John Fortin <fortinj@attglobal.net> wrote:
> >hmmm, Activestate perl for windows doesn't seem to have manpages.
> >A bit 'unix'centric are we??
>
> It has them. They're just hidden somewhere and called something
> different. Somewhere in the install, there's a directory that
> contains lots of HTML documentation, and I believe they're in there.
>
> - Logan
But they are not 'man pages'. You don't use the 'man' command from the
command to read them. That was my point. :)
BTW, from my point of view, this conversation is somewhat
tongue-in-cheek, as I use both the windows and unix versions of perl,
and their respective documentation.
John
------------------------------
Date: Wed, 02 Aug 2000 07:32:57 -0400
From: fortinj@attglobal.net
Subject: Re: Perl Module in C - Question.
Message-Id: <398806E9.DE89EEB6@attglobal.net>
Greg Bacon wrote:
>
> In article <nneeoschbm15pski7lpdcrpdqlo1dcm4uu@4ax.com>,
> John Fortin <fortinj@attglobal.net> wrote:
>
> : hmmm, Activestate perl for windows doesn't seem to have manpages.
>
> Look again.
OK, I looked again. Still no man pages. Plenty of HTML documentation,
but alas, no man pages. No man command either. now that I think of it.
:)
BTW, from my point of view, this conversation is somewhat
tongue-in-cheek, as I use both the windows and unix versions of perl,
and their respective documentation.
John
------------------------------
Date: Wed, 02 Aug 2000 11:38:15 +0100
From: "Joe_Broz@transarc.com" <jbroz@transarc.com>
Subject: Re: POSIX::mktime
Message-Id: <3987FA17.37E5F341@transarc.com>
Chest Rockwell wrote:
>
[...]
>
> I'm using perl on a Windows machine so man doesn't work. Anyway,
> thanks to let me know I'm trying something that can't be done.
I don't use perl on windows but, as others have said recently, just because
man doesn't work does not mean the documentation isn't there. If it's
installed it will be off the Start menu somewhere.
------------------------------
Date: 2 Aug 2000 10:36:01 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: posting in newsgroup using perl script?
Message-Id: <8m8tih$i5b$1@lublin.zrz.tu-berlin.de>
Jonathan Stowe <gellyfish@gellyfish.com> wrote in comp.lang.perl.misc:
>On Tue, 01 Aug 2000 16:19:14 +0200 Ron wrote:
>> Thanks for your example; I tried to run it, but I get an error:
>>
>> "Can't find string terminator "EOMESS" anywhere before EOF at ./sendnews.cgi line
>>
>> 10. "
>>
>> I can't find out how to fix this; do you know how to fix this?
>>
>
>Dont stupidly cut and paste stuff from usenet posts. The file I copied
>into my post ran perfectly fine.
Myself, I'm quite happy with the fact that Ron is unable to use
the bit of spamming software. Not that automatic posting is evil
per se, but I'd rather not see tools like that in the hands of people
who show very little understanding of what's going on.
Anno
------------------------------
Date: Wed, 2 Aug 2000 13:54:26 +0100
From: "Phil Latio" <globalcon2isnot@myhouse.com>
Subject: Price look up procedure in Perl (part 2)
Message-Id: <8m95ql$b3s$1@uranium.btinternet.com>
#!/usr/bin/perl -w
use strict;
my %print_cost;
while (<DATA>) {
chomp;
my ($color, $weight, $sided, $quantity, $price) = split;
$print_cost{$color}{$weight}{$sided}{$quantity} = $price;
}
# This data would come from your form
my $number = 1000;
my $weight = '80gsm';
my $sides = 's/sided';
my $color = 'white';
# And spit out the price
printf("The price for %d %s, %s, %s prints is %s.\n",
$number, $color, $weight, $sides,
$print_cost{$color}{$weight}{$sides}{$number});
__DATA__
white 80gsm s/sided 1000 £40.00
white 80gsm s/sided 2500 £75.00
white 80gsm s/sided 5000 £120.00
white 80gsm s/sided 10000 £160.00
white 80gsm s/sided 25000 £250.00
The code above was posted in this group yesterday but I can't get it
working. I am a newbie when it comes to Perl so don't burst out laughing.
Firstly, I changed the path of perl to that of my server and then I saved
the above code as "printingprices.pl". It was then uploaded to my CGI-Bin
and CHMOD was set at 755
Next I created an order form on an HTML page with matching radio fields to
those above ie: number, weight, sides, colour. I included <form
name="testform" method="post"
action="http://www.mywebsite.com/cgi-bin/printingprices.pl">
At the bottom I put a submit button which I assumed would perform the "post"
action of the choices entered on the form and this would be sent to the
printingprices.pl script. I next assumed that when the data arrives, a
search is performed of the __ DATA __ and the result is then output to the
next screen.
All I get is the ever cheerful 500 server error message.
What is confusing me is this part below.
# This data would come from your form
my $number = 1000;
my $weight = '80gsm';
my $sides = 's/sided';
my $color = 'white';
Do I leave this in the code or change it in some way ? Also is the __ DATA
__ supposed to be another file and shouldn't I put a comma between each
field ?
Many thanks again if anyone can help
Phil
(PS. If this message appears twice then I apologise but my first reply which
I sent a few hours ago has not appeared on my news server)
------------------------------
Date: 02 Aug 2000 13:02:36 +0100
From: nobull@mail.com
Subject: Re: Problems with require
Message-Id: <u9n1iv98gz.fsf@wcl-l.bham.ac.uk>
Jill Waters <waters@gfms.bt.co.uk> writes:
> I am using both packages and library files.
> In my main program I have:
>
> require "alibrarayfile.pl";
> use APackage;
>
> In APackage.pm I also need to include alibraryfile.pl so have
> require "alibraryfile.pl";
>
> What appears to be happening is that at compile time alibraryfile.pl is
> loaded into the APackage.pm namespace OK. However, at run-time
> alibraryfile.pl is not loaded into the main namespace - because Perl
> thinks it has already been loaded perhaps?
That is correct. That's one of the big problems with old-style Perl
libraries. Try don't have a separate import method.
> Am I doing something wrong? If not, how do I use a library file in both
> main and in a package?
Change "require" to "do" but you may get warnings about redefined
subroutines depending on how the library is written.
I'm supprised I couldn't find a shim module on CPAN to allow most
old-style libraries to be treated as modules. It wouldn't be that
hard to do - or am I missing something?
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 02 Aug 2000 12:41:02 +0100
From: nobull@mail.com
Subject: Re: question about a Regular Expression
Message-Id: <u9og3b99gx.fsf@wcl-l.bham.ac.uk>
"Philip Taylor" <phil.taylor@bigfoot.com> writes:
> Greg Bacon <gbacon@HiWAAY.net> wrote in message
> news:sobq96ug9ft7@corp.supernews.com...
>
> > I would write
> >
> > if (/^\s* \d\d? \s*-\s* \d\d? \s*$/x) {
> > ...;
> > }
>
> What does the x on the end do?
Allows regexp to be spaced out for readability.
For details of Perl regex qualifiers see "perdoc perlre".
For some qualifiers (but not /x) you may also need to consult the
documentation of m// in "perldoc perlop".
> > or maybe
> >
> > if (/^\s* # optional leading whitespace
> > \d\d? # one- or two-digit score
> > \s*-\s* # dash separator (with optional whitespace)
> > \d\d? # one- or two-digit score
> > \s*$/x) # optional trailing whitespace
> > {
> > ...;
> > }
>
> Why does the dash not need escaping above?
Because - is only special in regex when inside [ ].
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3882
**************************************