[9476] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3070 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 6 21:17:15 1998

Date: Mon, 6 Jul 98 18:04:58 -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           Mon, 6 Jul 1998     Volume: 8 Number: 3070

Today's topics:
        List contents <wao@aluxs.micro.lucent.com>
    Re: List contents (Larry Rosler)
    Re: List contents (Josh Kortbein)
        Looking for news from the Perl Institute (Andrew Henry)
        Methods for creating unique file name? <strat@pacifier.com>
    Re: Methods for creating unique file name? (Craig Berry)
    Re: NEVER "call warn() and return undef" (Re: question  <aas@sn.no>
    Re: NEVER "call warn() and return undef" (Re: question  <zenin@bawdycaste.org>
    Re: NEVER "call warn() and return undef" (Re: question  <jdporter@min.net>
    Re: NEVER "call warn() and return undef" (Re: question  <aas@sn.no>
    Re: NEVER "call warn() and return undef" (Re: question  <zenin@bawdycaste.org>
        never mind <howard@vortexweb.com>
        open2 problems (Harold Bamford)
    Re: open2 problems <tchrist@mox.perl.com>
    Re: panic: malloc at D:\nDS\wwwroot\cgi-bin\constructsy <norman.bunn@mci.com>
    Re: Passing arguments to perl CGI (Martien Verbruggen)
    Re: Passing arguments to perl CGI (brian d foy)
    Re: perl asp question (Richard Bellavance)
    Re: Perl At Work <jdporter@min.net>
    Re: Perl At Work (Craig Berry)
        perl calling C calling perl again (Edwin Litterst)
    Re: PERL code in browser instead of page (Jeremy D. Zawodny)
        Perl for BS2000? <sb@sdm.de>
    Re: Perl for BS2000? <jhi@alpha.hut.fi>
        Perl Modules for NT <donm@statsci.com>
    Re: Perl on MVS? <ward.kaatz@pss.boeing.com>
        Perl strchr? (Benjamin Dixon)
    Re: Perl strchr? <quednauf@nortel.co.uk>
    Re: Perl strchr? <Jonathan_Epstein@nih.gov>
    Re: Perl strchr? <simonf@conduit.co.uk>
    Re: Perl strchr? <jdporter@min.net>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 06 Jul 1998 15:28:21 -0400
From: Bill Oswald <wao@aluxs.micro.lucent.com>
Subject: List contents
Message-Id: <35A12554.E9B55C46@aluxs.micro.lucent.com>

Is there a way to check if a list contains a specific
element. I could do

foreach $tmp (@list)
{
  if ($tmp eq "some item")
  ...
}

but is there something simpler?

Thanks
Bill


--
We have enough youth. What we need is a fountain of smart!





------------------------------

Date: Mon, 6 Jul 1998 12:47:37 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: List contents
Message-Id: <MPG.100ac9b2154c8409896e8@nntp.hpl.hp.com>

In article <35A12554.E9B55C46@aluxs.micro.lucent.com> on Mon, 06 Jul 1998 
15:28:21 -0400, Bill Oswald <wao@aluxs.micro.lucent.com> says...
> Is there a way to check if a list contains a specific
> element. I could do
> 
> foreach $tmp (@list)
> {
>   if ($tmp eq "some item")
>   ...
> }
> 
> but is there something simpler?

This is a Frequently Asked Question.  You should look for the answer in 
perlfaq4: "How can I tell whether an array contains a certain element?"

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: 6 Jul 1998 21:17:37 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: List contents
Message-Id: <6nreth$q5d$1@news.iastate.edu>

Bill Oswald (wao@aluxs.micro.lucent.com) wrote:
: Is there a way to check if a list contains a specific
: element. I could do

: foreach $tmp (@list)
: {
:   if ($tmp eq "some item")
:   ...
: }

>From perlfaq4:

  How can I tell whether an array contains a certain element?

  There are several ways to approach this.  If you are going to make this
  query many times and the values are arbitrary strings, the fastest way is
  probably to invert the original array and keep an associative array lying
  about whose keys are the first array's values.

      @blues = qw/azure cerulean teal turquoise lapis-lazuli/;
      undef %is_blue;
      for (@blues) { $is_blue{$_} = 1 }

  Now you can check whether $is_blue{$some_color}.  It might have been a good
  idea to keep the blues all in a hash in the first place.

  If the values are all small integers, you could use a simple indexed array.
  This kind of an array will take up less space:

      @primes = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31);
      undef @is_tiny_prime;
      for (@primes) { $is_tiny_prime[$_] = 1; }

  Now you check whether $is_tiny_prime[$some_number].

  If the values in question are integers instead of strings, you can save
  quite a lot of space by using bit strings instead:

      @articles = ( 1..10, 150..2000, 2017 );
      undef $read;
      grep (vec($read,$_,1) = 1, @articles);

  Now check whether vec($read,$n,1) is true for some $n.

  Please do not use

      $is_there = grep $_ eq $whatever, @array;

  or worse yet

      $is_there = grep /$whatever/, @array;

  These are slow (checks every element even if the first matches),
  inefficient (same reason), and potentially buggy (what if there are regexp
  characters in $whatever?).


Josh

--

__________________________________________
She had heard all about excluded middles;
they were bad shit, to be avoided.
            - Thomas Pynchon



------------------------------

Date: 6 Jul 1998 15:23:02 +0100
From: ahenry@dircon.co.uk (Andrew Henry)
Subject: Looking for news from the Perl Institute
Message-Id: <6nqmk6$b8j@tdc.dircon.co.uk>

I've been a member of the Perl Institute v2.0 for the last six
months.  The last thing on the "Whats new" page was four
months ago, I've never had a message from the tpi-announce mailing
list, and the list of current projects still looks just about the
same as it was 20 months ago.  A month ago, I spotted a comment
on c.l.p.m that the bug tracking system would be ready RSN, but
other than that, its been really quiet.  Perl Institute v1.0 quiet.  
I'm not necessarily looking for a list of great achievements, just
a simple list of the things that the Institute has been doing recently.

I sent a similar request to tpi@perl.org three weeks ago, but I
haven't had a reply.

-- 
Andrew Henry
ahenry@dircon.co.uk


------------------------------

Date: Mon, 6 Jul 1998 11:45:06 -0700
From: "Christian Brink" <strat@pacifier.com>
Subject: Methods for creating unique file name?
Message-Id: <35a11bc4.0@news.pacifier.com>


Who has a good routine for creating unique filenames in Perl5 and 4?


--
C. Christian Brink,CNE
IS-Manager
All-Sports Supply, LLC
Clackamas,OR

strat@pacifier.com
chrisb@assi.com




------------------------------

Date: 6 Jul 1998 19:00:30 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Methods for creating unique file name?
Message-Id: <6nr6se$hus$3@marina.cinenet.net>

Christian Brink (strat@pacifier.com) wrote:
: Who has a good routine for creating unique filenames in Perl5 and 4?

POSIX::tmpnam()
IO::File::new_tmpfile()

The first actually returns a name, but doesn't open the file; the second
opens a unique temp file for read/write, but doesn't show you the name. 

Both are Perl5 only, of course.  I believe you'd have to roll your own
Perl4 solution.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


------------------------------

Date: 06 Jul 1998 11:13:03 +0200
From: Gisle Aas <aas@sn.no>
Subject: Re: NEVER "call warn() and return undef" (Re: question about objects)
Message-Id: <m3hg0v1gww.fsf@furu.g.aas.no>

Zenin <zenin@bawdycaste.org> writes:

> 	A *MUCH* better method is to set a package global (say,
> 	$MyPackage::Error) and return undef (as the DBI module and many
> 	others use).  Or if you must, throw an exception via confess, croak,
> 	or die (in that order), but do *not* call warn() and think that
> 	all will be happy with the world.
> 
> 	Whatever you do, documenting it is rule #1.  The IO::Socket module
> 	constructor for instance, sets $@ (why this var, I have no idea.
> 	It's just a bad idea altogether...), calls warn(), and returns
> 	undef. The warn() should never be there (who's to say that there is
> 	someone sitting at the console to see that warn() fly by?), and $@
> 	is not only a bad choice ($IO::Socket::Errstr would be much, much
> 	better) it's not documented at all.

[FYI: The warn() call has been eliminated in the latest IO modules on CPAN.]

I don't have that much problems with using $@ for this kind of thing.
I just use a mental model of the IO::Socket::INET constructor being
implicitly wrapped up in an eval{} block.  Some reasons for using it
might be:

  - It is easier to propagate the error as an exception:
       my $sock = IO::Socket::INET->new("www.perl.com:80") || die;

  - It is easier to use (because it is less characters to type).

  - This use of $@ is unlikely to be in conflict with its use as
    the eval error string.

  - The $@ variable is tread-safe.  A package global would not be.

Even if there is general consensus that this kind of use of $@ is to
be avoided, it is _not_ a good idea to fix IO::Socket which already
has wide use.

Also note that newer version of the IO::Socket::INET constructor
preserve $! as the error of the system call that actually failed.
There is still a problem that it is not really possible to tell
exactly which system call it belonged to.

> 	More over, by the perl convention of nothing existing unless it's
> 	documented, IO::Socket has absolutely no error handling whatsoever.
> 	-Nether the warn() or the setting of $@ is documented anywhere
> 	in IO::Socket.

Perhaps it would be better to just make a documentation patch and send
to Graham instead of complaining about it again.

-- 
Gisle Aas


------------------------------

Date: 6 Jul 1998 11:05:40 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: NEVER "call warn() and return undef" (Re: question about objects)
Message-Id: <899723685.706779@thrush.omix.com>

Gisle Aas <aas@sn.no> wrote:
: [FYI: The warn() call has been eliminated in the latest IO modules on CPAN.]

	Cool.  I'll still wait for the next version of perl before
	upgrading, but this is good to know.

	>good reasons for use of $@ sniped<

: Even if there is general consensus that this kind of use of $@ is to
: be avoided, it is _not_ a good idea to fix IO::Socket which already
: has wide use.

	But if it's not documented, it's the user's error for using
	it.  Anyone that puts any trust in any undocumented feature
	gets what they ask for.  I've done this with simpler things
	then this use of $@ with core modules, and gotten burned
	later for it.  Not again.  If it's not documented, it's
	experimental at best IMO.  Since IO::Socket no longer
	calls a warn() for instance, anyone catching it with
	$SIG{__WARN__} is SOL.

	Anyway, none of this relates however, to (what I meant to
	be...) the issue of this thread, which is that 'warn "foo" ;
	return;' is a bad idea.  I only meant to use IO::Socket's similar
	actions as a small case in point, but found myself bringing up bad
	memories of it's use and started to rant.  I apologize for that.

: Also note that newer version of the IO::Socket::INET constructor
: preserve $! as the error of the system call that actually failed.
: There is still a problem that it is not really possible to tell
: exactly which system call it belonged to.

	Yep.  Perl really could use strict, formal exceptions.  I've
	seen a few modules that have tryed (and tryed to do a couple
	myself) but none really do the job.  A couple times I've
	used the ugly syntax of:

	$obj = new Foo;
	$obj->method()
	    or do {
	        if (%Foo::SomeException) {
	            ...
	        }
	        elsif (%Foo::SomethingElse) {
	            ...
	        }
	    };

	But this is neither thread save, nor pretty.  It does get the
	addition of useful data in the exception however.  To bad $@ can't
	hold a reference.  It would make real exception objects much
	easier to implement, and issues like which call set $! wouldn't
	be an problem.
-- 
-Zenin
 zenin@archive.rhps.org


------------------------------

Date: Mon, 06 Jul 1998 13:20:48 GMT
From: John Porter <jdporter@min.net>
Subject: Re: NEVER "call warn() and return undef" (Re: question about objects)
Message-Id: <35A0D109.7459@min.net>

Zenin wrote:
> 
> John Porter <jdporter@min.net> wrote:
> : Here's a tip: if your constructor won't returned a properly blessed
> : reference, have it call warn, and return undef.
>                           ^^^^
>         Ack!  No!  DO **NOT** DO THIS!
> 
>         Call warn() for "questionable" code usages, as perl does, but do
>         *not* call warn() for *error* conditions.  That's *NOT* what
>         it's for!

Whatever.
The essential point I was trying to make was that the function should
return undef, not some string containing an error message.
If it chooses to do something else with that message, fine.

-- 
John Porter


------------------------------

Date: 06 Jul 1998 17:04:52 +0200
From: Gisle Aas <aas@sn.no>
Subject: Re: NEVER "call warn() and return undef" (Re: question about objects)
Message-Id: <m3n2anyq97.fsf@furu.g.aas.no>

Zenin <zenin@bawdycaste.org> writes:

> To bad $@ can't hold a reference.

Watch this:

  $ perl -le 'eval { die {foo=>bar}; }; print $@->{foo};'
  bar

  $ perl -v

  This is perl, version 5.004_70 built for i586-linux

  Copyright 1987-1998, Larry Wall

  Perl may be copied only under the terms of either the Artistic License or the
  GNU General Public License, which may be found in the Perl 5.0 source kit.

-- 
Gisle Aas


------------------------------

Date: 6 Jul 1998 19:33:30 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: NEVER "call warn() and return undef" (Re: question about objects)
Message-Id: <899754154.371875@thrush.omix.com>

Gisle Aas <aas@sn.no> wrote:
: Zenin <zenin@bawdycaste.org> writes:
: > To bad $@ can't hold a reference.
: Watch this:
:   $ perl -le 'eval { die {foo=>bar}; }; print $@->{foo};'
:   bar
:   $ perl -v
:   This is perl, version 5.004_70 built for i586-linux

	Looks like 5.005 is looking pretty solid, cool.  Now, if
	it can do compile time method name checks ala strict's bare
	word checks, I'd really get fuzzy inside. :-)

-- 
-Zenin
 zenin@archive.rhps.org


------------------------------

Date: Mon, 6 Jul 1998 01:16:19 -0500
From: "Howard Dierking" <howard@vortexweb.com>
Subject: never mind
Message-Id: <uJi2qSKq9GA.232@upnetnews05>

forget I said anything about my earlier post regarding the target="_top"
thing.  Once I actually looked at it, the C++/JAVA side of my brain told me
that those were escape marks to allow quotes to be taken litterally--it
works now--thanks!

howard




------------------------------

Date: 6 Jul 1998 22:36:38 GMT
From: hbamford@marconi.ih.lucent.com (Harold Bamford)
Subject: open2 problems
Message-Id: <6nrjhm$en4@ssbunews.ih.lucent.com>

Greetings,

I have been trying to get open2 and open3 to do SOMETHING.  I have
searched the FAQs and dejanews and perldoc.  I am missing something
here and I hope somebody can point it out for me...

Here is a stripped down use of open2 which doesn't do anything.  The
co-process (cat) is created (I get a PID and I can see the process
using ps) and I get no warnings or errors, but I also get no output.  

Can anybody see what I am doing wrong?

Thanks.

######################################################################
#!perl -w
use strict;
use FileHandle;
use IPC::Open2;

my($WTR) = new FileHandle;
my($RDR) = new FileHandle;

my($pid) = open2($RDR,$WTR,"/usr/bin/cat -u -");
print "pid='$pid'\n";

# This should be enough to fill up any buffer...
foreach(0..5000) {
	print $WTR "012345678901234567890123456789012345678901234567890123456789\n";
	my(@lines) = <$RDR>;
	print "got back: ",join('',@lines);
}
######################################################################

Once I get this working, I am gonna want to use select to see if there
is output pending...

-- Harold Bamford
-- 
-- Harold Bamford
   mailto:hbamford@lucent.com
   (630)713-1351


------------------------------

Date: 6 Jul 1998 23:18:03 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: open2 problems
Message-Id: <6nrlvb$nea$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    hbamford@lucent.com writes:
:I have been trying to get open2 and open3 to do SOMETHING.  I have
:searched the FAQs and dejanews and perldoc.  I am missing something
:here and I hope somebody can point it out for me...

:my($pid) = open2($RDR,$WTR,"/usr/bin/cat -u -");
:# This should be enough to fill up any buffer...
:foreach(0..5000) {
:	print $WTR "012345678901234567890123456789012345678901234567890123456789\n";
:	my(@lines) = <$RDR>;
:	print "got back: ",join('',@lines);
:}

Your bug is that:

    @lines = <FH>;

*Exhausts* the filehandle.

But how is that going to read lines up until end of file?  Why 
would it give you end of file?  You didn't give it one, you know!

Did you mean 

    $line = <FH>;

by chance?

--tom
-- 
Common sense is the collection of prejudices acquired by age 18.
      --Einstein


------------------------------

Date: Mon, 06 Jul 1998 20:17:10 GMT
From: "Norman Bunn" <norman.bunn@mci.com>
Subject: Re: panic: malloc at D:\nDS\wwwroot\cgi-bin\constructsys.pl line 186.
Message-Id: <ahao1.498$N33.623058@pm01nn>

Issue resolved; corrupted data from the dbm file.

Norman

Ilya Zakharevich wrote in message
<6nbdmb$ael$1@mathserv.mps.ohio-state.edu>...
>[A complimentary Cc of this posting was sent to Norman Bunn
><norman.bunn@mci.com>],
>who wrote in article <Ch4m1.1032$P06.378473@pm01nn>:
>> I get the following message:
>>
>> panic: malloc at D:\nDS\wwwroot\cgi-bin\constructsys.pl line 186.
>>
>> when running the following code:
>
>Hmm, this message may happen only with DEBUGGING perl.  It is left as
>a remnant of old time, newer malloc.c's have a better message
>
> "Out of memory during ridiculously large request"
>
>down below the execution path, which is not reached ;-(.
>
>On 32-bit machines it means that malloc() got a request for 2^31 bytes
>or more, most probably due to giving a negative arg to malloc(), or
>something like $arr[time].
>
>>
>> $systemFile = "/nDS/wwwroot/data/db.$groupID.$profile.$systemID";
>> dbmopen (%systemBase, $systemFile, 0666)  || die "Can't open
$systemFile\n";
>> $thisCounter = 0;
>> while ( $thisCounter <=3 )
>> {
>>     $counter[$thisCounter] = 0;
>>     $thisCounter++;
>> }
>> while (($systemKey, $systemValue) = each %systemBase)
>> {
>> #    ($type, $MSO, $linkage, $package) = split('{}', $systemValue);
>> print "$systemValue";
>> #=========
>> }
>> dbmclose(systemBase);
>> end_html;
>> exit;
>> #=========
>>
>> the data looks like:
>>
>>
Monitor{}3{}6{}yesJC-1746UMAMonitor{}3{}6{}yes360-5420Monitor{}3{}6{}yes360-
>>
6014Monitor{}3{}6{}yes360-5231Monitor{}3{}6{}yes360-6170Monitor{}3{}6{}yes36
>>
0-5033Monitor{}3{}6{}yes360-5031Modem{}3{}0{}313-0520Input{}3{}0{}310-3600Ne
>>
twork{}3{}3{}430-1576Network{}3{}3{}360-6015Video{}3{}0{}320-0220Storage{}3{
>> }5{}340-0748Storage{}3{}5{}340-0751Storage{}3{}5{}340-0734Storage{}3{}5{}
340
>> -0737Sound{}3{}4{}313-1001Sound{}3{}4{}313-0202Sound{}3{}0{}313-0375Memor
y{}
>>
3{}2{}311-0518Memory{}3{}2{}311-0517DTAccess{}3{}1{}220-0498DTAccess{}3{}1{}
>>
220-0483Warranty{}3{}0{}900-1902OS{}3{}0{}420-0118Configuration{}1{}0{}365-0
>> 211Desktop{}0{}0{}220-0416
>>
>> Where the 123-1234 portions represent the keys.
>>
>> I'm running Perl 5.004_002 under IIS 4 and NT 4.0.  This code works fine
for
>> the following data:
>
>Hope this helps,
>Ilya




------------------------------

Date: 2 Jul 1998 22:42:54 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Passing arguments to perl CGI
Message-Id: <6nh2de$n76$1@comdyn.comdyn.com.au>

In article <359c1381.2432728@news.inlink.com>,
	joker@inlink.com (John Hocking) writes:

> Why? All of the hard work has been done for you.

Indeed it has. It's called CGI.pm. And it does lots more than the
little snippet of code you supplied, and handles many more situations.

While in some very few cases it might be necessary to use something
more lightweight than CGI,pm, it normally is the best solution.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | In the fight between you and the world,
Commercial Dynamics Pty. Ltd.       | back the world - Franz Kafka
NSW, Australia                      | 


------------------------------

Date: Mon, 06 Jul 1998 14:09:04 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Passing arguments to perl CGI
Message-Id: <comdog-ya02408000R0607981409040001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6nh2de$n76$1@comdyn.comdyn.com.au>, mgjv@comdyn.com.au (Martien Verbruggen) posted:

>In article <359c1381.2432728@news.inlink.com>,
>        joker@inlink.com (John Hocking) writes:
>
>> Why? All of the hard work has been done for you.
>
>Indeed it has. It's called CGI.pm. And it does lots more than the
>little snippet of code you supplied, and handles many more situations.
>
>While in some very few cases it might be necessary to use something
>more lightweight than CGI,pm, it normally is the best solution.

that something more lightweight might be CGI::Request - a 
derivative of the monolithic CGI.pm.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>


------------------------------

Date: 6 Jul 1998 12:20:03 -0400
From: charlot@CAM.ORG (Richard Bellavance)
Subject: Re: perl asp question
Message-Id: <6nqtfj$7gi@stratus.CAM.ORG>

In article <6nmc3m$kek@bgtnsc03.worldnet.att.net>, ee <ee@juno.com> wrote:
>The following is my attempted perl port of a vbscript example.  It should
>open a file and display all of its contents.
>
><%
>$filesys = $Server->CreateObject("Scripting.FileSystemObject");
>$filea = $filesys->OpenTextFile("c:\inetpub\wwwroot\copy.txt");
>$Response->write ($filea->ReadAll);
>%>
>

I've never used ASP, but I don't think your problem is related to it at all.
Try enclosing constant strings in single quotes (') when you don't need
interpolation.  The way you've written it, the file name you try to open
is not what you think it is... ("perldoc perlop" for details).

>Can't call method "ReadAll" without a package or object reference.
>

That's because you didn't check what OpenTextFile returned to you before
using it.  I'm guessing it's "undef".

>Does someone know what I'm doing wrong.
>

Well, you are using Micro$oft products...  :-)

Richard.
-- 
Richard Bellavance            |
                              |  "Rien n'est plus imminent que l'impossible."
charlot@cam.org               |        - Victor Hugo
http://www.cam.org/~charlot/  |



------------------------------

Date: Mon, 06 Jul 1998 14:09:29 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl At Work
Message-Id: <35A0DC72.816@min.net>

epierre@mail.esiea.fr wrote:
> And long Live to the Perl Republic !

    What did Bill Gates say as they were leading him to the guillotine?

-- 
John Porter


------------------------------

Date: 6 Jul 1998 15:55:51 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl At Work
Message-Id: <6nqs27$a6f$1@marina.cinenet.net>

John Porter (jdporter@min.net) wrote:
: epierre@mail.esiea.fr wrote:
: > And long Live to the Perl Republic !
: 
:     What did Bill Gates say as they were leading him to the guillotine?

I don't know, but someone in the crowd yelled "Digital Research, thou art
avenged!" :-)

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


------------------------------

Date: Mon, 06 Jul 1998 12:19:16 GMT
From: el@fiz-karlsruhe.de (Edwin Litterst)
Subject: perl calling C calling perl again
Message-Id: <35a0bf10.22465171@news>

Hi,

I just wrote a small C library which implements some functionality by
calling some perl functions.
This works really nice as long these functions are called from C.
But when I am using the same C library and call these functions from
perl (using xs) then some strange problems appear:
perl_alloc and perl_construct work as expected, but after calling
perl_parse some of my variables are overwritten (in this case the
arguments to the function).
I also get the error messages:
Global symbol "stdin" requires explicit package name at bass.pl line
21.
Global symbol "stdout" requires explicit package name at bass.pl line
21.
Global symbol "stderr" requires explicit package name at bass.pl line
21.

Because this only appreas when the function is called from perl I
assume that there might be some problems between the two perl
instances.
I searched in the doc and online but couldn't find any information
about that.
Does anyone know what happens there and what I could do?

Thanks in advance,
Eddie

PS: I have to do it this way because of protability issues and code
reuse. ;-)



------------------------------

Date: 06 Jul 1998 20:02:29 -0400
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: PERL code in browser instead of page
Message-Id: <m37m1q5y0a.fsf@peach.z.org>

crusader@bilbo.ShireNet.com (Scott Cherkofsky) writes:

> Why is this happening?

Because you're not returning a content-type header of text/html, I'd
guess. Are you not using the print_header() method in CGI.pm?

Jeremy
-- 
Jeremy D. Zawodny                   Web Geek, Perl Hacker, etc.
http://www.wcnet.org/~jzawodn/      jzawodn@wcnet.org

LOAD "LINUX",8,1


------------------------------

Date: 6 Jul 1998 13:32:59 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: Perl for BS2000?
Message-Id: <6nqjmb$74p$1@bsdti6.sdm.de>

Is there a port of Perl for the BS2000 (mainframe Siemens/Nixdorf) operating
system, or does Perl compile on it using a C compiler?

Thanks a lot for any info!

Yours,
-- 
    Steffen Beyer <sb@engelschall.com>
    Free Perl and C Software for Download: www.engelschall.com/u/sb/download/


------------------------------

Date: 06 Jul 1998 18:44:28 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Perl for BS2000?
Message-Id: <oee1zrzx9ur.fsf@alpha.hut.fi>


Steffen Beyer <sb@sdm.de> writes:

> Is there a port of Perl for the BS2000 (mainframe Siemens/Nixdorf) operating

Not that I know of.

> system, or does Perl compile on it using a C compiler?

Please try and tell us. :-)

> Thanks a lot for any info!

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


------------------------------

Date: Mon, 06 Jul 1998 15:16:54 -0700
From: Don Mierzeski <donm@statsci.com>
Subject: Perl Modules for NT
Message-Id: <35A14CD6.85F2632F@statsci.com>

Does anyone know if the Perl Modules exists for NT?  In particular I'm
using the ctime module and the ftp module.

Thanks
Don Mierzeski
donm@statsci.com




------------------------------

Date: Mon, 6 Jul 1998 19:27:04 GMT
From: Ward Kaatz <ward.kaatz@pss.boeing.com>
Subject: Re: Perl on MVS?
Message-Id: <35A12508.4443@pss.boeing.com>

Pho Van Son wrote:

> Hi friends,
> 
> Has been Perl ported on MVS?
> Any pointers?

if your MVS implementation has Unix System Services available
(prerequisite to running the IBM webserver and domino products) then
you  can use perl.   I don't think perl will work in the TSO environment
at all (I should say I haven't seen of heard of it being used in that
environment).

> In fact, i am looking for a scripting language that i can use to test 

while perl is "better", REXX is always available on MVS and it is
certainly very useful for such work.  REXX is also extremely easy to
grasp and be productive with in a short time.

hope this helps,
Ward Kaatz


------------------------------

Date: 6 Jul 1998 14:25:03 GMT
From: beatle@arches.uga.edu (Benjamin Dixon)
Subject: Perl strchr?
Message-Id: <6nqmnv$f1q$1@cronkite.cc.uga.edu>

Is there a standard perl function that'll let me match a certain specific
character in a give nstring of text? I've tried quotemeta but it matches
every special character, I only want to match one specific character (').
I also looked into s/ but I couldn't get it to act right either. I know
this is a pretty lame question but I've looked through all the man pages
and not come up with any good results. A pointer in the right direction
would help a lot. Thanks.

Ben
-- 
******************************************************************************
Benjamin R. Dixon, jr.				"It was an age of Empires.
UCNS Student Consultant				 So is this one, not all
http://www.arches.uga.edu/~beatle		 that well disguised."
beatle@arches.uga.edu						-Vonnegut

------------------------------------------------------------------------------


------------------------------

Date: Mon, 06 Jul 1998 16:03:00 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Perl strchr?
Message-Id: <35A0E724.2384C06F@nortel.co.uk>

Benjamin Dixon wrote:
> 
> Is there a standard perl function that'll let me match a certain specific
> character in a give nstring of text? 

I am not sure what the problem is, but this works:

$_= "Don't yooouu forget about me, don't, don't, don't, don't, dooon't you...";
s/n'/ no/g;
print $_;

Gives:
Do not yooouu forget about me, do not, do not, do not, do not, dooo not you...

Just to bugger up a great song :)
-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


------------------------------

Date: Mon, 06 Jul 1998 11:31:43 -0400
From: Jonathan Epstein <Jonathan_Epstein@nih.gov>
To: Benjamin Dixon <beatle@arches.uga.edu>
Subject: Re: Perl strchr?
Message-Id: <35A0EDDF.68BE375@nih.gov>

In general, if you're not using pattern-matching then there's a good
chance that you're not using the correct approach in PERL.

However, the "index" function may do what you want.  Note that for many
Unix C libraries, index() and strchr() are interchangable, where the
former name is still supported for historical reasons.  Looks like PERL
got stuck with the older naming convention.

- Jonathan

Benjamin Dixon wrote:
> 
> Is there a standard perl function that'll let me match a certain specific
> character in a give nstring of text? I've tried quotemeta but it matches
> every special character, I only want to match one specific character (').
> I also looked into s/ but I couldn't get it to act right either. I know
> this is a pretty lame question but I've looked through all the man pages
> and not come up with any good results. A pointer in the right direction
> would help a lot. Thanks.
> 
> Ben
> --
> ******************************************************************************
> Benjamin R. Dixon, jr.                          "It was an age of Empires.
> UCNS Student Consultant                          So is this one, not all
> http://www.arches.uga.edu/~beatle                that well disguised."
> beatle@arches.uga.edu                                           -Vonnegut
> 
> ------------------------------------------------------------------------------


------------------------------

Date: Mon, 6 Jul 1998 15:52:55 +0100
From: "Simon Fairey" <simonf@conduit.co.uk>
Subject: Re: Perl strchr?
Message-Id: <35a0e406.0@nnrp1.news.uk.psi.net>

You want regular expressions and the match ( m// ) operator. I think perlre
is the man page you want, i.e:

$string = 'something with something you want to match in';

if( $string =~ m/match/ ) {
  print "Found a match\n";
} else {
  print "No match found\n";
}

This is a very simplistic example but if all you want to do is match a bit
of text then this will do the job, if you want proper strchr() emulation
 i.e. the exact position of the match ) you probably want to use the pos()
function ( see perlfunc ). Essentially it all hinges on what you want to do,
processes any string which matches, extract the necesary bit from strings
based on some fancy regular expression or just get the position in the
string where the match occurs.

Simon

Benjamin Dixon wrote in message <6nqmnv$f1q$1@cronkite.cc.uga.edu>...
>Is there a standard perl function that'll let me match a certain specific
>character in a give nstring of text? I've tried quotemeta but it matches
>every special character, I only want to match one specific character (').
>I also looked into s/ but I couldn't get it to act right either. I know
>this is a pretty lame question but I've looked through all the man pages
>and not come up with any good results. A pointer in the right direction
>would help a lot. Thanks.
>
>Ben
>--
>***************************************************************************
***
>Benjamin R. Dixon, jr. "It was an age of Empires.
>UCNS Student Consultant So is this one, not all
>http://www.arches.uga.edu/~beatle that well disguised."
>beatle@arches.uga.edu -Vonnegut
>
>---------------------------------------------------------------------------
---




------------------------------

Date: Mon, 06 Jul 1998 16:38:12 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl strchr?
Message-Id: <35A0FF4E.101@min.net>

Jonathan Epstein wrote:
> 
> In general, if you're not using pattern-matching then there's a good
> chance that you're not using the correct approach in PERL.

Right on.


> However, the "index" function may do what you want.  Note that for many
> Unix C libraries, index() and strchr() are interchangable, where the
> former name is still supported for historical reasons.  Looks like PERL
> got stuck with the older naming convention.

Nope.  Whereas C's index() is functionally equivalent to strchr(),
Perl's index() is more like C's strstr().  Check it out.

-- 
John Porter


------------------------------

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 3070
**************************************

home help back first fref pref prev next nref lref last post