[7495] in Perl-Users-Digest
Perl-Users Digest, Issue: 1120 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 3 14:10:31 1997
Date: Fri, 3 Oct 97 11:00:46 -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 Fri, 3 Oct 1997 Volume: 8 Number: 1120
Today's topics:
$x = $y || $z - dangerous assumption? (Peter Scott)
Re: [req] a procmail replacement in perl <jhoglund@mirage.skypoint.com>
better at win32/COM/gui: python or perl?? (John Nielsen)
Re: better at win32/COM/gui: python or perl?? <MHammond@skippinet.com.au>
Re: DBD::Oracle and Perl5.004_03 - dumps core <Tim.Bunce@ig.co.uk>
Re: DESPERATE for help with string matching (Jeremy D. Zawodny)
download an HTML site? <jeep@rahul.net>
Re: download an HTML site? (Jeremy D. Zawodny)
Re: download an HTML site? (Matthew Cravit)
Re: Emmulating MORE in Perl? <jhoglund@mirage.skypoint.com>
Re: Flakey - My scripts works sometimes not others... h <rootbeer@teleport.com>
Re: Generating bit patterns "00000000" .. "11111111" - <Jan.Krynicky@st.mff.cuni.cz>
Re: help me please! (Matthew Cravit)
Re: Help with redirect script (Jeremy D. Zawodny)
HELP: perlxs C++ color example reece@dasher.wustl.edu
Re: Help: reformat variable (Mick Farmer)
Re: hex display for large integer <rootbeer@teleport.com>
Re: How to write a context sensitive subroutine in PERL (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: Installing CGI.pm question (Jeremy D. Zawodny)
Re: Is there a Newsgroup for "Perl for NT and/or IIS"? (Jeremy D. Zawodny)
Re: Is there a Newsgroup for "Perl for NT and/or IIS"? (Mike)
Re: Is there a Newsgroup for "Perl for NT and/or IIS"? (Scott McMahan)
Re: Is there a Newsgroup for "Perl for NT and/or IIS"? (Jeremy D. Zawodny)
Re: Performing Subroutines from a string of text <sriram@weblogic.com>
Re: Perl Questions <rootbeer@teleport.com>
Question on perl-Win32 <eh91@dial.pipex.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Oct 1997 17:44:34 GMT
From: pjscott-remove-to-email@euclid.jpl.nasa.gov (Peter Scott)
Subject: $x = $y || $z - dangerous assumption?
Message-Id: <613au2$dug@netline.jpl.nasa.gov>
Hi. A common idiom I see used in programs and books everywhere is
my $x = shift || $default;
(to use one concrete example of it), the intention being that if there
was no argument, shift returns undef, which is false, and so $x gets
the default.
The thing that bothers me about this - and maybe I'm overreacting - is
that if there *was* an argument, but it was 0, $x will still get $default.
Of course, I can handle this case, assuming I really want a different
action if the argument is 0 (or ""):
$x = $default unless defined (my $x = shift);
but what bothers me is that the idiom is so pervasive, that people are
putting it into code all over the place without realizing that it doesn't
only trigger on undef. One day the difference might be important - might
be in some code I'm using.
Anyway, I'm wondering whether this is a valid point and whether perhaps
the arbiters of good Perl taste would consider changing or qualifying
the idiom in their own examples? FWIW.
--
This is news. This is your | Peter Scott, NASA/JPL/Caltech
brain on news. Any questions? | (Peter.J.Scott at jpl.nasa.gov)
(Sorry to force respondents who choose to reply by email to edit
the To: header, but the spam is just too bad otherwise.)
Disclaimer: These comments are the personal opinions of the author, and
have not been adopted, authorized, ratified, or approved by JPL.
------------------------------
Date: 3 Oct 1997 13:21:44 GMT
From: Jamie Hoglund <jhoglund@mirage.skypoint.com>
Subject: Re: [req] a procmail replacement in perl
Message-Id: <612rh8$ami$1@shadow.skypoint.net>
Nicolas MONNET <nico@idnet.fr> wrote:
: Honestly, I looked everypossiblewhere, and could not find that: a
: procmail/deliver eqv writen in Perl.
: Quite surprising.
: Anyone has clue on how to setup a .forward that pipes into a perl
: script -- well, that's not itself a problem -- but how to have the stuff
: the script put the mail in the right, default place on some conditions
: (and otherwise kill/forward the message)?
: Thanks!
I wrote a very simplified email filter: http://www.skypoint.com/~jhoglund
Not quite sure if the file locks will work on all platforms etc.. But it
appears to work with Linux, I've used it for about 6 months now without
any problems related to it.
It's ultra simplistic. (that was it's goal, I din't want to take the time
to read a manual page and test another program, so I just made a simple
filter)
It's documented on a block by block basis. (I'm of the opinion that perl
_itself_ is a good mail filter)
Jamie
------------------------------
Date: 3 Oct 1997 09:47:36 -0400
From: jnielsen@chemistry.mps.ohio-state.edu (John Nielsen)
Subject: better at win32/COM/gui: python or perl??
Message-Id: <612t1o$kvi@chemistry.ohio-state.edu>
I have recently entered into the NT world from Unix and am looking
at the scripting languages available for NT.
Both python and perl look to be reasonably solid on the NT platform.
So, I am curious which supports COM and win32 better?
For example, one thing I have of interest is MAPI. I'd like to resolve
a mail alias into their corresponding usernames. It looks like I'd have
to use extended MAPI on the NT side w/C++. If I can use perl or python
instead, that would be preferred.
Also, are both reasonably adept at producing gui envrions for windows?
Thanks for any input . . .
john
------------------------------
Date: 3 Oct 97 17:44:16 GMT
From: "Mark Hammond" <MHammond@skippinet.com.au>
Subject: Re: better at win32/COM/gui: python or perl??
Message-Id: <01bcd0b2$2fc61cc0$e9019784@marks-laptop.cnri.reston.va.us>
I will refrain from commenting on which one is "better", lest it degrade
into a flame-fest...
But I will say what Python can do with COM.
COM support in Python is very complete, and very natural. The dynamic
nature of Python has made it possible to get very tight integration, with
very few surprises.
We support IDispatch, which means that Python can talk using "Active
Messaging" to MAPI, to do exactly what you suggest. Interestingly, we also
support true MAPI, which is a native COM interface based API. Native MAPI
is best for applications such as high-performance servers, and typically
these applications run as NT/Exchange Services (which Python also _fully_
supports, by the way). But from your description of the problem, Active
Messaging is probably the way to go.
Should you download Python, the COM test suite actually tests Active
Messaging, so you have some decent sample code to get started.
Visit www.python.org/windows/ - if you can wait 24 hours or so, that URL
will be better organised, and allow you to download seperate components,
rather than the monolitic 3.5MB download you will be forced with now. If
you cant wait that 24 hours, visit starship.skyport.net/crew/mhammond to
get the files now (with less pretty web pages :-)
Regarding the Win32api - we support hundreds of methods - including
categories such as Network, Files, Pipes, RAS, Event Log, Performance
Monitor, Services, Events (eg, native mutexes, semaphores), Active
Scripting, Active Debugging, ODBC, Memory mapped files, asynch sockets,
dde, LZ compression, and security objects - ie, pretty complete support...
Hope this helps...
Mark
John Nielsen <jnielsen@chemistry.mps.ohio-state.edu> wrote in article
<612t1o$kvi@chemistry.ohio-state.edu>...
> I have recently entered into the NT world from Unix and am looking
> at the scripting languages available for NT.
>
> Both python and perl look to be reasonably solid on the NT platform.
>
> So, I am curious which supports COM and win32 better?
>
> For example, one thing I have of interest is MAPI. I'd like to resolve
> a mail alias into their corresponding usernames. It looks like I'd have
> to use extended MAPI on the NT side w/C++. If I can use perl or python
> instead, that would be preferred.
>
> Also, are both reasonably adept at producing gui envrions for windows?
>
> Thanks for any input . . .
>
> john
>
>
------------------------------
Date: Fri, 3 Oct 1997 15:12:58 GMT
From: Tim Bunce <Tim.Bunce@ig.co.uk>
Subject: Re: DBD::Oracle and Perl5.004_03 - dumps core
Message-Id: <EHHE9n.FJ9@ig.co.uk>
In article <3433F2EE.2171@ixlabs.com>,
Chris Schoenfeld <chris@ixlabs.com> wrote:
> I recently attempted to install DBD::Oracle 0.47 on a Sparc 20 Solaris
> 2.5 machine with perl 5.004_03 and DBI 0.90.
>
> I get the following errors:
> t/base..............dubious
> Test returned status 0 (wstat 139)
> test program seems to have generated a core
>
> In addition, all our Oracle production scripts (which use earlier
> versions of DBD, DBI, perl) work fine on the old perl but dump core with
> the new perl. ALl other perl scripts seem OK.
>
> Has anyone else experienced this?
The README says:
If you have build/link or core dump problems try using
"perl Makefile.PL -p".
Tim.
------------------------------
Date: Fri, 03 Oct 1997 13:41:18 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: DESPERATE for help with string matching
Message-Id: <3439f588.151444826@igate.hst.moc.com>
[cc'd automagically to original author]
On Fri, 03 Oct 1997 07:06:32 GMT, carols@sabre.com (Carol Lynn Smith)
wrote:
>Kinda new at Perl, so forgive me if I ask a simple question:
>I have an HTML file with several <table> tags throughout. I need to
>match the first occurence of "<table> the stuff in between which can
>be just about anything </table>" (this represents the header) ...and
>then I need to match the last occurrence of "<table> the stuff in
>between which can be just about anything </table>" (this would be the
>footer).
Read the perlop man page, where there's some good info about
constructing a regex that will match the strings you're looking for.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: 3 Oct 1997 17:29:18 GMT
From: California Man <jeep@rahul.net>
Subject: download an HTML site?
Message-Id: <613a1e$bbl$1@samba.rahul.net>
Im new to perl. Im using perl 5.004. How do I open a web address
and download the html text file?
Thanks
jeep@rahul.net
--
------------------------------------------------------------------
http://www.rahul.net/jeep
------------------------------------------------------------------
------------------------------
Date: Fri, 03 Oct 1997 17:39:35 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: download an HTML site?
Message-Id: <34372dbe.165834176@igate.hst.moc.com>
[cc'd automagically to original author]
On 3 Oct 1997 17:29:18 GMT, California Man <jeep@rahul.net> wrote:
>Im new to perl. Im using perl 5.004. How do I open a web address
>and download the html text file?
You could read the Perl FAQ at http://www.perl.com/ and look for the
question "Where can I learn about CGI or Web programming in Perl?"
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: 3 Oct 1997 10:50:15 -0700
From: mcravit@best.com (Matthew Cravit)
Subject: Re: download an HTML site?
Message-Id: <613b8n$jn2$1@shell3.ba.best.com>
In article <613a1e$bbl$1@samba.rahul.net>,
California Man <jeep@rahul.net> wrote:
>Im new to perl. Im using perl 5.004. How do I open a web address
>and download the html text file?
The LWP modules (available from http://www.perl.com/perl/CPAN/ or your
local mirror) will enable you to do this very simply, using code like:
#!/usr/bin/perl -w
use LWP::Simple;
$html = LWP::Simple::get('http://www.site.com/page.html');
There are also other modules in the LWP family which enable you to do
far more complex things, which is why once you get the LWP modules, you
will probably want to look at the documentation which comes with them.
Hope this helps.
/MC
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: 3 Oct 1997 13:36:15 GMT
From: Jamie Hoglund <jhoglund@mirage.skypoint.com>
Subject: Re: Emmulating MORE in Perl?
Message-Id: <612scf$ami$2@shadow.skypoint.net>
Jim Turner <turnerj@cliffy.lmtas.lmco.com> wrote:
: Help! I am needing to emmulate the behavior of "more" using Perl. My
: problem is that I am piping in a file, command results, etc. into STDIN, but
: need to be able to pause and input a character directly from the terminal
: in the same program. Anyone have any ideas how to do this? I looked first
: in the Camel book and then in the Modules list in CPAN, but didn't find
: anything that looked like it would work.
: Thanks very much in advance.
I think I understand your problem, your reading from STDIN, and you need
to get input from the terminal, but STDIN is coming in from redirection?
You might be able to do an open(OUTPUT, "|$pager")
and print OUTPUT $data
Or, if you really want to read a key from withing your perl script,
MAYBE something like:
$tty = `tty` ;
open(TTY,"$tty");
and read from the TTY file handle. (not really sure what tty will be if
you had redirected input)
Jamie
------------------------------
Date: Fri, 3 Oct 1997 06:34:15 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Nathan Stanford <nathan@cyberservices.com>
Subject: Re: Flakey - My scripts works sometimes not others... help!
Message-Id: <Pine.GSO.3.96.971003063357.27448G-100000@usertest.teleport.com>
On Thu, 2 Oct 1997, Nathan Stanford wrote:
> It does not work every time some times I put in no password on the form
> and it lets me still get the web page help why does it work sometimes
> and not other?
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to
solving such problems. It's available on the perl.com web pages. Hope
this helps!
http://www.perl.com/perl/
http://www.perl.com/perl/faq/
http://www.perl.com/perl/faq/idiots-guide.html
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 03 Oct 1997 19:00:33 -0700
From: Jan Krynicky <Jan.Krynicky@st.mff.cuni.cz>
Subject: Re: Generating bit patterns "00000000" .. "11111111" - summary
Message-Id: <3435A341.1FBB@st.mff.cuni.cz>
Ricky Roque wrote:
>
> I'm trying to generate pattern like the following
> "00000000"
> "00000001"
> "00000010"
> :
> :
> "11111110"
> "11111111"
I have tested the proposed methods. Here is the summary.
#<???>
# Jan Krynicky <Jan.Krynicky@st.mff.cuni.cz>
for($i=0;$i<=255;$i++){
print unpack('B8',pack('C1',$i)),"\n";
}
#
#0m0.310s 0m0.370s
#0m0.160s 0m0.760s
#
#<???>
# Matthew Rice <matthew.rice@ftlsol.com>
print map { unpack('B8', pack('C1', $_)), "\n" } (0..255)
#
#0m0.310s 0m0.380s
#0m0.160s 0m0.760s
#
#<???>
# mick@picus.dcs.bbk.ac.uk (Mick Farmer)
for ($i = 0; $i < 256; $i++) {
for ($b = 0200; $b > 0; $b >>= 1) {
print $i&$b ? 1 : 0;
}
print "\n";
}
#
#0m0.310s 0m0.400s
#0m0.160s 0m0.760s
#
#<???>
# Ricky Roque <ricky.roque@bigfoot.com>
#!/usr/bin/perl
for (1..$ARGV[0]){ $b[$_]=0; }
do{
for ($c=1;$c<=$lastb+1;$c++){
if ($b[$c]==0){
$b[$c]=1;
last;
}else{ $b[$c]=0; }
}
if ($c>$lastb) { $lastb=$c; }
for ($c=$ARGV[0];$c>=1;$c--){ print $b[$c]; }
print "\n";
}until ($lastb>$ARGV[0]);
#
#0m0.310s 0m0.410s
#0m0.160s 0m0.760s
#
#<???>
# Tom Phoenix <rootbeer@teleport.com>
$_ = '0' x $ARGV[0];
die "Bad idea!" if length > 12;
{
print "$_\n";
$_++;
s/0(1*2)$/ 1 . 0 x length $1 /e;
redo unless substr($_,-1) eq '2';
}
#
#0m0.320s 0m0.440s
#0m0.160s 0m0.760s
#
#<???>
# Steffen Beyer <sb@sdm.de>
#!/usr/local/bin/perl
use Bit::Vector;
$vector = Bit::Vector->new(16);
# do something with $vector == 0x0000
while (! $vector->increment())
{
# do something with $vector between 0x0001 and 0xFFFF
}
# do not have Bit::Vector
# I do not think this one will be quick. :-)
The times are generated by
bash$ times perl scripname.pl
All scripts generated and printed 11 sets of 8 bit patterns.
( for $unnused (0..10) {....} )
Jenda
P.S.: One wouldn't believe how many responses may such a silly
question provoke. :-)
------------------------------
Date: 3 Oct 1997 10:15:19 -0700
From: mcravit@best.com (Matthew Cravit)
Subject: Re: help me please!
Message-Id: <613977$4gg$1@shell3.ba.best.com>
In article <3434c92b.12252183@news.telekom.ru>,
Vladimir Afanasiev <afan@elnet.msk.ru> wrote:
>>Can't locate IO/Socket.pm in @INC at cgi-bin/tramp.pl line 2.
>>BEGIN failed--compilation aborted at cgi-bin/tramp.pl line 2.
>
> Where is error?
The error is exactly what it says above. Your script had the line:
use IO::Socket;
and Perl responded that it looked in all of the directories where it
expects modules to live, and it didn't find the IO::Socket module.
The array @INC is a special one, which contains a list of the directories
where Perl expects to find modules.
There are several things you should check:
- The command "perl -V" will tell you (among other things) what the
current contents of @INC are. The module IO::Socket should be in a
file called Socket.pm in a subdirectory called IO. This subdirectory
should be in one of the directories listed in @INC.
- If you have IO::Socket installed in some other directory, you should
add that directory to your @INC array before the "use IO::Socket" line.
Something like:
BEGIN { unshift @INC, "/path/to/where/I/have/things"; }
included at the top of your script would work.
- Since I assume from your error message that this is a CGI script,
make sure that whatever user the script gets run as has sufficient
permissions to read the IO::Socket module and its directory hierarchy.
- Since your script seems to be simply doing an HTTP request, you might
think about using the LWP modules instead, which make things much
easier, and allow you to write things like:
#!/usr/bin/perl
use LWP::Simple;
$contents = LWP::Simple::get("http://www.yoursite.com/");
and have $contents get the HTML source for the named URL. (You can also use
this technique for other types of URLs).
Hope these suggestions help.
/MC
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: Fri, 03 Oct 1997 13:38:39 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Help with redirect script
Message-Id: <3438f517.151331923@igate.hst.moc.com>
[cc'd automagically to original author]
On Thu, 2 Oct 1997 21:39:44, edb105@psu.edu (Eric Blessner) wrote:
>I want to redirect a url from a html page. I used this
>
>echo Location: http://www.sample.com
>echo
>
>This works but my problem is it does not regster in my stats output as being
>accessed (which is the whole reason I put it out there.) What do I need
>to do to get it to register. Can anyone help me with this, I would be
>greatful.
It appears that your question has nothing to do with Perl.
Anyhow, try this:
#!/usr/local/bin/perl
use CGI;
my $query->new CGI;
print $query->redirect("http://www.sample.com/");
exit;
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: 03 Oct 1997 12:18:56 -0500
From: reece@dasher.wustl.edu
Subject: HELP: perlxs C++ color example
Message-Id: <82u3eyojcv.fsf@cupid.wustl.edu>
Linux 2.0.30, perl 5.004_03, gcc 2.7.2.3
Cheers. I'm having troubles with the perlxs C++ color example. I can get
a new object created but something goes amiss between returning the
pointer to the new object and getting THIS set to that object in a
subsequent method calls. I suspect I'm not returning the object reference
correctly.
The first symptom was THIS wasn't an object when I call a method. With a
few debugging statements in the typemap, I realized that the OUTPUT
conversion wasn't being performed. Adding
OUTPUT:
RETVAL
to the xsub worked (I thought xsubpp shouldn't need this).
However, THIS still isn't a valid object in subsequent method calls. My
expectation was that xsubpp would deal with returning an object pointer to
perl after a new(), and extracting that object pointer into THIS on a
method call. I believe one or both of those processes is broken in my
code. I've tried to infer and implement what's /supposed/ to be returned
(e.g., make a new mortal, set it, push it), but nothing's worked.
# in color::new
created color object 80eb980
color set to 42
# from typemap
output conversion: ST(0) (80b62c8), color, RETVAL (80eb980)
Attempt to free unreferenced scalar at test.pl line 25.
# xsubpp preamble to color::set_blue from typemap
ST(0) = 80bc7ac
# xsubpp preamble to color::blue from typemap
ST(0) = 80bc7ac
not ok 2
Code snippets derived from the perlxs examples are below. The full source
is at ftp://dasher.wustl.edu/pub/reece/color.tgz. It should build with
the standard 'perl Makefile.PL; make; make test' sequence.
I'd appreciate any useful tips and C++/perlxs examples. Thanks!
Reece
<<color.xs
color*
color::new()
CODE:
RETVAL = new color();
printf("created color object %lx\n",RETVAL);
RETVAL->set_blue( 42 );
printf("color set to %d\n",RETVAL->blue());
OUTPUT:
RETVAL
>>color.xs
<<typemap
TYPEMAP
color * O_OBJECT
INPUT
O_OBJECT
printf(\"$arg = %lx\\n\",(void*)$arg);
if( sv_isobject($arg) )
if( SvTYPE(SvRV($arg)) == SVt_PVMG )
$var = ($type)SvIV((SV*)SvRV( $arg ));
else{
warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" );
XSRETURN_UNDEF;
}
else{
warn( \"${Package}::$func_name() -- $var is not an object\" );
XSRETURN_UNDEF;
}
# The Perl object is blessed into 'CLASS', which should be a
# char* having the name of the package for the blessing.
OUTPUT
O_OBJECT
$arg = sv_newmortal();
sv_setref_pv( $arg, CLASS, (void*)$var );
printf(\"output conversion: $arg (%lx), %s, $var (%lx)\\n\",
$arg,CLASS, $var);
>>typemap
<<test.pl
$c = new color();
$c->set_blue(6);
print( ($c->blue()==6) ? "ok 2" : "not ok 2", "\n");
>>test.pl
--
Reece. See http://dasher.wustl.edu/~reece/ for info and PGP key.
------------------------------
Date: Fri, 3 Oct 1997 12:00:20 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: Help: reformat variable
Message-Id: <EHH5CK.B56@mail2.ccs.bbk.ac.uk>
Dear Peter,
You need a function something along these lines.
sub Format {
my $text = shift;
$text =~ s/\n+/ /gs; # remove newlines
$text =~ s/(.{1,40}\S{1,10})\s+/$1\n/g; # newline between 40 and 50 chars
$text;
}
Regards,
Mick
------------------------------
Date: Fri, 3 Oct 1997 06:47:22 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Minh Nguyen <minhn@newbridge.com>
Subject: Re: hex display for large integer
Message-Id: <Pine.GSO.3.96.971003064408.27448K-100000@usertest.teleport.com>
[ I was too quick last time. Let's try that again... ]
On Thu, 2 Oct 1997, Minh Nguyen wrote:
> Does anyone know if you can display large decimal values (greater than
> 32 bits) in perl?
Well, if you're going to use integers larger than 32 bits, you should
probably store them using the Math::BigInt module, which comes with Perl.
(If you store them in standard scalars, you run the risk of losing the low
bits, since they'll be stored as floating point. In fact, on some
machines, this might even happen before you get to 32 bits.)
But if you want hex output, Math::BigInt doesn't provide that ability
internally. Nevertheless, you can code it up without much trouble.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 03 Oct 97 13:04:27 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: How to write a context sensitive subroutine in PERL?
Message-Id: <34352a3b$4$ofn$mr2ice@speaker>
In <34319C5F.51B6@cup.hp.com>, on 09/30/97 at 05,
Raymond W Yu <rayyu@cup.hp.com> said:
+-----
| I would like to know how to write a subroute to return a string if it's
| called in a scalar context(ie $s = foo()), and to return a hash if it's
| called in a hash context.
| $scalar = foo(); # gets a string
| %hash = foo(); # gets a hash
+--->8
Perl doesn't have a "hash context" per se. It has a list context, which when
assigned to a hash is treated as a list of alternating keys and values.
As for distinguishing context, see "perldoc -f wantarray".
--
brandon s. allbery [Team OS/2][Linux] bsa@void.apk.net
cleveland, ohio mr/2 ice's "rfc guru" :-) KF8NH
Warpstock '97: OS/2 for the rest of us! http://www.warpstock.org
Memo to MLS: End The Burn Scam --- Doug Logan MUST GO! FORZA CREW!
------------------------------
Date: Fri, 03 Oct 1997 13:36:02 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Installing CGI.pm question
Message-Id: <3436f488.151188848@igate.hst.moc.com>
[cc'd automagically to original author]
On Thu, 02 Oct 1997 20:37:09 -0400, Barry Kaplan <barry@megaspace.com>
wrote:
>I'm trying to install the latest CGI.pm-2.37b5 on my ISP's unix box.
>When I run "perl Makefile.PL", I get the following error message:
>
>web: {5} % perl5 Makefile.PL
>Can't locate Carp.pm in @INC at ExtUtils/MakeMaker.pm line 13.
>BEGIN failed--compilation aborted at ExtUtils/MakeMaker.pm line 13.
>BEGIN failed--compilation aborted at Makefile.PL line 1.
>
>I've tried placing Carp.pm in an ExtUtils subdirectory and but it still
>yeilds the same results.
Talk to whoever maintains Perl for your ISP. Ask them to
update/install some new modules and possibly upgrade their Perl. (What
does the output of 'perl -v' say?)
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Fri, 03 Oct 1997 13:33:21 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Is there a Newsgroup for "Perl for NT and/or IIS"?
Message-Id: <3435f40c.151064639@igate.hst.moc.com>
[cc'd automagically to original author]
On Thu, 02 Oct 1997 19:40:14 +0000, Nathan Stanford
<nathan@cyberservices.com> wrote:
> Is there a Newsgroup for "Perl for NT and/or IIS"?
No, but there is a mailing list.
See http://www.activestate.com/
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Fri, 03 Oct 1997 14:37:11 GMT
From: dont@spam.com (Mike)
Subject: Re: Is there a Newsgroup for "Perl for NT and/or IIS"?
Message-Id: <34350301.5025591@news.accesscom.net>
On Fri, 03 Oct 1997 13:33:21 GMT, zawodny@hou.moc.com (Jeremy D.
Zawodny) mumbled these words:
|[cc'd automagically to original author]
|
|On Thu, 02 Oct 1997 19:40:14 +0000, Nathan Stanford
|<nathan@cyberservices.com> wrote:
|
|> Is there a Newsgroup for "Perl for NT and/or IIS"?
Check out http://www.4images.com/ntperl
----------------------------------------------
Spambot food:
president@whitehouse.gov
abuse@aol.com
abuse@att.net
abuse@uu.net
julius@cajun.net
webmaster@cajun.net
darrin@cajun.net
------------------------------
Date: 3 Oct 1997 16:17:10 GMT
From: scott@lighthouse.softbase.com (Scott McMahan)
Subject: Re: Is there a Newsgroup for "Perl for NT and/or IIS"?
Message-Id: <6135q6$tje$3@mainsrv.main.nc.us>
Nathan Stanford (nathan@cyberservices.com) wrote:
: Is there a Newsgroup for "Perl for NT and/or IIS"?
I know of no separate newsgroups for either. Microsoft might have one
of its newsgroups for IIS.
I try to answer all reasonable NT/95 questions I see in this newsgroup
with helpful answers, if possible. That is, questions that make sense:
a lot of them have words and end in a '?', but don't really make a lot
of sense. I've used Perl extensively on NT and 95, and know
a lot of the gotchas. The biggest problem I've seen is that
a lot of the stuff is *NOT* different: a lot of UNIX code works
great as-is on the Win32 platforms. People either 1) try to make
it harder than it is, or 2) have configuration problems of their
own which prevent Perl scripts from running.
I can't help with IIS: I had so many problems getting CGI to work with
it I gave up and moved all my CGI programs to an Apache server. Perl
and IIS do NOT get along well.
Scott
------------------------------
Date: Fri, 03 Oct 1997 17:35:07 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Is there a Newsgroup for "Perl for NT and/or IIS"?
Message-Id: <34362a6c.164984715@igate.hst.moc.com>
[cc'd automagically to original author]
On 3 Oct 1997 16:17:10 GMT, scott@lighthouse.softbase.com (Scott
McMahan) wrote:
>I can't help with IIS: I had so many problems getting CGI to work with
>it I gave up and moved all my CGI programs to an Apache server. Perl
>and IIS do NOT get along well.
Hm. I've been quite successful at getting Perl and IIS to work
together.
While I do agree that Apache is a superior web server, I've done
nothing special (other than follow the published instructions) to get
Perl, PerlIS, and PerlScript working in conjunction with IIS.
The majority of problems that *I've* seen people post about here or on
the Perl-Win32-Web mailing list seem to result from not following the
directions or not understanding the difference between running scripts
under a "service" and running them at the command-line.
I'm not accusing you of any of the above, I'm simply stating what I've
seen.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Fri, 03 Oct 1997 10:06:10 -0700
From: Sriram Srinivasan <sriram@weblogic.com>
To: ads@websp.com
Subject: Re: Performing Subroutines from a string of text
Message-Id: <34352602.4EEF6B4F@weblogic.com>
Sidney,
given:
$line = "text a b c:next text:some more text:RQCVF"
you want to run different subroutines based on RQCVF ...
Simple .. extract the letters, and use symbolic references to
call the subroutine ..
$line = "text a b c:next text:some more text:RQC";
($parta, $partb, $partc, $partd) = split (/:/, $line);
foreach $subName (split //, $partd) {
# subName contains "R", "Q", "C" etc. in subsequent iterations
&$subName; # appropriate sub called symbolically!
}
sub R { print "R called \n"; }
sub Q { print "Q called \n"; }
sub C { print "C called \n"; }
Hope this is what you were looking for.
- Sriram
________________________________________________________________________
Principal Engineer WebLogic, San Francisco www.weblogic.com
"Advanced Perl Programming" : http://www.ora.com/catalog/advperl/
------------------------------
Date: Fri, 3 Oct 1997 06:36:53 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Matt <mrc@pressroom.com>
Subject: Re: Perl Questions
Message-Id: <Pine.GSO.3.96.971003063628.27448H-100000@usertest.teleport.com>
On 2 Oct 1997, Matt wrote:
> everytime I hit the submit button, the browser
> tries to download the script.
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to
solving such problems. It's available on the perl.com web pages. Hope
this helps!
http://www.perl.com/perl/
http://www.perl.com/perl/faq/
http://www.perl.com/perl/faq/idiots-guide.html
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 03 Oct 1997 15:33:30 +0100
From: Edward Odufeso <eh91@dial.pipex.com>
Subject: Question on perl-Win32
Message-Id: <3435023A.AB2DC60A@dial.pipex.com>
Running the script(a) below shows the output for the first time, when I
run it again the output is not displayed using the perl for win32
program. The version i am using is 5.003, is there a bug with this
release or is it me.
I also notice that when I put a double printed line in the script(b)
below the output is displayed only once.
script(a)
---------------------------------------------------------------------------------------------
$inputline = <STDIN>;
$wordcount = 1;
while ($inputline ne "") {
@stringcount = split(/the/, $inputline);
#$totalnumber += $wordcount;
$wordcount++;
$inputline = <STDIN>;
}
print ("The value of \@stringcount is: @stringcount\n");
-------------------------------------------------------------------------------------------
script(b)
-------------------------------------------------------------------------------------------
$inputline = <STDIN>;
$wordcount = 1;
while ($inputline ne "") {
@stringcount = split(/the/, $inputline);
#$totalnumber += $wordcount;
$wordcount++;
$inputline = <STDIN>;
}
print ("The value of \@stringcount is: @stringcount\n");
print ("The value of \@stringcount is: @stringcount\n");
-------------------------------------------------------------------------------------------
Any ideas would be much appreciated.
Many Thanks
Ed.
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1120
**************************************