[7523] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1150 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 9 11:07:15 1997

Date: Thu, 9 Oct 97 08: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           Thu, 9 Oct 1997     Volume: 8 Number: 1150

Today's topics:
     Re: Best way to extract array elements, modify, store r <merlyn@stonehenge.com>
     Bug in split? <ghowland@hotlava.com>
     Re: Bug in split? (Tom Grydeland)
     CGI and URI::URL modules collision <sbekman@iil.intel.com>
     Re: chop from left to right (John C. Randolph)
     Re: chop from left to right (John C. Randolph)
     Re: Coverting Flatfile *to* Excel <pdenman@ims.ltd.uk>
     cpan modules and isp <dturley@rocketmail.com>
     CSV Split gives seg fault <william@mathworks.com>
     Re: CSV Split gives seg fault (Jason Gloudon)
     Re: Download site for NT version of Perl (Scott McMahan)
     Emailing information from a Form which includes List Bo <grleach@achilles.net>
     Re: Forcing numeric interpretation? <rootbeer@teleport.com>
     Re: generating javascript <mwilhelm@astro.ocis.temple.edu>
     Re: Graham Barr: Public Apology <gbarr@ti.com>
     Re: Lists of lists in Perl 4 <seay@absyss.fr>
     Re: map in void context (was Re: $x = $y || $z - danger <merlyn@stonehenge.com>
     Re: MetaCrawler scripting <jeffery@mitre.org>
     Re: MetaCrawler scripting (Greg Bacon)
     Re: mkdir problems <gabor@vinyl.quickweb.com>
     Re: Passing Parameters from an HTML!! <rootbeer@teleport.com>
     Perl and msql <Csaba.Csillag@sysdata.siemens.at>
     perl compiler <bhh@iti-oh.com>
     Re: Perl Installation Question <rootbeer@teleport.com>
     Q: how to specify how many decimals a calcultaion shall (Calle ]sman)
     Re: Q: how to specify how many decimals a calcultaion s (Jason Gloudon)
     Re: system() won't run shell script correctly (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Text formatting question (Jarkko Juntunen)
     Re: Text formatting question <rootbeer@teleport.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 09 Oct 1997 06:57:54 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Bruce Reid <reid@dt.wdc.com>
Subject: Re: Best way to extract array elements, modify, store resulting list?
Message-Id: <8cen5v2g4d.fsf@gadget.cscaper.com>

>>>>> "Bruce" == Bruce Reid <reid@dt.wdc.com> writes:

Bruce> The original list consists of file names which are preceeded by either
Bruce> 'p.' or 's.'. I want to extract all 's.' files, strip off the 's.'
Bruce> prefix, and store the resulting filenames in a new list.

Bruce> @array = ( qw/s.file1.c s.file2.c p.file1.c s.file3.c p.file2.c/ ); 
Bruce> @sfiles = map { ($tmp = $_) =~ s/^s\.//; $tmp } grep /^s\./, @array;

Ahh... grasshopper.  Snatch the backreference from my hand, and you
will be enlightened:

    @sfiles = map /^s\.(.*)/, @array;

Ahh, so!

For those that want further explanation: This works because if the
match fails, the result is (), but if the match succeeds, the result
is ($1).  Cool!  Another one like this:

    %headers = map /^(\S+):\s+(.*)/, @news_posting;

Enjoy.  (These are two examples from my Packages, References, Objects,
and Modules training course -- see www.perltraining.com for details.)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 327 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Thu, 09 Oct 1997 14:38:27 +0100
From: Gary Howland <ghowland@hotlava.com>
Subject: Bug in split?
Message-Id: <343CDE53.6FE4@hotlava.com>

I want to split a string, containing a pair of numbers, seperated by a
non-digit.  I thought this would work:

	split("\D", "123-456");

but it doesn't - it gives ("123-456"), not ("123", "456).

Am I correct in thinking that \D should let me do this?

Gary
-- 
pub  1024/C001D00D 1996/01/22  Gary Howland <gary@hotlava.com>
Key fingerprint =  0C FB 60 61 4D 3B 24 7D  1C 89 1D BE 1F EE 09 06


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

Date: 9 Oct 1997 14:54:52 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: Bug in split?
Message-Id: <slrn63ps1s.1fq.Tom.Grydeland@mitra.phys.uit.no>

On Thu, 09 Oct 1997 14:38:27 +0100,
Gary Howland <ghowland@hotlava.com> wrote:
> I want to split a string, containing a pair of numbers, seperated by a
> non-digit.  I thought this would work:
> 	split("\D", "123-456");

You've hit an awk trap (try man perltrap)  Make the first argument to
split a regex match instead of a string:

% perl -de 1

main::(-e:1):   1
  DB<1> x split /\D+/, "123-456"
0  123
1  456
  DB<2> 

> Gary

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: Thu, 09 Oct 1997 14:16:50 +0200
From: Bekman Stanislav <sbekman@iil.intel.com>
Subject: CGI and URI::URL modules collision
Message-Id: <343CCB32.ABD@iil.intel.com>

Hi, 

Whenever I use:

use CGI qw(:standard :html2);
use  URI::URL;;

(URI::URL is part of LWP5.13 and CGI is 2.36)
and run the perl5.004.01 perl on these two lines I get:

Prototype mismatch: sub main::url vs ($;$) at
/usr/local/lib/perl5.004/Exporter.pm line 155
        Exporter::export('URI::URL', 'main') called at
/usr/local/lib/perl5.004/Exporter.pm line 171
        Exporter::import('URI::URL') called at makestat.pl line 17
        main::BEGIN() called at
/big/dom/xeprotec/cgi-bin/lib/lib/perl5.003/site_perl//URI/URL.pm line 0
        eval {...} called at
/big/dom/xeprotec/cgi-bin/lib/lib/perl5.003/site_perl//URI/URL.pm line 0

It doesn't matter what machine it runs on since I have this problem on
Linux and IRIX mercury 5.3


It doen't stop the program from running from the shell, but it results
server error once running thru the web

Any hints?

Thanks



______________________________________________________________________
Stas Bekman     
Address:        Aba Silver 12/29, Haifa, 32694, Israel  
Phones:         [w]  972-(0)4-865-5188, [h]  972-(0)4-828-2264/3020
Home Page:      http://techunix.technion.ac.il/~ofelix     
Resource Center http://www.eprotect.com/stas/TULARC (Java,CGI,PC,Linux)
Linux-il Home:  http://www.linux.org.il/


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

Date: 9 Oct 1997 13:34:27 GMT
From: jcr.remove@this.phrase.idiom.com (John C. Randolph)
Subject: Re: chop from left to right
Message-Id: <61imh3$72f$3@news.idiom.com>

In <61c18q$h52$1@news.wco.com> Chris Toth wrote:
-> Ok,
-> 
-> I have a variable called $amount that gets its info from elsewhere and 
-> and the info it gets always has a $ sign in front of it, but I have to 
-> strip off the $ and just have the numercal value left, for example, lets 
-> say that $amount returns $ 43.38 I need to get $amount to return or 
-> become, just 43.38. To try and figure out how to do this I wrote this 
-> silly little test script which I thought would work:
-> 
-> #!/usr/local/bin/perl
-> $amount = "\$ 43.38";
-> $amount = ~ s/\$//;
-> $amount = $amount +1;
-> print ($amount);
-> 
-> but when I run it I get:
-> 
-> 4294967296
-> 
-> instead of just 43.38
-> 
-> Anyone know what I am doing wrong?

Yes.  You're using "= ~" instead of "=~"  the latter is the binding operator 
for a patern match, and the former is not.

The other mistake, is you're using a regular expression, when what you really 
need to do is just kill all the characters that don't make a valid number.

-> Anyone have an elegant way of doing what I am trying to do? 

Sure. How about:

$amount =~ tr/\$//;

This will elminate all instances of the character "$" from the string in 
$amount.  Also, tr/// is usually much faster than a pattern match with a 
regex.

->Examples are most apreciated. thanks ALL

De Nada.

-jcr

--
John C. Randolph (408) 358-6732  NeXT mail preferred.
Chief Technology Officer, WARPnet Incorporated.
@"Hey, %s! You're a NAZI, and you can't spell!"



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

Date: 9 Oct 1997 13:37:53 GMT
From: jcr.remove@this.phrase.idiom.com (John C. Randolph)
Subject: Re: chop from left to right
Message-Id: <61imnh$72f$4@news.idiom.com>

In <61dg25$6sv$1@Starbase.NeoSoft.COM> Will Morse wrote:
-> I think your problem is the extra space in between the = and ~.

That, and using the wrong operator for the job.

-> I do not know why this does not produce a syntax error.

That would be because it's not syntactically invalid.  "$amount = ~ $foo" is 
perfectly legal, and it means assign the ones complement of $foo to $amount.

-jcr


--
John C. Randolph (408) 358-6732  NeXT mail preferred.
Chief Technology Officer, WARPnet Incorporated.
@"Hey, %s! You're a NAZI, and you can't spell!"



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

Date: Thu, 9 Oct 1997 12:15:40 +0100
From: "Paul Denman" <pdenman@ims.ltd.uk>
Subject: Re: Coverting Flatfile *to* Excel
Message-Id: <3eei16.ouc.ln@gate.imsport.co.uk>

Hi Tim,

This reminds me of my days writing reports which were to be
imported into Lotus 1-2-3.
I used to get round it by including a spreadsheet file & data
file on one disk. The spreadsheet file had an auto-running
macro which would import the data file as required.
Maybe this is the solution to your problem? You can retain
total control as to how the data is imported etc..

Hope that is of some use,

Paul Denman

Timothy Lux wrote in message <613j85$gtv@news.gvsu.edu>...
>Hi:
>
>Ive read the posts on how to get an Excel document into a flatfile database
>(simple way is to save it as a comma-delimited text file within Excel)...
but
>I need to go the other way. I have a flatfile database where the 'admin'
user
>can choose to convert the data to an Excel document. I can get the data to
any
>format I need, but is the solution to:
>        1 - convert the data to comma delimited
>        2 - open Excel
>        3 - open the file
>
>I don't want the user to have to do anything special... is there a way to
open
>Excel and the file all from PERL?  Or would the solution be to send the
comma
>delimited file via email, and hope they know how to do it from that point
on?
>
>Thanks in advance--
>
>Tim




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

Date: Thu, 09 Oct 1997 09:03:39 -0600
From: David Turley <dturley@rocketmail.com>
Subject: cpan modules and isp
Message-Id: <876405514.18897@dejanews.com>

Can anyone give me a hint on how one would use perl modules, that are not
part of the standard distribution, without direct access to perl on the
server. If we are stuck with using an ISP for web hosting, are we out of
luck since we don't have access to perl's path configuration?

Thanks,

David

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Thu, 09 Oct 1997 08:50:59 -0400
From: William York <william@mathworks.com>
Subject: CSV Split gives seg fault
Message-Id: <343CD333.B8510EFF@mathworks.com>

I'm trying to do CSV split on a string which is 56K long. (Current verion of
CSV split below).

The problem is that perl 5.003 produces a seg fault when trying to split the
string.

Any help would be appreciated.

Bill

send mail to william@mathworks.com

---

sub csvSplit {
    my($t) = shift;
    my(@fields) = ();
    while ($t =~ m`((")((\\"|""|[^"])*?)"|[^[,\n]*?)([,\n]|\n?$)`g) {
        if (length($2) == 1) {
            push(@fields, $3);
        } else {
            push(@fields, $1);
        }
    };
    # \" -> ", \n -> newline, \\ -> \
    foreach $t (@fields) {
        $t =~ s/
            \\(\\)|\\(n)|\\(\")
               /
            $1 ? "\\" : $2 ? "\n" : $3 ? "\"" : warn("Parse error processing
line: $t\n");
               /gex;
    }
    @fields;
}


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

Date: 9 Oct 1997 14:00:33 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: CSV Split gives seg fault
Message-Id: <61io21$br4$2@daily.bbnplanet.com>

William York (william@mathworks.com) wrote:
: I'm trying to do CSV split on a string which is 56K long. (Current verion of
: CSV split below).

: The problem is that perl 5.003 produces a seg fault when trying to split the
: string.

Tried using perl 5.004 ? Unless that problem has been fixed you'd have to 
hack up the CSV code to try a workaround, which wouldn't be very neat as far
as code reuse goes.

Jason Gloudon


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

Date: 9 Oct 1997 13:01:26 GMT
From: scott@lighthouse.softbase.com (Scott McMahan)
Subject: Re: Download site for NT version of Perl
Message-Id: <61ikj6$v8i$2@mainsrv.main.nc.us>

Jeff Girard (girardj@primenet.com) wrote:
: The www.perl.com only has the download in latest.tar.gz format.  Can
: someone please point me to a source for Perl (preferably the latest
: version) in Winzip format?

It would actually be better for you to get a Win32 gzip and tar
program, you know, so you would be able to not only unpack this
particular software, but also unpack any other software in this format
you stumble across in the future.

What you need is the Cygnus port of the GNU file utilities.  Do a web
search for "Cygnus" and "GNU" and "Win32", and you should turn it up!

Scott

PS: Wait a minute -- I've unpacked tar archives with WinZip before!
That's how I extracted NTEmacs before I downloaded the entire Cygnus
stuff. Are you sure you haven't tried unpacking it with WinZip!?


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

Date: Thu, 09 Oct 1997 10:01:54 -0400
From: Gerrard Leach <grleach@achilles.net>
Subject: Emailing information from a Form which includes List Boxes
Message-Id: <343CE3D2.20EEE1B5@nemx.com>

I am fairly new to CGI scripting, and am trying to create a script that
emails information from a form to myself.  I have managed to complete
this if each element in the form only returns one result, however in the
case of scrollable boxes in which you can select multiple objects, I am
unable to do get all the selections.  I only receive the last of the
elements selected.  Here is a piece of my code so far.

 ...
    # get the name/value pair strings
    ($name, $value) = split(/=/, $contents);

    # translate "+" to a space
    $value =~ tr/+/ /;

    # decipher ASCI hexidecimal escaped characters, if any
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    
    # Associate key and value
    #$contents{$name} .= "\0" if (defined($contents{$name})); # \0 is
the multiple separator
    #$contents{$name} .= $value;
	
    # find profile/contsupp field names that begin with cs*_
    if ($name =~ /cs\d_/) 
    {
      #add the profile/contsupp pair to a list keyed on the name of the
variable
      $csarry{$name} = $value;
    }
    else
    {
       #add the field data pair to a list keyed on the name of the
variable
       $contents{$name} = $value;
    }
  }
}

The List box will fall into the else part of the if statement along with
other elements if that helps at all.  I think that the name of the list
box element is going to come in as an array, however being new at this,
I am not sure how to split the array into different elements.  Any help
will be appreciated.

Thanks in Advance
Gerrard


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

Date: Thu, 9 Oct 1997 07:24:37 -0700
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Forcing numeric interpretation?
Message-Id: <Pine.GSO.3.96.971009071856.23840E-100000@usertest.teleport.com>

On Wed, 8 Oct 1997, Brandon S. Allbery KF8NH; to reply, change void to kf8nh wrote:

> Perl works with strings.  You can give Perl a hint that you're working
> with a numeric value by adding 0 to the value in question, but it's
> still a string when all is said and done. 

Not so. A scalar is converted as needed, and the result is cached. But the
result of a mathematical operation (adding, multiplying, etc.) is stored
as a number, not as a string. 

Some languages do just what you're suggesting, and convert everything to a
string. This loses some accuracy, since there's not a one-to-one mapping
between numeric values and string representations. It's also slower, since
every time you (for example) add 1 to a number, there has to be at least
one conversion from string-to-number, and at least one from
number-to-string. Perl avoids that overhead by caching the result of such
conversions. 

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Thu, 9 Oct 1997 07:46:39 -0400
From: Mark Wilhelm <mwilhelm@astro.ocis.temple.edu>
Subject: Re: generating javascript
Message-Id: <Pine.OSF.3.91.971009074604.9243A-100000@astro.ocis.temple.edu>

Thanks! This should help me get my script moving along.  

==================================================================
Mark Wilhelm			|   mwilhelm@astro.temple.edu 
Operations & Technical Support  |   
Systems Office			|   http://astro.temple.edu/~mwilhelm
Temple University		|   
Samuel Paley Library		|   (215) 204-6573
********************************************************************

	

On Wed, 8 Oct 1997, Jerome O'Neil wrote:

> Use "HERE" documents whenever possible.
> 
> Also, don't use double and single quotes.  Use q and qq instead.
> 
> Example:
> /#!usr/bin/perl
> $foo = 'This isn\'t interpolated';
> print "onClick=myFunction(\"$foo\")";
> 
> Should be:
> #!/usr/bin/perl
> $foo =q{This isn't interpolated};
> print qq{onClick=myFunction("$foo")};
> 
> 
> Makes life much easier.
> 
> Good Luck!
> 
> Jerome
> Mark Wilhelm wrote:
> 
> > I'm having some problems using perl to generate javascript.  I think the
> > biggest obstacle is how to handle/escape the javascript code brackets so
> > that perl doesn't interpret them as perl code.  Anyone have any
> > ideas/subroutines I can "creatively plagiarize" (read: steal)?
> 
> 
> 
> 


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

Date: Thu, 09 Oct 1997 07:54:33 -0500
From: Graham Barr <gbarr@ti.com>
To: "J. Gregory Wright" <greg_wright@cmsinc.com>
Subject: Re: Graham Barr: Public Apology
Message-Id: <343CD409.BE9CA829@ti.com>

J. Gregory Wright wrote:
> So, since I "flamed" in public, it is only right that I apologise there:

Now I read back on the message I sent, I was probably asking for it.
I missed the "newbie" in the subject and read "from my C experience"
and so assumed experience. I too apologize if I offended you.

Graham.

-- 
Originality is the ability to conceal your source.


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

Date: Thu, 09 Oct 1997 14:03:06 +0200
From: Doug Seay <seay@absyss.fr>
To: Janning Vygen <Janning.Vygen@bonn.netsurf.de>
Subject: Re: Lists of lists in Perl 4
Message-Id: <343CC7FA.1250A22A@absyss.fr>

[Pposted and mailed]

Janning Vygen wrote:
> 
> How can I create a list of a list
> (=multidimensional array) in Perl 4?
> 
> I read in the german edition of "Learning Perl" by
> Randal Schwartz:  ' that a list can4t have a list
> as its element. But in Perl 5 it is allowed to use
> a reference to a list as an element of a list.'
> 
> Is there no way to create list of lists??

The short answer is "no".

The longer answer is that Perl4 doesn't have references.  This shoots
you in the foot before you start.  You could try playnig with evals to
dynamically build variables and then used typeglobs of these generated
variables.  While I would guess that this _could_ work, it is more
likely to drive you insane.  I know I'd lose it long before finishing
the debugging.

If you just want to be able to use something[x][y][z] (C syntax) without
shift/splice and anything else that actually uses it as a LIST, you
could try to use

	$associative_array{$x,$y,$z} = $value;

Look up the $; variable on p114 of the Classic Camel if you want
details.

- doug

PS - You are the best judge for this, but I hope that you have an
excellent reason for sticking with Perl4.  That is kinda like saying
that you want to stick with your 80286.  Sure, it was _the_ thing to use
once, but now it is best abandoned.


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

Date: 09 Oct 1997 06:50:43 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: map in void context (was Re: $x = $y || $z - dangerous assumption?)
Message-Id: <8chgar2ggc.fsf@gadget.cscaper.com>

>>>>> "Terry" == Terry Michael Fletcher <tfletche@pcocd2.intel.com> writes:

Terry> Doug Seay (seay@absyss.fr) so eloquently and verbosely pontificated:
>> 
>> General question: why is map faster than for?  Is it just for some
>> cases, but for others for is faster?  Is there something intrinsic about
>> the map that is easier to optimize?  Is it because the iterating
>> variable is a local, not an alias?

Terry> i will take a little time after work to see if i can duplicate
Terry> my tests.  i will have to change around some of the code to
Terry> make it general.  i dont want to just *say* its faster without
Terry> showing what i found.

In the current implementation, the body of foreach is always doing
less work than the body of map.  Map is *always* building a list, even
in a void context.  The best possible timings from map, therefore, are
when you consistently return a null list for each iteration.

However, a foreach (as opposed to a foreach my) has to localize the
control variable.  For a small number iterations, this localization
time may dwarf the actual iteration time.  And map has to localize $_
regardless.  There's no "map my $_" equivalent form.  (Chip, are you
listening? :-)

A void use of grep, on the other hand, is relatively fast, because
it's merely building a simple array from the scalars of the list being
scanned (not from a newly created expression).  Again, returning false
keeps this list from being extended, so it'd be faster.

So, I'd say in speed (knowing a little behind the scenes), from
fastest to slowest, it'd be:

	foreach my $x
	foreach $x
	grep returning false
	grep returning true/false
	map returning ()
	map returning other

I'd be surprised to see any benchmarks that show the ordering to be
significantly different.  I'd do one myself, but I'm rushing off
to catch a plane (as I often do :-).

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 327 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Thu, 09 Oct 1997 07:59:25 -0400
From: Jeffery Schweiger <jeffery@mitre.org>
To: Superhighway <hmsmch@cyberservices.com>
Subject: Re: MetaCrawler scripting
Message-Id: <343CC71D.BA62AFB2@mitre.org>

I wrote a program that is very similar to this.  Except that, instead of
ten seach engines,
I only had four, and you could choose the number of URLs you wanted
return from
each search engine.  For example, you could select 10 from altavista,
100 from
Webcrawler, ctc.  What part do you a have problems with?  Have you done
any work
on this project yet.  I just need a feel of when I can begin to help
you.

Jeff Schweiger
The MITRE Corporation



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

Date: 9 Oct 1997 14:36:34 GMT
From: gbacon@adtran.com (Greg Bacon)
To: hmsmch@cyberservices.com (Superhighway)
Subject: Re: MetaCrawler scripting
Message-Id: <61iq5i$osp$1@info.uah.edu>

[Posted and mailed]

In article <MPG.ea576a647ad406698968c@news.ais.net>,
	hmsmch@cyberservices.com (Superhighway) writes:
: I am working on a web page right now that I would like to incorporate I 
: have a list of 10 search engines and I would like a user to be able to 
: enter a search key word or key phrase and then search all 10 search 
: engines with the click of a button.  I would also like to include an 
: option that they can ask for the top X listing for each engine.  X being 
: the number they wish to search for.

This isn't related to Perl, but in the usage terms of most search
engines, you'll find that doing this sort of thing is usually prohibited.
C'mon.. they have to display their gaudy banners *somehow*. :-/  For
example, AltaVista's stance on the matter:

    3. The AltaVista search engine and the AltaVista index are the
       property of Digital Equipment Corporation. You may not, without
       express permission from Digital, take the results from an
       AltaVista search and reformat and display them. You also may not
       mirror the AltaVista home page or results pages on your Web site. 

You can find the above at

    http://altavista.digital.com/av/content/disclaimer.htm

: Please post replies both here and via e-mail to 
: edwardj@hmsmch.cncoffice.com

Headers, man, headers!

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


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

Date: 9 Oct 1997 13:33:57 GMT
From: Gabor Egressy <gabor@vinyl.quickweb.com>
Subject: Re: mkdir problems
Message-Id: <61img5$sft$2@flint.sentex.net>

Benjamin Holzman <bholzman@mail.earthlink.net> wrote:
: [posted & mailed]

: Barry Neville wrote:
: > 
: > I'm getting some crazy results from the Perl mkdir function running on a
: > Solaris 2.5 machine. The resulting permissions I'm getting seem almost
: > random. Can anyone shed some light?
: > 
: > Thanks.

: If you post your code, I'm sure some of the able and willing experts who
: prowl this group will be happy to help you out :-)

: Benjamin Holzman

Just a hunch but I think he is not giving the MODE as an octal

mkdir "foo",0751;
which of course gets modified by the umask

gabor.
--
    It's there as a sop to former Ada programmers.  :-)
        -- Larry Wall regarding 10_000_000 in <11556@jpl-devvax.JPL.NASA.GOV>


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

Date: Thu, 9 Oct 1997 07:15:28 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Soren M. Pedersen" <sorenmp@iname.com>
Subject: Re: Passing Parameters from an HTML!!
Message-Id: <Pine.GSO.3.96.971009071457.23840D-100000@usertest.teleport.com>

On Wed, 8 Oct 1997, Soren M. Pedersen wrote:

> open(IMG,"world/register/NoImage.gif");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check of the return value after opening a
file. Thanks!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Thu, 09 Oct 1997 14:26:29 +0200
From: Csillag Csaba <Csaba.Csillag@sysdata.siemens.at>
Subject: Perl and msql
Message-Id: <343CCD75.AE0DF4A4@sysdata.siemens.at>

Hi,
I would like to use an Postgressql database from my Perl program. I
installed on my linux  the PostgresPerl-1.3-1.src.rpm package. The perl
vesion is 5.003. The Postgres version is 6.02. The first two line of my
perl source is:

!/usr/bin/perl
use Postgres;

When i run  my postgres.pl i received the following message:

Can't find loadable object for module Postgres in @INC
(/usr/lib/perl5/i386-linux/5.003 /usr/lib/perl5
/usr/lib/perl5/site_perl/i586-linux /usr/lib/perl5/site_perl .) at
/usr/lib/perl5/site_perl/Postgres.pm line 21
BEGIN failed--compilation aborted at ./postgres.pl line 2.

The 21. line of Postgres.pm is:

bootstrap Postgres $VERSION;

Does anyone knows what the problem could be?

Thanks
        Csaba



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

Date: Thu, 09 Oct 1997 10:42:38 -0400
From: Brad Hochstetler <bhh@iti-oh.com>
Subject: perl compiler
Message-Id: <343CED5E.5FCF@iti-oh.com>

I have statically installed the perl compiler, with no problems,
my basic test programs worked fine.  But when I went to a little
more sophisticated program I got this error message:

Can't locate object method "first" via package "B::OP" at
/home/bhh/perl5/lib/solaris/5.00401/B.pm line 95.
END failed--cleanup aborted.

I can't seem to find the method "first" using grep liberally.  Am I 
overlooking something basic here?  The command I used to compile
the perl program was:

bperl -MO=C,-ofoo.c foo.pl

I am using perl5.004_01 and the alpha3 release of the compiler.

Thanks for the help,

Brad Hochstetler
Software Engineer
ITI
bhh@iti-oh.com


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

Date: Thu, 9 Oct 1997 07:36:58 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: delazzer <delazzer@pascal.pprd.abbott.com>
Subject: Re: Perl Installation Question
Message-Id: <Pine.GSO.3.96.971009072757.23840F-100000@usertest.teleport.com>

On Wed, 8 Oct 1997, delazzer wrote:

> A friend gave me a tar file that has Perl 5.004_03. The Perl web page
> says 5.004_01 is the latest version. Is 5.004_03 the latest or is
> 5.004_01? 

_01 is the latest released version; _03 has not been officially released
(as I understand things). For most people, there's no real difference
between the two; just a few bug fixes for things you're not likely to
notice. :-)

> Is it ok to install a newer version of Perl even when there is an older
> version in my PATH? 

Yes. In fact, it's normal to keep the older binary around, under a name
like /usr/local/bin/perl5.003, which allows you to run that binary if you
discover a problem with the new one.

> I noticed that the following lines are in the makefile file

> perl keywords.pl
> perl opcode.pl
> perl embed.pl
> 
> Since these lines do not specify a directory, I thought maybe the older
> version would be used.

Since you're not required to have Perl to install Perl :-)  those lines
probably use the new binary. (I suspect that the PATH is set before those
lines are run.) In fact, if those ran the old binary, I'd call it a bug.
If you're really worried about it, you could disable the old binary before
starting to build the new one - but I wouldn't bother.

Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 09 Oct 1997 13:17:48 +0200
From: md4calle@mdstud.chalmers.se (Calle ]sman)
Subject: Q: how to specify how many decimals a calcultaion shall have?
Message-Id: <w7pyb43uqw3.fsf@fraggel34.mdstud.chalmers.se>


I want to make sure that the calculation delievers three decimals (at most)
e.g. 
 23.3245

shall become
23.3245

any idea how I do this in Perl?
in C, something like:

r=(float)((int)(r*1000+5))/1000.0;

would work (I believe), but no idea how to do it in Perl..

all best,

/Calle

**************************************************************************
*         *         My homepage about the author Tom Holt:               *
*        /_\        http://www.mdstud.chalmers.se/~md4calle/holt/        *
*     { ~._.~ }                                                          *
*      (  Y  )      other things like OnLine Guitar Archive linkpage     *
*     ( )~*~( )     and heaps of musiclinks can be found at              *
*     (__)-(__)     http://www.mdstud.chalmers.se/~md4calle/             *
**************************************************************************



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

Date: 9 Oct 1997 13:41:18 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: Q: how to specify how many decimals a calcultaion shall have?
Message-Id: <61imtu$br4$1@daily.bbnplanet.com>

Calle ]sman (md4calle@mdstud.chalmers.se) wrote:

: I want to make sure that the calculation delievers three decimals (at most)
: e.g. 
:  23.3245

: shall become
: 23.3245
Err you mean 23.324 ?

: any idea how I do this in Perl?
: in C, something like:
: r=(float)((int)(r*1000+5))/1000.0;

What happens if your number is too large to be represented by an int ?

Do you want to truncate the final results of your calculations  ?
If so a search of the faq for "round" will help.

Jason Gloudon


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

Date: Thu, 09 Oct 97 07:49:49 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: system() won't run shell script correctly
Message-Id: <343cc581$1$ofn$mr2ice@speaker>

In <343b92db.230794@news.one.net>, on 10/08/97 at 02,
   over@the.net (dave) said:
+-----
| shell. But what you are saying is that Perl makes a distinction between:
|    system( "xterm -e rlogin foo" );
| and
|    system( "PATH=$PATH:/usr/bin/X11; xterm -e rlogin foo" );
| Are you sure it makes this distinction?
+--->8

Yes, Perl makes the distinction.  It sees system with a single argument which
contains a special character (the semicolon) known to be significant to the
shell, and spawns a shell to process the command.

(BTW, did you really intend the perl variable $PATH to be interpolated?)

-- 
brandon s. allbery              [Team OS/2][Linux]          bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)                 KF8NH
Warpstock '97:  OS/2 for the rest of us!  http://www.warpstock.org
Memo to MLS:  End The Burn Scam --- Doug Logan MUST GO!  FORZA CREW!



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

Date: 9 Oct 1997 13:48:59 GMT
From: jarkko@avalon.merikoski (Jarkko Juntunen)
Subject: Text formatting question
Message-Id: <61incb$2ns@pan.otol.fi>

Is it possible to make format which put names and addresses in fife columns
like this:

Name1        Name2        Name3        Name4        Name5
Address1     Address2     Address3     Address4     Address5
zip1 City1   zip2 City2   zip3 City3   zip4 City4   zip5City5


I'm just a newbie with perl and I don't even have my own Camel-book:-)

-- 
-------------------------------------------------------------------------
Jarkko Juntunen      jarkko@avalon.merikoski.fi      Tel. +358 8 5306 977
-------------------------------------------------------------------------



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

Date: Thu, 9 Oct 1997 07:48:28 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jarkko Juntunen <jarkko@avalon.merikoski>
Subject: Re: Text formatting question
Message-Id: <Pine.GSO.3.96.971009073837.23840G-100000@usertest.teleport.com>

On 8 Oct 1997, Jarkko Juntunen wrote:

> So, is it possible to format text with Perl something like this. 

Sure! Perl can do anything! :-)

> So this is what it soppesed to look pinted in paper
> 
> Name1          Name2         Name3        Name4         Name5
> Address1       Address2      Address3     Address4      Address5
> zip1 City1     zip2 City2    zip3 City3   zip4 City4    zip5 City5
> 
> Names and addressese in fife columns.

Must be wide paper. :-)

The thing to do is to make your own output routine, perhaps something like
this.

    {	# Local scope
	my @cache;	# Persistent private variable

	sub flush_addresses {
	    # Do something here to print the addresses
	    # from @cache, maybe like this.
	    printf "%25s %25s %25s %25s %25s\n",	# names
		map $cache[$_][0], 0..$#cache;
	    printf "%25s %25s %25s %25s %25s\n",	# addresses
		map $cache[$_][1], 0..$#cache;
	    printf "%25s %25s %25s %25s %25s\n",	# zip & city
		map "$cache[$_][2] $cache[$_][3],
		    0..$#cache;
	    print "\n";
	    @cache = ();	# empty the cache
	}

	sub one_address {
	    my($name, $addr, $zip, $city) = @_;
	    push @five_addresses, [ $name, $addr, $zip, $city ];
	    flush_addresses if @five_addresses = 5;
	}
    }

Now, just call one_address for each address, and be sure to use
flush_addresses at the end, to get any remaining ones. If you want to, you
could extend this method to organize the columns so that you can read down
each one, but that's left for you to do. :-) 

Have fun with it!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 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 1150
**************************************

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