[7264] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 889 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 19 10:17:42 1997

Date: Tue, 19 Aug 97 07:00:38 -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           Tue, 19 Aug 1997     Volume: 8 Number: 889

Today's topics:
     Re: 100 links limit for free for all & books "Programmi (felix k sheng)
     Re: about using CGI.pm (Honza Pazdziora)
     Re: about using CGI.pm <zenin@best.com>
     Re: about using CGI.pm (Honza Pazdziora)
     Re: Cookie...... (Abigail)
     Creating a socket connection with PERL <fazal@cisusa.net>
     dataTRAK - Free Java Meta-Search Engine <alastair@net7.co.uk>
     Re: Formatting strings <petri.backstrom@icl.fi>
     Re: Formatting strings (robert)
     Freelance help needed. <tomh@cyberzine.org>
     Re: how can I read compressed files in perl (Paul Marquess)
     how to solve this parse problem? <xuchu@iscs.nus.edu.sg>
     How to use the "main::" namespace? (Michael Kichanov)
     Re: incredibly simple question <eike.grote@theo.phy.uni-bayreuth.de>
     Looking for Contest CGI (Jerry )
     Passing multiple arrays to subroutine ??? <jim.blackwell@gsfc.nasa.gov>
     Perl Win95 mudd97@nac.net
     Re: Perl Win95 (Nic Gibson)
     Re: Perl5 & Personal Web Server <Klaus.Wolf@arcor.net>
     Re: Q: assoc. arrays as subroutine argument <sfairey@adc.metrica.co.uk>
     Q: Problems with PerlIS and creation of DBM files <khown@imap1.asu.edu>
     Re: Seeking object enlightenment (Terje Bless)
     Re: Seeking object enlightenment <seay@absyss.fr>
     Re: shift <rra@stanford.edu>
     Re: Slick way to return everything within matching pare (Dean Inada)
     Re: split perl string <mystery@itis.com>
     Re: What is the constant of the universe (Terje Bless)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 19 Aug 1997 13:41:14 GMT
From: felix@chance.em.nytimes.com (felix k sheng)
Subject: Re: 100 links limit for free for all & books "Programming Perl
Message-Id: <slrn5vj8jn.akc.felix@chance.em.nytimes.com>

On Sat, 16 Aug 1997 10:48:39 +0200, Aitor <webmaster@dmedia.net> wrote:
>The script  insert in the page for each link added: 
>
>print FILE "<LI><a href=\"$url\">$sitename</a><br>\n";
>print FILE "$descript<br>\n";
>
>Last link added gets first.
>
>If I add for example    <!--end of links-->   just the next after the
>oldest link added.
>
>How can I delete the two lines before <!--end of links--> (that's the
>URL and description of the oldest link) when a new link is added? 

well you could keep a two line buffer before you print out anything,
and if the third line is your end of links line then that's it, and
if it is another link print out the buffer and start storing a new
one.  or you could just keep a count as you go through your file,
and when you hit 100 don't print out any more links.  hope that
helps.

>Also I can't get working the sendmail. Proved with \ and without it in
>the e-mail.
>
>$mailprog = "/usr/sbin/sendmail";
>$my_email = 'webmaster\@dmedia.net';
>
>sub sendmail {
>open(MAIL, "| $mailprog -t") || die "I can't open $mailprog\n";
>	print MAIL "To: $my_name <$my_email>\n";
>	print MAIL "From: SuperLinks\n";
>	print MAIL "Subject: Someone added a link\n";
>	print MAIL "The following URL was added to your add link page\n";
>	print MAIL "title: $sitename URL: $url\n";
>	print MAIL "Description: $descript\n";
>close(MAIL);
>		}

hmm.. the \n in the subject line should probably be \n\n to put
a blank line between the end of the headers and the beginning of
the body of you message.. but i'm not sure what symptoms you are
getting when you say you can't get it working.. does it bounce?
does it just not do anything?  you might want to try something like:

open(MAIL, "| $mailprog -tv > somefile") || die "I can't open $mailprog\n";

and then look at somefile afterwards and see if that turns up
anything.

good luck.

'lx

--- felix sheng                                       pager     800 979 2171
 programmer                                           tel       212 597 8069
 the new york times electronic media company          e    felix@nytimes.com


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

Date: Tue, 19 Aug 1997 09:39:12 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: about using CGI.pm
Message-Id: <adelton.871983552@aisa.fi.muni.cz>

Car'a'carn <yinso@secure.global-sight.com> writes:

Few typos:

> #!/usr/local/bin/perl5
  #!/usr/local/bin/perl5 -w
  #			^^^^ always use -w

  use strict;
  # alway use use strict
> 
> use CGI;
> 
> $query = new CGI;
> 
> print $query->header;
> print $query->start_html("Example Code");
> print $query->startform;
> print "<h1>Show me this script is working.</h1>\n";
> print "<b>What's your name? </b> $query->textfield('name')\n";
  print "<b>What's your name? </b>", $query->textfield('name'), "\n";
  #				   you cannot put the method
  #				invocation inside the string

> print "<b>query->submit('action', 'submit');
  print $query->submit('action', 'submit');
  #     you probably want to call the sumbit method

> print $query->endform;
> print $query->end_html;

__END__

Now, on command line it should print (offline mode: enter name=value
pairs on standard input) and wait for your input, for example

name=jezek
^D

and on server it should run just fine.

Hope this helps!

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
    European RC5 56 bit cracking effort -> http://www.cyberian.org/


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

Date: 19 Aug 1997 10:17:36 GMT
From: Zenin <zenin@best.com>
Subject: Re: about using CGI.pm
Message-Id: <5tbrs0$iah$1@nntp2.ba.best.com>

Honza Pazdziora <adelton@fi.muni.cz> wrote:
> Few typos:
> > #!/usr/local/bin/perl5
>   #!/usr/local/bin/perl5 -w
>   #			^^^^ always use -w

	I must disagree here.  For production CGI -w should NEVER be
	left on the script.  The reason being something as "simple" as
	a perl upgrade can then break your entire site by spitting out
	new warnings and causing the web server to choke on the stderr.
	Even if you use the CGI::Carp module, you still don't want
	users seeing what is probably a harmless warning.  It could even
	contain enough information to be a secruity risk.

-- 
-Zenin
 zenin@best.com


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

Date: Tue, 19 Aug 1997 11:44:55 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: about using CGI.pm
Message-Id: <adelton.871991095@aisa.fi.muni.cz>

Zenin <zenin@best.com> writes:

> Honza Pazdziora <adelton@fi.muni.cz> wrote:
> > Few typos:
> > > #!/usr/local/bin/perl5
> >   #!/usr/local/bin/perl5 -w
> >   #			^^^^ always use -w
> 
> 	I must disagree here.  For production CGI -w should NEVER be
> 	left on the script.  The reason being something as "simple" as
> 	a perl upgrade can then break your entire site by spitting out
> 	new warnings and causing the web server to choke on the stderr.
> 	Even if you use the CGI::Carp module, you still don't want
> 	users seeing what is probably a harmless warning.  It could even
> 	contain enough information to be a secruity risk.

My point was that new CGI.pm user should try hard to keep his scripts
as clean as possible. Stderr goes to error log and warnings are here
to be read. And I think that it is higher security risk to run without
-w than with it, especially on cgi.

Cheers,

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
    European RC5 56 bit cracking effort -> http://www.cyberian.org/


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

Date: Tue, 19 Aug 1997 04:07:39 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Cookie......
Message-Id: <EF57Gs.JsG@nonexistent.com>

John Devlin (devli002@gold.tc.umn.edu) wrote on 1448 September 1993 in
<URL: news:<33F8BDA6.ADD@gold.tc.umn.edu>>:
++ How do I get the cookie in Perl?


#!/usr/bin/perl -w

use strict;

package Cookie;

sub chocolate () {
    my $class = shift;
    my $self  = {};
    $self -> {style} = shift;
    bless $self, $class;
}

sub milk () {
    print "Have a cookie!\n";
}

package main;

my $cookie = Cookie -> chocolate ("chip");

$cookie -> milk;


__END__
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: Mon, 18 Aug 1997 22:45:53 -0500
From: Fazal Mehmood Awan <fazal@cisusa.net>
Subject: Creating a socket connection with PERL
Message-Id: <33F916F1.3F1@cisusa.net>

Can someone please help me! I have this source code to create a socket,
bind it, and connect it.  But it doesn't work, it gives me the following
output:

socket ok
bind ok
Address Family not supported by Protocol Family.

Here is the source:

#!/usr/bin/perl

($them,$port) = @ARGV;
$port = 2345 unless $port;
$them = 'localhost' unless $them;

$SIG{'INT'} = 'dokill';
sub dokill {
    kill 9,$child if $child;
}
use Socket;

$sockaddr = 'S n a4 x8';

chop($hostname = `\bin\hostname`);

($name,$aliases,$proto) = getprotobyname('tcp');
($name,$aliases,$port) = getservbyname($port,'tcp')
      unless $port =~ /^\d+$/;
($name,$aliases,$type,$len,$thisaddr) =
      gethostbyname($hostname);
($name,$aliases,$type,$len,$thataddr) = gethostbyname($them);

$this = pack($sockaddr, &AF_INET, 0, $thisaddr);
$that = pack($sockaddr, &AF_INET, $port, $thataddr);

if (socket(S, &AF_INET, &SOCK_STREAM, $proto)) {
   print "socket ok\n";
}
else {
     die $!;
}

if (bind(S,$this)) {
    print "bind ok\n";
}
else {
     die "$!\n";
}

if (connect(S,$that)) {
   print "connect ok\n";
}
else {
     die "$!\n";
}

select(S); $| = 1; select(STDOUT);

if ($child = fork) {
   while (<STDIN>) {
         print S;
   }
   sleep 3;
   do dokill();
}
else {
     while(<S>) {
          print;
     }
}

Can someone please tell me what is wrong with this, I can't figure it
out! 

Patrick O'lone
polone@sanasys.com


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

Date: Tue, 19 Aug 1997 14:16:34 +0100
From: Alastair Todd <alastair@net7.co.uk>
Subject: dataTRAK - Free Java Meta-Search Engine
Message-Id: <33F99CB2.EA01B19@net7.co.uk>

This is a multi-part message in MIME format.
--------------CC60A9CBE3C1B1248450ED72
Content-Type: text/plain; charset=us-ascii
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Transfer-Encoding: 7bit

Digitally Certified (breaks Java applet sandbox) ready for beta test
on-line. Search the world's top 9 search engines simulateneously through

one intuitive interface.

Multi-threaded, dataTRAK returns 9 times as many results from 9 seperate

loactions in the time it takes your usual search engine to retrieve one
set.

Download and run real-time now for free (100k):

http://www.net7.co.uk/dataTRAK/Trakker.htm

You'll need IE3.02 or above, or Netscape Communicator.
--
Alastair R. Todd,
System's Development Manager,
Net7 Limited
http://www.net7.co.uk/


--------------CC60A9CBE3C1B1248450ED72
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Alastair Todd
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Alastair Todd
n:              Todd;Alastair
org:            Net7 Limited
adr:            Technology Drive;;Grange Road;Batley;West Yorkshire;WF17 6ER;UK
email;internet: alastair@net7.co.uk
title:          System's Development Manager
tel;work:       +44 (0)1924 444007
tel;fax:        +44 (0)1924 445507
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
end:            vcard


--------------CC60A9CBE3C1B1248450ED72--



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

Date: Tue, 19 Aug 1997 07:51:15 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: Formatting strings
Message-Id: <33F92643.2DB5@icl.fi>

Kevin J. Lin wrote:
> 
> I can't seem to find this in the FAQ, although it's probably in there
> somewhere.  What's the best way to print a string to a fixed-formatted
> length? That is, fill in white space if it's too short, truncate if it's
> too long?

The Perl docs are quite terse regarding this, but look up 
sprintf and printf in the Perl docs, and then do the same 
in the docs for a C-compiler (might be on your system 
already).

Try, e.g., these with your own data, to see the
effect:

    $newvar = sprintf( "%20s", $oldvar );
    $newvar = sprintf( "%-20s", $oldvar );

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


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

Date: 19 Aug 1997 10:48:03 +0200
From: robert@ICK.il.fontys.nl (robert)
Subject: Re: Formatting strings
Message-Id: <5tbmk3$av@bsd1.hqehv-internal.ilse.net>

klin@wx3.com:
 >I can't seem to find this in the FAQ, although it's probably in there
 >somewhere.  What's the best way to print a string to a fixed-formatted
 >length? That is, fill in white space if it's too short, truncate if it's
 >too long?

Check out printf. 

To right-pad with spaces: printf("%-10s\n", $somestring)
To left-pad with spaces : printf("%10s\n", $somestring)
To chop                 : printf("%.10s\n", $somestring)

This chops or pads so the outputted string will be 10 characters long.

                                                                    robert


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

Date: 19 Aug 1997 13:49:39 GMT
From: "Tom Hicks" <tomh@cyberzine.org>
Subject: Freelance help needed.
Message-Id: <01bcaca7$39fc8e60$fc19fecc@tomh>

Hi,

The CyberQueer Lounge/Backroom
http://www.cyberzine.org
Backroom
http://www.cyberzine.org/html/GLAIDS/Backroom/login.html
needs periodic PERL/CGI help.

If you want look at the Backroom at the above login.html using:
HANDLE:Guest
Password:Guest
SECTION:Bisexual

By peeking you can get a small glimpse of the setup.


Currently the Backroom directory.cgi/chat nph.client combination need a
little bit of attention in PERL.
	1. Private and public chat messages need to be directed properly.  
Messages deliver with each section such as men to men.  But do NOT deliver
across sections such as men to bisexual.

Need responsible knowledeable creative periodic help with problems and
ideas I would like to implement.

If you have interest in this contact 
Tom Hicks
tomh@cyberzine.org

Thanks for your time.



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

Date: 19 Aug 1997 08:10:26 GMT
From: pmarquess@bfsec.bt.co.uk (Paul Marquess)
Subject: Re: how can I read compressed files in perl
Message-Id: <5tbkdi$277$1@pheidippides.axion.bt.co.uk>

Paul Marquess (pmarquess@bfsec.bt.co.uk) wrote:
: [Posted & Mailed]

: Bob Hannaford (bobh@metrica.co.uk) wrote:
: : I am writting an application that needs to handle files compressed
: : by the standard unix compress command and possible by 'gzip'.

: : I have found the alpha version of a perl extension Compress::Zlib-0.50
: : and successfully uncompressed 'gzip' files, does it also handle files
: : compressed with the standard unix compress.  If so how do I do it?  I 
: : have not been able to.

: Nope. Compress::Zlib can only read gzip files.

: : If Compress::Zlib-0.50 doesn't handle files compressed by the standard
: : unix compress, what is a good way of doing the uncompress from perl?
: : (Other than forking a process using the 'system' function which I will
: : resort to, if all else fails.)

: try

:     open(F, "uncompress $file|") ;

That should be "uncompress -c $file|" .

:     while (<F>) {
: 	...
:     }
:     close F ;

Paul


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

Date: 19 Aug 1997 10:10:23 GMT
From: Xu Chu <xuchu@iscs.nus.edu.sg>
Subject: how to solve this parse problem?
Message-Id: <5tbref$7jb@nuscc.nus.sg>

hi, i am using the HTML::Parser to do some parse work. so  if i set the $tag to 'a' then i cant distinguish between the following two links:
	1. <a href="http://www.abc.com/">abc</a>
	2. <a href="http://www.abc.com/" target="other">abc</a>
all that i want is to extract http://www.abc.com ONCE only and NO that other. anyone can help me out? 
Many thanks.

-- 
wings
------
You cannot learn anything unless you almost know it already.



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

Date: 19 Aug 1997 09:05:32 GMT
From: mike@mix.nordlink.ru (Michael Kichanov)
Subject: How to use the "main::" namespace?
Message-Id: <5tbnks$rco$1@Ra.nordlink.ru>

Hi, All!

Please clear up me. How I can use the "main" namespace
in other namespaces without "main::" reference?

Example:

File main.pl contains:
-----
#!/usr/local/bin/perl

$global_var = "somedata";
sub GlobalSub { some code }

require "pack.pl";
-----
File pack.pl contains:
-----
package OtherPack;

&GlobalSub;
print $global_var;
-----

"&main::GlobalSub" and "print $main::global_var" works fine,
but "&GlobalSub" and "print $global_var" doesn't work :(

How i can call function GlobalSub and refer to variable $global_var in
module OtherPack without "main::" prefix?

10x in advance!
mike


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

Date: Tue, 19 Aug 1997 09:20:57 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: incredibly simple question
Message-Id: <33F94959.4287@theo.phy.uni-bayreuth.de>

Hi,

Philip A. Viton wrote:
> 
> print STDERR "\nPlease answer Y or N: ";
> $resp=<STDIN>;
> if ($resp = ~ /^[yY]+/)
            ^^^
            this must be ONE operator: =~

>   { print STDERR "Your response was Y\n" }
>   else
>   {print STDERR "Your response wasn't Y\n" }


Bye, Eike
-- 
======================================================================
 Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
----------------------------------------------------------------------
 e-mail -> eike.grote@theo.phy.uni-bayreuth.de
 WWW    -> http://www.phy.uni-bayreuth.de/theo/tp4/members/grote.html 
           http://www.phy.uni-bayreuth.de/~btpa25/
======================================================================


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

Date: Mon, 18 Aug 1997 23:41:03 -0700
From: nospam-jerryl@pacificnet.net (Jerry )
Subject: Looking for Contest CGI
Message-Id: <33fb3fa6.9753574@news.supernews.com>

I'm looking for a Contest CGI written either in Perl or ASP.  This is
different than the Quiz CGI's that are around, that have multiple choice
questions and grade you once you answer the questions.  The Contest CGI
should ask for name and email, and then answer one or more questions with
text input.  The answers would be stored in a database until a certain date
and time and then the winners would be determined.  A good example is at
the http://www.dujour.com/riddle/ site.  Anyone know if anything like that
exists that is freeware or for a small price tag?

Thanks,
Jerry


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

Date: Tue, 19 Aug 1997 08:49:31 -0400
From: "James H. Blackwell" <jim.blackwell@gsfc.nasa.gov>
Subject: Passing multiple arrays to subroutine ???
Message-Id: <33F9965B.41C6@gsfc.nasa.gov>

Hi all,

Before I go completely gaa gaa, I thought I'd ask the question in hopes
that someone can help me.

I have a subroutine that gets passed to it a number of arrays.

my_routine(@arr1, @arr2, @arr3)

In the subroutine, I do this:

sub my_routine {

  my (@ar1, @ar2, @ar3) = @_;

 ...


However, all the values go into @ar1.  I have tried a number of
things like

my_routine(\@arr1, \@arr2, \@arr3)

How does one get these three arrays passed to a subroutine properly ?

In a nutshell, what is the proper, or is there a proper way to do
this sort of thing ?  Am using latest Perl.

Please send email to jim.blackwell@gsfc.nasa.gov

Thanks


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

Date: Tue, 19 Aug 1997 01:15:50 -0400
From: mudd97@nac.net
Subject: Perl Win95
Message-Id: <33F92C06.3EB0@nac.net>

I am trying to test perl stuff on PWS on win95. I can't get anything
going.
Not even the "helloworld.pl" script. I set my scripts directory to
execute and not read but it forbids read-access.
I added .pl to my registry and the associations in win95. When I click
on the .pl file a DOS windows comes up and executes the script and then
disappears. Can anyone please help.
Thanks in advance
mudd97@nac.net


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

Date: 19 Aug 1997 13:13:26 GMT
From: nic@cocoon.co.uk (Nic Gibson)
Subject: Re: Perl Win95
Message-Id: <slrn5vj6sb.je2.nic@larvae.cocoon.co.uk>

On Tue, 19 Aug 1997 01:15:50 -0400, mudd97@nac.net <mudd97@nac.net> wrote:

>I am trying to test perl stuff on PWS on win95. I can't get anything
>going.

No, you're not. You're trying to test perl cgi stuff on win95.
Admit it :)

>Not even the "helloworld.pl" script. I set my scripts directory to
>execute and not read but it forbids read-access.

Now, I *know* that you're trying to do cgi.

>I added .pl to my registry and the associations in win95. When I click
>on the .pl file a DOS windows comes up and executes the script and then
>disappears. Can anyone please help.

Learn about how to set up cgi scripts with whatever web server you're
using. This is definitely a question about cgi, not perl. If you want
to ask questions about this, try one of the ms newsgroups (I just noticed
the PWS bit). Alternatively, try somewhere in comp.infosystems.www....

Is it my imagination or does someone ask this question about once a week?
I know it doesn't help that there are no useful docs with pws but...

Nic
(screaming and irritable)
-- 
Nic Gibson, Senior Programmer, VFM(UK) Ltd.
http://www.global-strategist.com/
Email: nic@global-strategist.com
Phone: 0171 831 7704 Mobile: 0976 408436


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

Date: Tue, 19 Aug 1997 10:27:49 +0200
From: Klaus Wolf <Klaus.Wolf@arcor.net>
Subject: Re: Perl5 & Personal Web Server
Message-Id: <33F95905.7BBBE6AA@arcor.net>

Brian Moffatt wrote:

> I installed PWS and I am brand new at Perl. How do I install it so I
> can
> test CGI's
> Thank you.


I also tried to use that Personal Web Server stuff but I didn't have
success because it seems to be there's no documentation for that package
at all.
Now I'm using Netscapes FastTrack server 2.0 for Windows 95, which is
more complex but everything works fine including Perl CGI-scripts. The
beta version is free for download from netscapes Web-site.



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

Date: Tue, 19 Aug 1997 10:48:14 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
Subject: Re: Q: assoc. arrays as subroutine argument
Message-Id: <33F96BDE.2781@adc.metrica.co.uk>

Benjamin Sugars wrote:
> 
> Simon Fairey wrote:
> 
> > Try looking at the perlref man page. Essentially what you want is
> > something like the following:
> >
> > sub ascii2html {
> >   my $hashref = shift;
> >
> >   foreach $wert ( %$hashref ) {
> >     print "Key = $wert, Value = $$hashref{$wert}\n";
> >   }
> >   return;
> > }
> >
> > ascii2html(\%data);
> 
> Except that in your example you're iterating through both the keys and
> values of the hash.  Presumably you meant to write something like this:
>     ...
>     foreach $wert (keys %$hashref) {
>         ...
>     }
> 
> -Ben
> 
> --
> Ben Sugars <bsugars@canoe.ca>
> Senior Webmaster,
> CANOE Canadian Online Explorer,
> http://www.canoe.ca/

Oops, I noticed that whilst typing and thought I must go back and change
that but I completely forgot....

Simon


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

Date: Mon, 18 Aug 1997 23:09:40 -0700
From: Otis Nettles <khown@imap1.asu.edu>
Subject: Q: Problems with PerlIS and creation of DBM files
Message-Id: <33F938A4.9E687C16@imap1.asu.edu>

Hi,

I'm having some trouble using PerlIS and dbm files together.  For some
reason, if I try to specify an absolute path, the get the error, no such
file or directory, even if the directory exists.  If I do not provide a
path at all, but just the name for the dbm file, it gets create in the
winnt\system32 directory.  Any ideas on why this is happening, and what
I can do about it?  By the way, my cwd is NOT this directory.  Also,
it's very curious that an absolute path is not working.  The same exact
scripts will work via cgi and perl.exe, allowing me to specify the
absolute path to the dbm file.


-- 
Otis Nettles
Interactive Applications
otis77@hotmail.com
(602) 786 - 3224


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

Date: Tue, 19 Aug 1997 06:28:52 +0200
From: link@tss.no (Terje Bless)
Subject: Re: Seeking object enlightenment
Message-Id: <link-1908970628520001@news.uit.no>

In article <33f4824a.3389971@news.tornado.be>,
    bart.mediamind@tornado.be (Bart Lateur) wrote:

>Call me stupid, but I don't understand why this is called "to bless".

Isn't that obvious?
It was, of course, named after me because I'm such a nice guy. :-)

-- 
Party? Party, lord? Yes, lord. Right away, lord.
        - Beopunk Cyberwulf


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

Date: Tue, 19 Aug 1997 14:48:59 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Seeking object enlightenment
Message-Id: <33F9963B.8AA7E95@absyss.fr>

Terje Bless wrote:
> 
> In article <33f4824a.3389971@news.tornado.be>,
>     bart.mediamind@tornado.be (Bart Lateur) wrote:
> 
> >Call me stupid, but I don't understand why this is called "to bless".
> 
> Isn't that obvious?
> It was, of course, named after me because I'm such a nice guy. :-)

Wow, someone who is more full of themself than I am.  I'm impressed.

- doug


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

Date: 18 Aug 1997 20:59:25 -0700
From: Russ Allbery <rra@stanford.edu>
To: Bill Ravdin <ravdin@vantisintl.com>
Subject: Re: shift
Message-Id: <m3203q961u.fsf@windlord.Stanford.EDU>

Bill Ravdin <ravdin@vantisintl.com> writes:

> It's my understanding that it undefines the array if there's only one
> element in it (at least that's what it says in the Camel book.)

> The problem is, the interpreter doesn't seem to be doing this properly.
> If I start out with five or more elements in the array, no problem- my
> program works the way I expect it to.  However, if I start with four or
> fewer elements in the array, shift fails to undefine, causing all kinds
> of problems.

>From man perlfunc:

             You may also use defined() to check whether a
             subroutine exists.  On the other hand, use of
             defined() upon aggregates (hashes and arrays) is not
             guaranteed to produce intuitive results, and should
             probably be avoided.

[snip]

             Currently, using defined() on an entire array or
             hash reports whether memory for that aggregate has
             ever been allocated.  So an array you set to the
             empty list appears undefined initially, and one that
             once was full and that you then set to the empty
             list still appears defined.  You should instead use
             a simple test for size:

                 if (@an_array) { print "has array elements\n" }
                 if (%a_hash)   { print "has hash members\n"   }

             Using undef() on these, however, does clear their
             memory and then report them as not defined anymore,
             but you shoudln't do that unless you don't plan to
             use them again, because it saves time when you load
             them up again to have memory already ready to be
             filled.

             This counterintuitive behaviour of defined() on
             aggregates may be changed, fixed, or broken in a
             future release of Perl.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 19 Aug 1997 06:48:29 GMT
From: dmi@delta1.deltanet.com (Dean Inada)
Subject: Re: Slick way to return everything within matching parens
Message-Id: <5tbfjt$m9f$1@news01.deltanet.com>

In article <5t9sg9$l66@spool.cs.wisc.edu> horn@beaner.cs.wisc.edu (Jeffrey Horn) writes:
>I am looking for a way to match everything within parens starting from
>the first open paren "(" and going through the matching closing
>paren ")".
(n.b. the question didn't specify using only the perl re match engine
without the perl re compiler:-)
(is there even a way to invoke one without the other?)
>
>For instance I want an input string like "(x+7*(a+b/c)+y*(x-y))-7" to
>return "(x+7*(a+b/c)+y*(x-y))" instead of just "(x+7*(a+b/c)" which is
>what I get if I just use \) in a pattern match.  I've written a routine
You mean, if you just use
	$_ = "(x+7*(a+b/c)+y*(x-y))-7";
	print /(\(.*\))/;
?

But that won't work for
	$_ = "(x+7*(a+b/c)+y*(x-y))-(7)";

so perhaps you'd prefer something like:
	($re = $_) =~ s/(\()|(\))|./$1.$2/gs;
	print ((/$re/s)[0]);

And if you want to be able to return "(x+7*(a+b/c)+y*(x-y))" even on
such malformed input strings like "(x+7*(a+b/c)+y*(x-y))-)7(",
it's not hard to handle those cases too...

>which goes through character by character counting the number of parens
>open and closed and terminating when the difference goes to zero.
(Or you could parse it yourself that way:-)



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

Date: Tue, 19 Aug 1997 07:41:35 -0400
From: Prince Mystery <mystery@itis.com>
Subject: Re: split perl string
Message-Id: <33F9866F.6E1C1F51@itis.com>

Danny LaPrade wrote:
> 
> How do I split at string like
> 
> "here1here2here3here4here5here6here7"
> 
> every 5th character?
> 
> And all are char (s).
> 
> I want to be able to take this string
> and split it every five chars and the string
> can be anywhere from 0 to 100 chars long.
> Also want to be able to compare each to a string.
> 
> Can anyone help ?
> Need something efficient.

Danny,

how about...

$line = "here1here2here3here4"; # and so forth
@outArray = $line =~ m/(.{4})./g;
foreach (@outArray) {
	print "Voila!" if($_ eq $stringToCompare);
}

Myst

-- 

Version: 2.6.2

owEBiAB3/4kAdQMFADPY9d1hGXgCUdEssQEBvREDAJodjyXMMZnOxrzl6Z5Anldh
p/mCNLshfYr/aLB+vmR2CrdySGCqBZFg+GanInyn/Vg6oRNoLgM/sU5+sbYntGt1
nI2B8/PZIDxOTA3S6BktLawONN/RGcqjPhDPm8l636wOYgh0ZXh0ZmlsZQAAAAA=
=beaq
-----END PGP MESSAGE-----


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

Date: Tue, 19 Aug 1997 06:36:28 +0200
From: link@tss.no (Terje Bless)
Subject: Re: What is the constant of the universe
Message-Id: <link-1908970636280001@news.uit.no>

42, HTH. :-)

-- 
Party? Party, lord? Yes, lord. Right away, lord.
        - Beopunk Cyberwulf


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

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

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