[7231] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 856 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 12 22:08:03 1997

Date: Tue, 12 Aug 97 19:00:25 -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, 12 Aug 1997     Volume: 8 Number: 856

Today's topics:
     Re: any SMTP servers require domain name <kjj@pobox.com>
     Re: Comparing Text <rra@stanford.edu>
     Duping STDOUT to a IO::Socket object? (Ken Williams)
     Re: Function Call (Matthew Cravit)
     Hashes of hashes <daniel.gueguen@elantiel.fr>
     Re: Hashes of hashes (Jot Powers)
     Help, this script is killing me... <stephon@hempseed.com>
     Re: How to open a file to a variable instead of an arra (Tad McClellan)
     Re: Looking for a routine to trim white space  (like VB (Peter J. Schoenster)
     Re: map problem (Thomas Andrews)
     Re: map problem (Jahwan Kim)
     Re: map problem (Mike Stok)
     Re: Newbie ?? Can PERL scan for substrings from serial  (Matthew Cravit)
     Re: NEWBIE QUESTION (Matthew Cravit)
     Re: Password Protection on a directory <gregmee@vianet.net.au>
     Re: Perl Interface to /etc/passwd (Dave Regan)
     Re: Problem with 5.004_01 <felicity@dilbert.kluge.net>
     Re: Problem with 5.004_01 (Matthew Cravit)
     Re: Puting pattern in a variable (Tad McClellan)
     Re: Seeking object enlightenment (Greg Bacon)
     Re: Sorting Challenge (Greg Bacon)
     Stuck on math problem (Ranson)
     Trouble building SCO dynamic loading ... <jarl@atrieva.com>
     Using perl noninternet, stand alone for processing!!??? <rudedog@pld.com>
     Re: Using perl noninternet, stand alone for processing! (Mike Stok)
     What is the littlest Perl? <newman@ttd.teradyne.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 12 Aug 1997 18:11:00 -0700
From: Kevin Johnson <kjj@pobox.com>
Subject: Re: any SMTP servers require domain name
Message-Id: <m2bu32anux.fsf@pobox.com>

"Sergio Stateri Jr" <serginho@alpha.hydra.com.br> writes:

> Hi ! When I log in a SMTP server, I've to send HELO command...The
> problem is that, if I'm in my home (Acessing using an internet
> provider), I don't have a domain name, and any SMTP servers require
> it (If I'm in the office, always's OK because I've a domain
> name). The internet provider send me a dynamic IP. I'd like to know
> if it's possible to emulate a domain name for the SMTP servers that
> require one.

I don't see anything here related to perl, but I'll try to answer it
anyway (because I mention Net::SMTP below)...

Whether you can use a fake domainname with the SMTP HELO command
depends on whter the SMTP server allows it.  Some servers require that
the domainname specified be correct.

Try it and see...

By the way, when are connected to your ISP at home, you DO have a
domainname - typically, it's one based on the ISP's domainname.

One other point...  Are you dialoging directly with your SMTP server
or something?  Why is this something you are worrying about?  If, for
example, you are using the Net::SMTP perl module, it can perform the
HELO stuff for you automagically.

-- 
thx,
kjj@pobox.com   http://www.pobox.com/~kjj/


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

Date: 12 Aug 1997 17:45:53 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Comparing Text
Message-Id: <m3g1seuczi.fsf@windlord.Stanford.EDU>

Kelby Cody <cody@cs.unca.edu> writes:

> I was wondering if anyone could help me with comparing text files.  I
> want to write a perl script for the web that reads an existing text file
> and compares it to answers people submit through a form.  Any help would
> be greatly appreciated.

You're going to have to be *way* more specific than this, I'm afraid.  Do
you just want to find differences?  If so, then use diff; no need to do it
in Perl, and diff is good at it.  Do you want to check the answers against
some regular expression patterns, or use eq to check literal equality with
a string, or....  And what precisely are you having problems with?

-- 
#!/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: Tue, 12 Aug 1997 19:38:14 -0400
From: ken@forum.swarthmore.edu (Ken Williams)
Subject: Duping STDOUT to a IO::Socket object?
Message-Id: <ken-1208971938140001@news.swarthmore.edu>

Hi-

-----SHORT VERSION:---------
How can I get print statements to print to a IO::Socket::UNIX object
without explicitly doing something like this:
   print $client "Some text\n";  # this works, but I can't do this (shared code)
   print "Some text\n";          # want this to go to $client, select() won't
                                 # do what it seems like it should

-----LONG VERSION:----------

I've got some print statements buried way inside some subroutines (can't
change the statements themselves), and I want the output of those print
statements to go to my program's IO::Socket::UNIX object.  This is the
idea:

   select $client;   # $client is an IO::Socket::UNIX object
   &do_all_those_print_statements();
   select STDOUT;

Unfortunately, this doesn't work.  I get all kinds of broken pipes (caught
by $SIG{PIPE}) and headaches (no such handler) trying to do this.

The other thing I've tried (which I also can't get to work) is to dup
STDOUT to the socket object following the normal duping model open(STDOUT,
">&ELSEWHERE"):

   open(STDOUT, ">&$client");  # Won't work, $fh gets represented as a string
   open(STDOUT, ">&", $client);# Too many arguments to open()
   open(STDOUT, $client);      # The most likely candidate, doesn't seem to work


Can anyone advise?  Thanks.

-Ken Williams
 The Math Forum
 ken@forum.swarthmore.edu


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

Date: 12 Aug 1997 23:24:48 GMT
From: mcravit@shell3.ba.best.com (Matthew Cravit)
Subject: Re: Function Call
Message-Id: <5sqrc0$m2h$1@nntp1.ba.best.com>

In article <01bca744$ac337740$4003420a@uc518.infogrames.fr>,
UC 518 <ejammes@infogrames.fr> wrote:
>Hello,
>
>I'd like to call in a script perl a function which is in another script. I
>do *NOT* want do use a 'require', because the name of the function I want
>to call is already used in my script. I also cannot change the name of this
>function for quite complex reasons.

You need to put one or other of the two scripts into its own "package".
Have a look at the perl documentation for the details, but basically 
what you would do is something like:

The script containing the functions to include:

	package MyPackage;

	sub MySubroutine { ... }

	1;	# So that use and require don't report an error


The script which uses this function:

	use lib "/directory/containing/the/other/file";
	require "OtherFile.pl";

	$result = MyPackage::MySubroutine($foo, $bar);

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: Tue, 12 Aug 1997 23:36:01 GMT
From: "Daniel GUEGUEN" <daniel.gueguen@elantiel.fr>
Subject: Hashes of hashes
Message-Id: <01bca76f$410e5cc0$c2cc06c3@dns1.elantiel.fr>

Hello,

Does someone know how to build a hash of hashes by reading two files linked
by a key, and how to access these hashes to rewrite the two files after
modifications ?

Example :   file Customers      	         file Invoices
	        IdCustomer  0,n -----> 1,1   IdCustomer
	        Name			Amount
	        ...				...
I put Customers in an associative array %CustomersList and I would like to
build an associative array for each invoice of a customer and to acces them
by %CustomersList.

I don't find the syntax. If someone know the solution or where to find
examples, thanks for help   :-)

Daniel
(scuse for my english, not really fluent...)

daniel.gueguen@elantiel.fr




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

Date: 12 Aug 1997 23:33:42 GMT
From: news@bofh.com (Jot Powers)
Subject: Re: Hashes of hashes
Message-Id: <5sqrsm$4cd$1@gazette.corp.medtronic.com>

In article <01bca76f$410e5cc0$c2cc06c3@dns1.elantiel.fr>, Daniel GUEGUEN wrote:
>Hello,
>
>Does someone know how to build a hash of hashes by reading two files linked
>by a key, and how to access these hashes to rewrite the two files after
>modifications ?
>

I'm going to ignore the details and assume that what you want is help
on hashes of hashes.  I was a bit disappointed that man perllol pulls
up the Lists of Lists section, but perlhoh doesn't exist.  :)

Regardless, the perldsc man page is good.  (or perldoc perldsc
if you're not on a Unix system).  It is a great place to
learn about lists of lists, hashes of hashes, lists of hashes, well,
you get the idea. 

If you don't have those pages then your perl is broken, and they
may or may not work, but they can be accessed via:

http://www.perl.com/perl/everything_to_know/pdsc/index.html

>
>Daniel
>(scuse for my english, not really fluent...)

Better than us monoglot.

If this isn't enough help, post again and I'll give it another shot.

-Jot
-- 
Jot Powers  news@bofh.com
Unix System Administrator
"Sometimes you just have to grab the bull by the tail and face the situation."


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

Date: Tue, 12 Aug 1997 17:19:45 -0700
From: "Stephon" <stephon@hempseed.com>
Subject: Help, this script is killing me...
Message-Id: <01bca77f$5f362380$18c82399@default>

To whom reads,
Below is a script that seems to work although when I try to have the script
read the log file so that it may read and write it screws up...  Please see
what's the matter with it...  Oh, I don't care if you use it as long as you
keep the top banner:
##################################################################
# Image Link Exchange beta      Version 0.1b                     #
# Tha Panther Design            stephon@hempseed.com             #
# Created: 08/12/97                                              #
##################################################################
UP!  I think the problem may be in the way I have the log file set up as
followed:
banad23.gif,0
banad23.gif,0
banad23.gif,0
banad23.gif,0

#! /usr/local/bin/perl
##################################################################
# Image Link Exchange beta      Version 0.1b                     #
# Tha Panther Design            stephon@hempseed.com             #
# Created: 08/12/97                                              #
##################################################################
# Define Variables
$basedir = "http://2pac.simplenet.com/images/";
$graphics = "/usr4/stephon/public_html/pic.txt";
$logfile = "/usr4/stephon/public_html/log.txt";

# Getting Propare Command #######################################
if ($ENV{'QUERY_STRING'} ne '') {
   $command = "$ENV{'QUERY_STRING'}";
}

# Opening Graphic Access Files ###################################
open (PIC, "$graphics");
@files = <PIC>;
close (PIC);

# Select Graphic for Current Page ################################
srand(time ^ $$);
$num = rand(@files);

# Opening Log for Search #########################################
open (LOG, "$logfile");
@log = <LOG>;
close (LOG);

# Searching Log for Current File Access Count ####################
open(LOG,">$logfile");
   foreach $log (@log) {
      if ($log =~ /$files[$num],.*/) {
         ($log,$num)=split(/,/,$log);
         print "$files[$num] - $log,$num\n";
         $num++;
         print LOG "$log,$num\n";
      }
      else {
         print LOG "$log,$num\n";
      }
   }
close(MAIN);

if ($command eq 'stats') {
# Show File Image Access Count ###################################
open (LOG, "$logfile");
@log = <LOG>;
close (LOG);
print "Content-type: text/html\n\n";
print "<html>\n <title>File Access Log</title>\n <body>\n";
print "<center><table border=\"1\"><tr><th width=250>Filename</th><th
width=150>Access Count</th>\n";
foreach $log (@log) {
   ($log,$num)=split(/,/,$log);
   print "<tr><td align=\"left\"><b>$log</b></td><td
align=\"center\">$num</td></tr>\n";
}
print "</table></center><br>\n";
print "</body>\n</html>";
}
else {
# Printing Location of Graphic ###################################
print "Location: $basedir$files[$num]\n\n";
}

Well, there it is; HELP HELP HELP

-Stephon


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

Date: Tue, 12 Aug 1997 16:39:12 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How to open a file to a variable instead of an array?
Message-Id: <06lqs5.g1d.ln@localhost>

Morten Simonsen (mortensi@idt.ntnu.no) wrote:
: : >How can i open a file to a variable instead of an array?

: : What do you mean by "open a file to a variable"? Do you want to put
: : the contents of a file into a single variable? Do you want to open a
: : file whose name is conatined in a variable?
: : Have you read any of the Learning Perl documentation?

: I think the previous post is a good example of what sould NOT
          ^^^^^^^^^^^^^^^^^
: be posted. It has no information except: "read the docs". It even


The previous post at my server is an excellent one from Andrew
Langmead that shows no less than four ways to get the contents
of a file stuffed into a scalar variable.

News propagates at different rates to different places.

If you wish to comment on a post, you should quote some of the post,
or at least include the Message-ID header so people will know what
you are talking about...


[ snip a fifth way to do it ]


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Wed, 13 Aug 1997 00:21:04 GMT
From: pschon@baste.magibox.net (Peter J. Schoenster)
Subject: Re: Looking for a routine to trim white space  (like VB trim$)
Message-Id: <33f0fd35.68941551@chaos.magibox.net>

cberry@cinenet.net (Craig Berry) wrote:

>Steve O'Hara Smith (sohara@mardil.elsevier.nl) wrote:
>Why not just use
>
>  ($stripped) = $unstripped =~ /^\s*(.*?)\s*$/;

>cberry@cinenet.net (Craig Berry) wrote:
>Though even this is woefully inefficient, involving lots of backtracking 
>internally on many strings.  Better still might be doing it in two 
>passes, one for each end of the string:
>
>  $stripped = $unstripped;
>  $stripped =~ s/^\s+//;
>  $stripped =~ s/\s+$//;
>
>Hope this helps!

How would I begin to understand why the first method was inefficient.

It would seem that the second method would be more inefficient
(although, oddly, that is the way I tend to do things but I think that
is because I don't have a firm graps of the proper use of
parentheseis).

Thanks,

Peter



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

Date: 13 Aug 1997 00:37:34 GMT
From: thomaso@shell3.ba.best.com (Thomas Andrews)
Subject: Re: map problem
Message-Id: <5sqvke$qa4$1@nntp2.ba.best.com>

In article <5sq4ut$o82@news-central.tiac.net>,
Mike Stok <mike@stok.co.uk> wrote:
>In article <5sprvb$gjf@buffalo.HL.Siemens.DE>,
>Marek Rouchal <Marek.Rouchal@-nospam-hl.siemens.de> wrote:
>>I want to use map() to cut off some string (conditionally) from array elements.
>>Please consider:
>>
>>@a = qw( aaabb cccbb ddd eee );
>>
>>@b = map { s/bb$//; } @a;
>
>You might want to say
>
>  foreach (@b = @a) { s/bb$//; }
>

Why use "foreach" :-)

	grep ( s/bb$// , @b=@a );

--
Thomas Andrews         thomaso@best.com         http://www.best.com/~thomaso/
    "Show me somebody who is always smiling, always cheerful, always
    optimistic, and I will show you somebody who hasn't the faintest
    idea what the heck is really going on." - Mike Royko


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

Date: 13 Aug 1997 00:40:52 GMT
From: jahwan@supernova.math.lsa.umich.edu (Jahwan Kim)
Subject: Re: map problem
Message-Id: <slrn5v20kk.qcl.jahwan@supernova.math.lsa.umich.edu>

On 12 Aug 1997, Marek Rouchal wrote:
[snip]
> @a = qw( aaabb cccbb ddd eee );
> 
> @b = map { s/bb$//; } @a;
[snip]
    People offered various ways to do what you want.  I offer the
explanation on what happened.  s/// does not return the modified content,
but returns the number of substitutions.

Jahwan, with Camel near his monitor.




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

Date: 13 Aug 1997 01:13:03 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: map problem
Message-Id: <5sr1mv$144@news-central.tiac.net>

In article <5sqvke$qa4$1@nntp2.ba.best.com>,
Thomas Andrews <thomaso@shell3.ba.best.com> wrote:

>>You might want to say
>>
>>  foreach (@b = @a) { s/bb$//; }
>>
>
>Why use "foreach" :-)
>
>	grep ( s/bb$// , @b=@a );

In general I use grep when I'm interested in the result e.g.

  $found = /$pattern/, @list;

or

  @matches = /$pattern/, @list;

and foreach in this kind of scenario - foreach is useful for telegraphing
"I'm using $_ as an alias herr to modify the list elements."

's all

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 12 Aug 1997 22:37:22 GMT
From: mcravit@shell3.ba.best.com (Matthew Cravit)
Subject: Re: Newbie ?? Can PERL scan for substrings from serial port data?
Message-Id: <5sqoj2$l1s$1@nntp1.ba.best.com>

In article <33F07467.1433@agcs.com>, Jim Zahrndt  <zahrndtj@agcs.com> wrote:
>I need to write a script that would process files and ship them out
>to suppliers using XMODEM. I'd like to write the PERL script
>to wait for input (i.e., "ssword:", "ogin:", etc.) from the remote
>system and then continue on.

This is possible to do with perl, using the chat2.pl library which is part
of the standard distribution. However, in my opinion, it's much easier to
do using Expect, which was written precisely to solve this kind of problem.
You can get expect from ftp://ftp.cme.nist.gov/pub/expect/ (I think that's
right.)

/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: 12 Aug 1997 23:10:27 GMT
From: mcravit@shell3.ba.best.com (Matthew Cravit)
Subject: Re: NEWBIE QUESTION
Message-Id: <5sqqh3$lnd$1@nntp1.ba.best.com>

In article <5spm8k$9gg@nuscc.nus.sg>, Xu Chu  <xuchu@iscs.nus.edu.sg> wrote:

>	$blunk = %name;
>	print '$blunk=',$blunk,"\n";
>
>i run it and gets "$blunk=2/8". can u tell me why it is the result?

Out of curiosity, what were you trying to do with the assignment

	$blunk = %name;

It's clear you were not getting the result you had anticipated, but I'm
wondering exactly what you were anticipating that this would so. If you
clarified that, maybe some of us could help you accomplish that.

/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: 12 Aug 1997 22:40:11 GMT
From: "Greg Meechan" <gregmee@vianet.net.au>
Subject: Re: Password Protection on a directory
Message-Id: <01bca771$37f24aa0$d2230dcb@www.cosmic.com.au>



Jeremy D. Zawodny <zawodny@hou.moc.com> wrote in article
<33f05b1d.338740422@igate.hst.moc.com>...
> [cc'd to original author]
> 
> >I've tried to FTP a .htaccess file across, I've tried to FTP a htacess
file
> >across and then rename it .htaccess. However, none of these work! 
> >
> >Does anyone have any suggestions
> 
> Yeah, contact the ISP and ask them to fix the problem, or at least ask
> them what the proper procedure is.

Thanks for the suggestion.

 I've mailed their support five times and have never had a reply to ANY of
them. I recently sent a snail mail letter to their General Manager
complaining about the situation. In the meantime my client is anxious to
get the site up and running. Thus I thought someone else may have an
solution.

Regards

Greg Meechan


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

Date: 13 Aug 1997 00:17:43 GMT
From: regan@office.ao.com (Dave Regan)
Subject: Re: Perl Interface to /etc/passwd
Message-Id: <5squf7$slj$1@bashir.peak.org>

In article <33f2cc94.96392637@netnews.voicenet.com>,
	xxbbell@voicenet.com (Bob) writes:
>Benjamin Holzman <bholzman@mail.earthlink.net> wrote:
>>No.  The reason the crypt algorithm uses a salt is to make "dictionary"
>>attacks much harder.  If you think about it, if the salt was static, you
>>could just take a standard hackers' dictionary and run each entry
>>through a crypt algorithm using that static salt.  Then you'd be able to
>>crack m crackable passwords generated by such a crippled crypt VERY
>>quickly. (in O(m * log n), where n is the number of words in your
>>hackers' dictionary.) By using a salt, however, a cracking algorithm has
>>to run every entry in the hackers' dictionary through a crypt for each
>>and every password it's trying to crack.  This is quite a bit slower,
>>O(m*(n/2)).  The salt HAS to be in the password itself, or there'd be no
>>way to check the password:
>
>	I find this stuff very interesting.  If I understand you,
>because the salt varies, you run crypt on every word for each account.
>With a constant salt, you would run crypt on every word only once.
>Assume that the crypt routine takes some significant portion on time,
>this increases the amount of time to hack into one account in a list
>of accounts.
>	I suppose this is getting off track, but how is this done in
>..htpasswd?  It contains just a username and encrypted text.  Unless...
>perhaps that encrypted text also has the salt (i.e., the first 4 (or
>any number) characters are the salt, or even the username itself is
>the salt)?
>	I guess I'll probably be told to go look it up elsewhere, huh?


The first 2 characters of the stored password is the salt.
So you got it right.

There are 64 possible salt values.  Thus, you can still do a dictionary
attack, but you need 64 dictionaries.  The password will tell you
which dictionary to use.

Note that the password scheme typically used was intended to take
an appreciable amount of time on computers from 15 years ago (or so).
It takes little time now.  You cannot really afford to let the
"bad guys" see the encrypted passwords anymore, as brute force
attacks work because people tend to pick bad passwords.

Once the bad guy has *any* login password to a computer, the attack
on important accounts (e.g. root) can take additional routes.  Thus
even if the root password is a good password, any bad password can
give the bad guy the toehold they need.

Another aspect of bad passwords is that people don't like remembering
passwords.  I wonder how many passwords in .htaccess file (along
with information in the access_log which indicates where the person's
home ISP is) are actually real login passwords.  Don't use the
same password in different places.  If that is unrealistic, have your
"real" password, and give something completely different for web
based passwords.

This isn't at all perl related; for that I apologize.

			Dave Regan
			regan@ao.com



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

Date: 12 Aug 1997 22:18:55 GMT
From: Theo Van Dinter <felicity@dilbert.kluge.net>
Subject: Re: Problem with 5.004_01
Message-Id: <5sqngf$qu8$1@bigboote.WPI.EDU>

Tom Phoenix <rootbeer@teleport.com> wrote:
> Did all of the tests from 'make test' pass? Did they give any helpful

yes, everything looked fine before I installed it ...  when I switched
back to 5.004, I had the same problems (I simply did 'make install'
again).  after I wiped the perl library directory, things worked ok.  I
then wiped the library directory again, and re-installed 5.004-01, and
it's working fine now too ... Apparently there was just something that
got put in there that didn't like to run.

Thanks for the response.


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

Date: 12 Aug 1997 23:04:44 GMT
From: mcravit@shell3.ba.best.com (Matthew Cravit)
Subject: Re: Problem with 5.004_01
Message-Id: <5sqq6c$lfv$1@nntp1.ba.best.com>

In article <5sptm9$m98$1@bigboote.WPI.EDU>,
Theo Van Dinter  <felicity@eclectic.kluge.net> wrote:
>I just installed 5.004_01 to upgrade from 5.004, and most of my scripts
>now cause this error message from perl:
>
>perl: can't resolve symbol 'safemalloc'

I had this problem when I upgraded from 5.004_01 to 5.004_02. I suspect
it has something to do with the dynamically-loaded extensions, although I
don't know what. I know reinstalling all of my Perl extension libraries
fixed the problem on my system.

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: Tue, 12 Aug 1997 17:32:57 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Puting pattern in a variable
Message-Id: <paoqs5.2ae.ln@localhost>

Vladimir Parkhaev (vlad@teleglobe.ca) wrote:
: Hi everybody,
: I've created an array of patterns. And I need
: to match a variable to find out if it matches
: at least one of them.

: Something like this:

: foreach $regex (@List) {
:   if ($_ =~ $regex) {


   if ($_ =~ /$regex/) {

or, even just:

   if (/$regex/) {


:     print "OK";
:   }
:   else {
:     print "No match"; 
:   }

: }

: I've tried about everything, including eval.
             ^^^^^^^^^^^^^^^^

Does everything include checking the Perl FAQ?  ;-)



: Nothing seem to work. Has anybody tried this before?

I expect someone has, since there is an entry in the Perl FAQ (part 6)
about it.

I guess you missed it somehow when you checked the Perl FAQ before
posting...


"How do I efficiently match many regular expressions at once?"


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: 13 Aug 1997 01:19:04 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
To: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Seeking object enlightenment
Message-Id: <5sr228$ad7$2@info.uah.edu>

[Posted and mailed]

In article <33f4824a.3389971@news.tornado.be>,
	bart.mediamind@tornado.be (Bart Lateur) writes:
: Call me stupid, but I don't understand why this is called "to bless".
: Nothing in the discribtion above makes me think of blessing. Unless its
: something really weird like "Go and Multiply", sortof. In short: what's
: the metaphor?

Well, an object has been blessed with the ability to do method searches
(which is the bit about "remembering" that Randal alluded to), i.e. it
"remembers" a starting point to look for methods called against it.

: I think OOP in Perl is daunting to a lot of people like me, because of
: this rather strange naming convention.

I think communicating with people in English is daunting to a lot of
people like me, because of its rather strange naming conventions. :-)
The best way to learn Perl's flavor of OO programming is to write a
(perhaps simple) class of your own.  You'll immediately get a feel for
it, and it will no longer be as daunting.  As for English... :-)

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: 13 Aug 1997 01:03:24 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
To: ranson@infoave.net
Subject: Re: Sorting Challenge
Message-Id: <5sr14s$ad7$1@info.uah.edu>

[Posted and mailed]

In article <5slfpp$b1b@news1.infoave.net>,
	ranson@infoave.net (Ranson) writes:
: 
: The program sorts the files, lowest number first.
: So the oldest data is always at the top. I want to reverse this order
: and put the newest data at the top. I have researched this some and 
: have not found a way to do this. Does someone know how to do this?
: I have used the Camel book and did find some information, but
: it is confusing. 
: 
: My files are numbered like: f1001.rec f1002.rec

This sounds like a job for the (Schwartzian|Black) Transform. :-)

    @newest_first = map { $_->[0] }
                    sort { $b->[1] <=> $a->[1] }
                    map { /^.*(\d+)\./; [ $_, $1 ] }
                    @files;

Breaking this up:

    @names_numbers = map { /^.*(\d+)\./; [ $_, $1 ] } @files;
    @sorted        = sort { $b->[1] <=> $a->[1] }     @names_numbers;
    @newest_first  = map { $_->[0] }                  @sorted;

The regular expression looks a bit hairy.  Decomposed /x style:

    /
     ^.*    # last occurence of...
     (\d+)  # a run of digits (stuffed into $1)...
     \.     # followed by a dot
    /x

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: 12 Aug 1997 22:49:43 GMT
From: ranson@infoave.net (Ranson)
Subject: Stuck on math problem
Message-Id: <5sqpa7$adn@news1.infoave.net>


Greetings, I am trying to figure a simple? math equation within a 
foreach loop.
I know it has to be simple but just can not get the sytax correct.
I just need to add any number of items stored in a temp file and
 produce a 
total. $total

In the code below i need to add each $subtotal and produce a $total

The best I have been able to get is: 12 30 42 60 72 90 - 90 IS the
 correct total 
for all $subtotal - but can't get rid of the 12 30 42 60 72

Any help is appricated. And thanks for all of you who have helped me 
in the past.

Ranson


open (TEMP, "$path/cgi/tmp/$temp_file");
@tmplines = <TEMP>;
close (TEMP);
foreach $tmpline (@tmplines)

{

    ($Item_no, $item_desc, $Item_quan, $Item_cost, $Item_unit) = split(/:/,$tmpline);

    $tempItem_no{$Item_no}=$Item_no;
    $tmpItemDesc{$Item_no}=$item_desc;
    $tmpQuan{$Item_no}=$Item_quan;
    $tmpCost{$Item_no}=$Item_cost;
    $tmpUnit{$Item_no}=$Item_unit;

$subtotal = $tmpQuan{$Item_no} * $tmpCost{$Item_no};

$total += $subtotal;

        print "<TR><TD>$tmpItemDesc{$Item_no}</TD>";

        print "<TD ALIGN=left>&nbsp; &nbsp; &nbsp; $tmpQuan{$Item_no}</TD>";

        print "<TD ALIGN=left>&nbsp; &nbsp;$tmpCost{$Item_no}</TD>";

        print "<TD ALIGN=left>&nbsp; &nbsp;$tmpUnit{$Item_no}</TD>";

        print "<TD ALIGN=left>&nbsp; &nbsp;$subtotal</TD>";

        print "</TR>$total\n";

	
 } # End of foreach



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

Date: Tue, 12 Aug 1997 15:03:16 -0700
From: Jar Lyons <jarl@atrieva.com>
Subject: Trouble building SCO dynamic loading ...
Message-Id: <33F0DDA4.418E@atrieva.com>

I can't seem to get the dynamic loading to build on SCO.

For whatever reason, Configure chooses dl_none.xs as 
the Dynaloader source, which is simply a no-op set of routines.

I read in the Dynaloader directory that it may be necessary
to create a version of dl_???.xs pertinent to the 
intended OS, unless your OS just happens to be one of 
the 1/2 dozen or so supplied in the base perl package:

dl_aix.xs     dl_dlopen.xs  dl_next.xs    dl_os2.xs
dl_dld.xs     dl_hpux.xs    dl_none.xs    dl_vms.xs

Has anyone successfully built a dynamically loading version?


-- 
Have you backed up your data today?
Atrieva Internet Backup Service http://www.atrieva.com

Jar Lyons
jarl@atrieva.com 
Atrieva Corporation  (www.atrieva.com)
600 University Street, Suite 911 
Seattle, WA  98101
Voice: (206) 749-2914,  
Fax:   (206) 382-6615
------------------------------------------------------------------
                1972 Oldsmobile Cutlass Convertible
                       455 Rocket Powered
                'How fast do you want to go today?'
------------------------------------------------------------------


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

Date: 12 Aug 1997 21:49:15 GMT
From: "Matthew Wagley" <rudedog@pld.com>
Subject: Using perl noninternet, stand alone for processing!!????????!!!!
Message-Id: <01bca779$e635d3e0$9d23fdce@matthews>

  I am wanting to use perl on my system at work to compile and tear down
*.txt files.  I can not find any resource to this effect on the net.  All
of the relate to perl for the internet on using it on your site or pages. 
I want to use this at work.  I have read books and such, still a newbie,
but I can't figure out the /usr/page/  blah blah blah to turn into terms
that my windows95 or DOS can understand instead of for Unix.  
  Your help is appreciated very much.
Thanks in advance.
Matthew Wagley


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

Date: 13 Aug 1997 01:04:44 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Using perl noninternet, stand alone for processing!!????????!!!!
Message-Id: <5sr17c$cp@news-central.tiac.net>

In article <01bca779$e635d3e0$9d23fdce@matthews>,
Matthew Wagley <rudedog@pld.com> wrote:
>  I am wanting to use perl on my system at work to compile and tear down
>*.txt files.  I can not find any resource to this effect on the net.  All
>of the relate to perl for the internet on using it on your site or pages. 
>I want to use this at work.  I have read books and such, still a newbie,
>but I can't figure out the /usr/page/  blah blah blah to turn into terms
>that my windows95 or DOS can understand instead of for Unix.  

How far have you got up to now?  Have you got perl installed.  Have you
considered ordering O'Reilly's Learning Perl on Win32 Systems (see
http://www.ora.com/catalog/lperlwin/ ) which expands on Randal Schwartz's
well received Learning Perl text?

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Tue, 12 Aug 1997 13:05:04 -0500
From: Aaron D Newman <newman@ttd.teradyne.com>
Subject: What is the littlest Perl?
Message-Id: <33F0A5D0.35B9@ttd.teradyne.com>

We have need for a command interperter in an embedded application.  I
was considering stripping down Perl so that it just has regexp's and a
few of the primitives.  I was wondering if anyone else has experience
stripping down Perl, and what the tinieist executable space you could
get it down to (roughly).

Cheers!
Aaron
-- 
---------------------------------------------------------------------
|  newman@ttd.teradyne.com           | "A forest is a finite         |
|                                    | (possibly empty) set of       |
|                                    | trees." - Baase               |
---------------------------------------------------------------------


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

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

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