[10857] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4458 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 19 01:07:17 1998

Date: Fri, 18 Dec 98 22:00:19 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 18 Dec 1998     Volume: 8 Number: 4458

Today's topics:
    Re: $&, $', and $` and parens.... (Larry Rosler)
        ------What should I use as a Win32 perl interpreter---- (Brett Summerer)
    Re: ? (question mark) not recognised. (Jason Q.)
    Re: ? (question mark) not recognised. <aqumsieh@matrox.com>
    Re: @INC   and perl <peter@berghold.net>
        bless Perl objects or references <rakesh_puthalath@hotmail.com>
    Re: Calling Perl from Perl? (brian d foy)
    Re: CGI tools - Shopping Basket birgitt@my-dejanews.com
    Re: Complicated sorting problem (Charles DeRykus)
    Re: Disk Free <peter@berghold.net>
    Re: Favourite Editor for NT Perl <peter@berghold.net>
        help with MakeMaker <andrew.keyes@attws.com>
    Re: I know this sounds stupid... (I R A Aggie)
    Re: I know this sounds stupid... <dredlich@ipipeline.net>
    Re: I know this sounds stupid... <dredlich@ipipeline.net>
    Re: Nested sorting (Bill Moseley)
    Re: numbers in base 36 (Matthew Bafford)
    Re: Parsing image tags (Martin Vorlaender)
    Re: Perl & Microsoft IIS Server <peter@berghold.net>
        Perl on UNIX and Windows <mikael.rezo@wanadoo.fr>
        Reading in data from a text file <mikej@1185design.com>
        Retrospective on comp.lang.perl.moderated? (Larry Rosler)
    Re: Searching through a 10MB file (Charles DeRykus)
    Re: shift. <peter@berghold.net>
    Re: STANDARD PERL for WIN 95/NT EXECUTABLE bjm@a2b01118.paralynx.bconnected.net
    Re: Writing many files efficiently (Mark-Jason Dominus)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 18 Dec 1998 17:13:41 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: $&, $', and $` and parens....
Message-Id: <MPG.10e49da3139e16c09898dd@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <x7ogp1m1rn.fsf@sysarch.com> on 18 Dec 1998 19:08:44 -0500, 
Uri Guttman <uri@sysarch.com> says...
> >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
> 
>   LR> Before I change any of my code, I'd like to hear more, from those who 
>   LR> have repeatedly imprecated against the special variables.  It is 
>   LR> possible that improvements in the regex engine have obsoleted those 
>   LR> warnings.
>  
> larry, here are some thoughts that may clear your mind.
> 
> the special vars are around all the time so storing results to them may
> be faster than creating $1, $2 on the fly. 
> 
> the caveat about $& and friends was that if you didn't use them ANYWHERE
> in the program things would run faster. using them once triggered a
> compiler flag to make them effectively used every time you do a
> regex. that is the loss, not the actual use of them but the hidden
> global use of them.
> 
> try your benchmarks again with one program not having any mention of $&
> and friends. then try the same code again with a single (non
> benchmarked) use of $&. then run again with all possible
> benchmarks. that might illuminate some things.

#!/usr/local/bin/perl -w
use Benchmark;

$a = 'x' x 50 . '1' . 'y' x 50;
#$a =~ /\d/; my ($pre, $match, $post) = ($`, $&, $');

timethese(1 << (shift || 0), {
 Anchor  => sub { my ($pre, $match, $post) = $a =~ /^(.*?)(\d)(.*)/ },
 Unanch  => sub { my ($pre, $match, $post) = $a =~ /(.*?)(\d)(.*)/ },
#Special => sub { $a =~ /\d/; my ($pre, $match, $post) = ($`, $&, $') },
});
__END__

Both statements with special variables commented out
Benchmark: timing 65536 iterations of Anchor, Unanch...
    Anchor:  6 wallclock secs ( 5.12 usr +  0.02 sys =  5.14 CPU)
    Unanch:  6 wallclock secs ( 5.03 usr +  0.00 sys =  5.03 CPU)

Benchmark commented out
Benchmark: timing 65536 iterations of Anchor, Unanch...
    Anchor:  5 wallclock secs ( 5.31 usr +  0.00 sys =  5.31 CPU)
    Unanch:  4 wallclock secs ( 5.25 usr +  0.00 sys =  5.25 CPU)

Nothing commented out
Benchmark: timing 65536 iterations of Anchor, Special, Unanch...
    Anchor:  6 wallclock secs ( 5.42 usr +  0.00 sys =  5.42 CPU)
   Special:  1 wallclock secs ( 2.36 usr +  0.00 sys =  2.36 CPU)
    Unanch:  6 wallclock secs ( 5.73 usr +  0.00 sys =  5.73 CPU)

> also ilya may have sped thengs up so the global penalty of $& is
> lessened so the local speedup (by not allocating $1, etc), is a win now.

I get the impression that the penalties of all of the special variables 
are close to trivial at this point.  But the benefit of their use 
instead of explicit captures may be dramatic.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sat, 19 Dec 1998 03:30:33 GMT
From: summere1@pilot.msu.edu (Brett Summerer)
Subject: ------What should I use as a Win32 perl interpreter-----
Message-Id: <367b1d23.14274733@liz>

	Right now I use ActivePerl, because it's free.  Any other
ideas?  Also, does anyone know where I can find a decent book on
getting perl scripts to run on a NT box?  All of the ones that I found
are written with UNIX in mind.  I do my development on Sparqs, but our
web server is Domino on NT.

	-Brett Summerer
summere1@pilot.msu.edu


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

Date: Sat, 19 Dec 1998 01:53:55 GMT
From: pigs_can_fly@mindless.com (Jason Q.)
Subject: Re: ? (question mark) not recognised.
Message-Id: <367d04cd.1388248@news.cyberway.com.sg>

>Of course, on reading the code, it's not clear to me why you're using
>the regex engine at all: you could just as well use index, or maybe
>string comparison (if you're looking for lines that exactly match
>$RSTRING1 rather than lines that contain $RSTRING1).  Also, what is $i
>used for -- why are you even using a foreach loop, if you increment a
>counter each time through?

The reason why I added the $found++ was so as to be able to find the
line number with $halt=$found and then use that number to splice.

I'm sure there's an easier way to do it but I'm still new to Perl and
am using whatever little commands I know to build something. :)

>In fact your whole algorithm seems awfully clunky to me.  I'll assume
>you're looking for lines that *match* $RSTRING1 rather than *contain*
>it; I would rewrite everything in between the read-file and write-file
>steps as follows:

>
>  foreach (@array)
>  {
>    $_ = $RSTRING2 if $_ eq $RSTRING1;
>  }

I tried your method but when I print @array back to the file, the
change wasn't reflected. Is there any other command I must include to
properly print the modified @array back?

Thanks for your help. Appreciated.


Jason Q.


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

Date: Fri, 18 Dec 1998 19:26:34 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: ? (question mark) not recognised.
Message-Id: <x3yk8zp9dty.fsf@tigre.matrox.com>


pigs_can_fly@mindless.com (Jason Q.) writes:

> 
> I can't figure what's wrong with my code.
> 
> Basically it searches for $RSTRING1, then splice it with $RSTRING2.

[snip]
 
> How do I get the code to recognise the "?"

First step: read perlre
Second step: read ahead

[some more snips]

> Any help would be appreciated.

Read below. (did you read perlre yet?)

> ----------------------------------------------------------------
> 
> $RSTRING1 = "$Value[$question1]	$Value[$answer1]";
> $RSTRING2 = "$Value[$question2]	$Value[$answer2]";
> 
> open(HANDLE, "$datafile");

ALWAYS check the result of open():

open HANDLE, $datafile or die "Error opening $datafile: $!\n";

> @array = <HANDLE>;

This might not be a good idea depending on the size of your file and
what you intend to do with it. It reads the whole file into memory,
which might not be very efficient.

> close(HANDLE);

Again, check the result of your close(). (similar to open() above)

I gazed at the screen for more than two minutes in amazement when I
saw the code below! What a way to traverse an array!

> $found = 0;
> 
> foreach $i (@array)
> 	{

here, $i will iterate through the elements of the array, one by one (I
hope you know this, as you don't make any use of $i in your code!)

> 		if ($array[$found] =~ $RSTRING1)

                    ^^^^^^^^^^^^^^
                   why not use $i ??

                                      ^^^^^^^^^^
				That is the wrong way to do a pattern
				match. Read perlre.

		if ($i =~ /\Q$RSTRING1/) 

> 			{
> 			$halt = $found;
> 			}
> 	$found++;
> 	}
> splice (@array, $halt, 1, "$RSTRING2\n");

But, that will replace only the *last* element in @array that matched
$RSTRING1 (since you overwrite $halt in each iteration) .. is this what
you want? 

> 
> open(HANDLE, ">$datafile");
> print HANDLE @array;
> close(HANDLE);

Ok ... now for alternatives:

TIMTOWDTI:

1)
for $i (@array) {
	$i =~ s/\Q$RSTRING1/$RSTRING2/;
}

2) map { s/\Q$RSTRING1/$RSTRING2/ } @array;

(You shouldn't really use map() in a void context, but sometimes it's
useful.)

3) 
for $i (0..$#array) {
	$array[$i] =~ s/\Q$RSTRING1/$RSTRING2/;
}


I can think of at least 5 more variations, but that should be enough.

Ala



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

Date: Sat, 19 Dec 1998 03:32:22 GMT
From: "Peter L. Berghold" <peter@berghold.net>
Subject: Re: @INC   and perl
Message-Id: <367B1E43.3718EEB2@berghold.net>


Hash: SHA1

"Kevin R. Price" wrote:



  >> Where or what is the @INC file, and how can I edit it to put in the
  >> correct path to where those library modules can be found?


Kevin,

@INC is an array pre-defined by PERL and not a file.  You can "edit" it
by doing something like:

BEGIN{
    push(@INC,"/some/path/some/where");
}

Everything from BEGIN{ to } is executed by the interpreter before the
rest of the code is executed.  Pushing a directory
path into the @INC array causes that directory to be searched for Perl
modules (files ending in .pm normally) when the
interpreter then encounters a "use" statement.

Hope this helps,




Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBNnseMQAhoGegKVSeEQKMLgCfRzliCd7+1Sh1cQ9CMh3z6SMj/FIAoMua
7uK3E41h/DQAuahKn/SjZW/H
=wdJI
-----END PGP SIGNATURE-----

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Peter L. Berghold                               Peter@Berghold.net
"Those who fail to learn from history           http://www.berghold.net
are condemned to repeat it."                       ICQ# 11455958




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

Date: Sat, 19 Dec 1998 09:37:30 +0800
From: Rakesh Puthalath <rakesh_puthalath@hotmail.com>
Subject: bless Perl objects or references
Message-Id: <367B035A.5D05B584@hotmail.com>

Can someone explain this topic, and the code following it . This
clipping is from perlobj man page.

     A clarification:  Perl objects are blessed.  References are
     not.  Objects know which package they belong to.  References
     do not.  The bless() function uses the reference to find the
     object.  Consider the following example:

         $a = {};
         $b = $a;
         bless $a, BLAH;
         print "\$b is a ", ref($b), "\n";

     This reports $b as being a BLAH, so obviously bless()
     operated on the object and not on the reference.
 

Thanks
Rakesh



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

Date: Fri, 18 Dec 1998 20:45:13 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Calling Perl from Perl?
Message-Id: <comdog-ya02408000R1812982045130001@news.panix.com>

In article <367AEFAC.BF61CE48@pa.dec.com>, arvindk@pa.dec.com posted:

> Is the only way of calling one Perl script from another by using exec or
> system calls?
> If there are other ways, can the two Perl scripts communicate with each
> other (basically to send status messages such as 'Completed' etc)?

do any of the ways mentioned in the perlipc man page work for you?

-- 
brian d foy                     <brianNOSPAM@NOSPAM.smithrenaud.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
remove NOSPAM or don't.  it doesn't matter either way.


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

Date: Sat, 19 Dec 1998 01:51:23 GMT
From: birgitt@my-dejanews.com
Subject: Re: CGI tools - Shopping Basket
Message-Id: <75f0qq$14r$1@nnrp1.dejanews.com>

In article <754afc$v28$1@nnrp1.dejanews.com>,
  me@alistair.com wrote:
> Well, a lot of people really hype this program, but unless you have a degree
> in computer science, or you know someone who does, don't bother.  It is a
> pretty complex setup, and there is ZERO support.  The docs that come with it
> are not particularly complete, and there is no help forthcoming from the
> author.
>
> I was very excited to get Minivend going, and gave it the ol' 'College Try'
> for almost a month, posting requests for help in the discussion group and a
> fairly detailed request for some assistance from the author, but I got
> nothing.
>
> After a month of flailing about (and getting some professional help, whose
> comment was "This documentation sucks" for the machine I was setting up on) I
> have decided to look elsewhere.
>
> In short: I hear Minivend is a great Shopping Cart, and it is free, but Caveat
> Emptor!  If it is free, don't expect anyone to help you get it going...
>

It is not the fault of the free software package or the author, who has
written it, that there is a general misconception about free software. Using
a free GLP'ed software package never includes (the right for) free technical
support. . And if you would give it some thoughts, on the long run, it
couldn't possibly be different.


birgitt



-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Sat, 19 Dec 1998 01:01:29 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Complicated sorting problem
Message-Id: <F46tIH.LI@news.boeing.com>

In article <MPG.10e2d69be14ac7b2989962@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>[Posted to comp.lang.perl.misc and copy mailed.]
>
 >+ 
 >+ Examples:
 >+ 
 >+ 	$cache{$a} |||= -M $a
 >+ 	$one = shift ||| 1;
 >+ 
 >+ It would keep the left side value value, if it is defined (even if
 >+ "false"). Otherwise, the right side is evaluated. Mmmm... *I* like it.
>
>That is enticing, and obviates the wordy locution I posted in the thread 
>


Wouldn't something deep within you snap though if you saw:

  $bah  = (($hash{$foo} || $hash{$bar}) ||| -M $a ||| baz());
  

A hideous case of pipe-itis if ever there was one. Why not
something like "first" (which I recall some other Larry 
suggested :)

  $bah = first( $hash{$foo} || $hash{$bar},  -M $a,  baz());


--
Charles DeRykus


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

Date: Sat, 19 Dec 1998 03:16:01 GMT
From: "Peter L. Berghold" <peter@berghold.net>
Subject: Re: Disk Free
Message-Id: <367B1A70.F4FEDFD0@berghold.net>

Pep Mico wrote:
>> And when I executed your script line it just outputs number "1".

Uh-oh!  Sounds like it's time to upgrade that disk! :)
just kidding....



--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Peter L. Berghold                               Peter@Berghold.net
"Those who fail to learn from history           http://www.berghold.net
are condemned to repeat it."                       ICQ# 11455958




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

Date: Sat, 19 Dec 1998 03:13:36 GMT
From: "Peter L. Berghold" <peter@berghold.net>
Subject: Re: Favourite Editor for NT Perl
Message-Id: <367B19DF.E40725A1@berghold.net>


Hash: SHA1

Kirby James wrote:

  >> After using Notepad for some time I've decided to treat myself....
  >> ... Anyone like to suggest the 'best' editor for Perl under Windows
NT.



Kirby,

You are about to touch off a "holy war" with that question.  Everyone
has a preference for what editor to use.  I'm an
EMACS bigot myself and have long ago installed a Win32 version of EMACS
onto my Windoze NT workstation for
editing perl.   It is prety much up to you though....




Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBNnsZ1AAhoGegKVSeEQJsFgCfaqDtpZGZb8k6Bxk3EV23BfupYbgAnjTG
es4m2fJazjN5r4K5cQE9+EHu
=h58Q
-----END PGP SIGNATURE-----

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Peter L. Berghold                               Peter@Berghold.net
"Those who fail to learn from history           http://www.berghold.net
are condemned to repeat it."                       ICQ# 11455958




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

Date: Fri, 18 Dec 1998 18:57:46 -0800
From: Andrew Keyes <andrew.keyes@attws.com>
Subject: help with MakeMaker
Message-Id: <367B162A.3552@attws.com>

Platform info:
uname -a
SunOS pedev 5.5.1 Generic_103640-06 sun4u sparc SUNW,Ultra-Enterprise

perl -v
This is perl, version 5.003 with EMBED
	built under solaris at Jan 31 1997 08:40:37
	+ suidperl security patch

This machine defaults to using gcc, however my other machine
defaults to cc with a completely diffent set options.
{uname} SunOS grover 4.1.3_U1 5 sun4m

How does MakeMaker decide to use cc or gcc? 
Since doing a
perl Makefile.PL CC=cc
is not enough to change the compiler options settings, is there
some other way to tell MakeMaker to use a different compiler, which
also provides the correct options? I'm only asking this because
I'm going between the two most standard C compilers for the suns.

Andrew Keyes
Ursus Technologies, Inc.


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

Date: Fri, 18 Dec 1998 22:24:51 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: I know this sounds stupid...
Message-Id: <fl_aggie-1812982224510001@aggie.coaps.fsu.edu>

In article <75em34$mi@netaxs.com>, devin@pctc.com wrote:

+ built the module, then as root I did a make install 

I believe that 'make install' will do a 'make' first, and an 'install'
second. So there are files in there that belong to root. And trying to
trash 'em as a user should get you 'permission denied' not a hung system.

I'd ask SCO, if I where you.

James - or install linux...


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

Date: Fri, 18 Dec 1998 20:30:38 -0800
From: "Devin Redlich" <dredlich@ipipeline.net>
Subject: Re: I know this sounds stupid...
Message-Id: <75fa64$s64@netaxs.com>

>Ouch ! I'm not being weird here but I dont think anyone here can help you
>it sounds like you've either got a seriously screwed up filesystem or a
>seriously screwed up operating system - I'd fsck the hell out of the
>filesystem in question and if that doesnt remedy the problem I'd go to the
>OS vendor and give them a raving ...


I just found it highly unusual that two separate systems on different
hardware crashed in exactly the same manner when deleting the same directory
tree.  I know this *shouldn't* happen.  I was grasping at straws.

If I had my way, all SCO media would be tied to a concrete block and sunk to
the bottom of the ocean...



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

Date: Fri, 18 Dec 1998 20:37:25 -0800
From: "Devin Redlich" <dredlich@ipipeline.net>
Subject: Re: I know this sounds stupid...
Message-Id: <75faih$t8j@netaxs.com>

>I believe that 'make install' will do a 'make' first, and an 'install'
>second. So there are files in there that belong to root. And trying to
>trash 'em as a user should get you 'permission denied' not a hung system.

Sorry, I did a make, then a make install.

>I'd ask SCO, if I where you.
>
>James - or install linux...

Any server I administer has linux on it.  Unfortunately, these two systems
aren't under my control.

Just for the hell of it, I tried this exact same operation on one of my
Linux boxes.  Believe it or not, deleting the directory tree did *not* cause
Linux to kernel panic...

Devin "SCO is for masochists" Redlich




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

Date: 19 Dec 1998 05:31:58 GMT
From: moseley@best.com (Bill Moseley)
Subject: Re: Nested sorting
Message-Id: <367b3a4e$0$214@nntp1.ba.best.com>


In article <MPG.10e4979bfeac0119898dc@nntp.hpl.hp.com>, lr@hpl.hp.com says...
>What I mean is that when the data are ready for sorting, you do one pass 
>over them to prepare keys that can be used to do the actual sorting.

Yes, that makes sense.  And I do preprocess the entire list.

Sorting on a number of fields, and in mixed assending and desending order of
different keys doesn't seem like an uncommon problem.  And perlfaq4 gives
an example of how to do it if you know your keys ahead of time.

My situation is slightly different in that I don't know how many sort 
keys I have and which ones are assending and which are desending sort 
order until run time.  Thus, the loop and the ($aa, $bb) = ($bb, $aa) swap.

So I'm having a hard time finding a place to trim the fat in my sort routine.


Thanks very much for all your input.



--------------
Bill Moseley
moseley@best.com



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

Date: Fri, 18 Dec 1998 23:35:39 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: numbers in base 36
Message-Id: <MPG.10e4f70a47dd4358989766@news.scescape.net>

In article <75d90c$h4f$1@nnrp1.dejanews.com>, deja@kiama.com says...
=> Is there a way for perl to read numbers in bases other 8,10, and 16?
=> 
=> There is a function in Java to format an integer in any base, I would like to
=> create a base 36 number in java and pass it to a perl script. Can perl convert
=> it back to decimal?

Well, I looked back through my old *ha* scripts, and dug up: (minus the 
error checking)

sub dec2base {
    use integer;  # For while loop
    my @chars  = (0..9, 'A'..'Z');
    my $base   = shift;
    my $number = shift;
    my $ret;

    while ( $number > 0 ) {
        $ret    .= $chars[$number%$base];
        $number /= $base;
    }

    $ret = reverse $ret;
    return $ret;
}

sub base2dec {
	my %chars;
	@chars{(0..9, 'A'..'Z')} = (0..35);
		
	my $base   = shift;
	my $number = reverse(shift);
	my $ret;
	my $multi = 1;

	for ( split //, $number ) {
		$ret   += $chars{$_} * $multi;

		if   ( $multi == 1 ) { $multi  = $base }
		else                 { $multi *= 2     }
	}

	return $ret;
}

I probably would have written it differently now, but it does work. :)

Of course, it has some limitations...  No bases over 36, or under 2.  It 
only accepts upper case letters (easily fixable).  Plus others I'm not 
seeing right now, I'm sure.

Anyway,

HTH!

--Matthew


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

Date: Fri, 18 Dec 1998 23:02:43 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Parsing image tags
Message-Id: <367ad103.524144494f47414741@radiogaga.harz.de>

pedja@dds.nl wrote:
: I want to extract all image tags and his elements from html file.
: For example:
:  <img src="left.gif" alt="Go left" width=40 height=50>
: must return:
: -absolute path="http://www.dejanews.com/left.gif"
: -alt="Go left"
: -width=40
: -height=50
:
: Can you give me example with use of HTML Parser or without.

{
   package ImageParser;

   use HTML::Parser;

   @ImageParser::ISA = 'HTML::Parser';

   sub new
   {
      my $class = shift;
      my $self = $class->SUPER::new();
      bless $self, $class;
   }

   sub start
   {
      my ($self, $tag, $attr) = @_;

      if ($tag eq 'img')
      {
         # All the attributes (src,alt,...) and their values are in %$attr
         # You must provide the base url for src yourself
      }
   }
}

cu,
  Martin
--
                        | Martin Vorlaender | VMS & WNT programmer
 VMS is today what      | work: mv@pdv-systeme.de
 Microsoft wants        |       http://www.pdv-systeme.de/users/martinv/
 Windows NT 8.0 to be!  | home: martin@radiogaga.harz.de


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

Date: Sat, 19 Dec 1998 03:23:26 GMT
From: "Peter L. Berghold" <peter@berghold.net>
Subject: Re: Perl & Microsoft IIS Server
Message-Id: <367B1C2D.FC8DE4E6@berghold.net>


Hash: SHA1

johkar wrote:


  >> a UNIX server.  Will these work on a Windows based Microsoft server
  >> anyway?  If not, what is the difference and can they be adapted? At
work
  >> they just switched to a Microsoft server.



My condolances.  As a Unix/Linux bigot I hate seeing people make that
mistake. Hopefully they will live to regret it...

Without looking at the actual code you are planning to use I'm just
making an educated guess here.  The main differences
that I can think of is anywhere a "system" is executed the commands may
be either different or non-existant.  For
instance if they are doing something silly like a "df" (why? I can't
think of why...) as in system("df") that is obviously going
to fail as there is no df command on NT.

Other places to worry:  File pathnames are going to change.

Other than those two main concerns (there are probably others, but I'm
just barely functional right now amd can't think
of any more...) I have used Perl with IIS using the ISAPI extentions
with some moderate success.  I've even written CGI
scripts that plunk and glomb data to and from MSSQL.





Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBNnscJAAhoGegKVSeEQKwggCg+b4tkFr1A8XoprxtSji70gP3qTMAoOcU
fqqQOGC0kKORmdZWnme/99E3
=WiAs
-----END PGP SIGNATURE-----


--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Peter L. Berghold                               Peter@Berghold.net
"Those who fail to learn from history           http://www.berghold.net
are condemned to repeat it."                       ICQ# 11455958




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

Date: Fri, 18 Dec 1998 06:48:30 +0100
From: Mikael Georges <mikael.rezo@wanadoo.fr>
Subject: Perl on UNIX and Windows
Message-Id: <3679ECAE.56A3B710@wanadoo.fr>

Hi,

I'm learning PERL and I'm working on a UNIX workstation, but my web
server is running IIS 4,
I already know that I've to use Perl2Exe to make my CGIs working on this
server. But Perl2Exe
isn't freeware.
Does anybody know where I can find an equivalent for Unix or Windows
workstation ?

Thanks

Mikael Georges
www.mgbreizh.com



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

Date: Fri, 18 Dec 1998 17:18:07 -0800
From: mikej <mikej@1185design.com>
Subject: Reading in data from a text file
Message-Id: <367AFEB3.D2592358@1185design.com>

Hi everyone,

I have a script that opens a flat file database (LOG filehandle) and
attempts to read in information on each line. The information in the log
file looks like this:

17|12-18-98|mj|logo.gif|one
17|12-18-98|mj|home.gif|two
17|12-18-98|mj|employ_top.jpg|three
18|12-18-98|dp|image.jpg|image
18|12-18-98|dp|image_2.jpg|image_two

I have a form that prompts the user to type in a reference number, and
the script is supposed to search each line of the log file to see if it
matches the reference number to the number on the left to each line.
Then I try to get the data on each line that matches the reference
number they typed. It works for reading the data off the first line, but
it wont get to the second, third, fourth lines down etc. even though I
have it in a for each loop. Anyone know how to get it to search the
entire list instead of only looking at the first line only? Heres the
code in question:

#open the log file and put the data into an array
open(LOG, "post.log") || &error("Couldn't open log file \n\n$!");
@indata = <LOG>;
close(LOG);

 #supposed to assign each line's data to these 5 variables
foreach $line (@indata)
   {
    chop($line);
    ($ID, $date, $initials, $file, $description) = split(/\|/, $line);
 
# note that $referenceID is set earlier in the script to what the user
typed in the form 
#if it finds a match, do stuff, the problem is it wont check past the
first line of the log file

if ($ID eq $referenceID) {
    $unlink "../$clientname/$jobnumber/$date/$initials/$file" ||
&error("I can't delete these files!");
 
     }
    else {&error("$Found no matches in the log file.")};

Any help is much appreciated!

-Mike
 



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

Date: Thu, 17 Dec 1998 09:03:56 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Retrospective on comp.lang.perl.moderated?
Message-Id: <MPG.10e2d95848e744bd989963@nntp.hpl.hp.com>

With year-end-assessment time rapidly approaching, would anyone care to 
comment on how comp.lang.perl.moderated has performed over its life of 
six months or so, relative to the hopes and expectations of its 
proponents?

A cost-benefit analysis at this time might be enlightening.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sat, 19 Dec 1998 01:24:42 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Searching through a 10MB file
Message-Id: <F46uL6.15L@news.boeing.com>

In article <1dk7i1t.1nzm2ag167zvdhN@bay1-157.quincy.ziplink.net>,
Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
>Christian M. Aranda <christian.aranda@iiginc.com> wrote:
>
>> ... I know there is so  much more I could do to make it 
>>     faster, but in the interest of time I could not.
>

>But isn't that interest what motivated you to make your module faster in
>the first place?  ;-)

I see the problem... time being relative moves much more 
quickly as a deadline nears :)


--
Charles DeRykus


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

Date: Sat, 19 Dec 1998 03:10:54 GMT
From: "Peter L. Berghold" <peter@berghold.net>
Subject: Re: shift.
Message-Id: <367B193D.E136B25@berghold.net>

Ala Qumsieh wrote:

> om7@cyberdude.com writes:
>
> >
> > Can someone please tell me what the following does
> >
> > my $variablename = shift;
> >
> > It's being called inside a sub routine.
>
> I believe it elevates the variable into a higher level in the
> subroutine's stack.
>

Actually, it pops a value off the stack and stores it into the variable.





--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Peter L. Berghold                               Peter@Berghold.net
"Those who fail to learn from history           http://www.berghold.net
are condemned to repeat it."                       ICQ# 11455958




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

Date: 18 Dec 1998 18:23:54 -0800
From: bjm@a2b01118.paralynx.bconnected.net
Subject: Re: STANDARD PERL for WIN 95/NT EXECUTABLE
Message-Id: <x7iuf8lvid.fsf@a2b01118.i-did-not-set--mail-host-address--so-shoot-me>

>>>>> "Steven" == Steven Morlock <newspost@morlock.net> writes:

    Steven> Since the ActiveState folks are not releasing the source
    Steven> code for their port can it really be considered the
    Steven> _standard_ release?

If you grab the source and compile it, you will have the same binary
as ActiveState produces.  There is no difference.  ActiveState adds
some other components (like PPM) but you don't need these if you don't
want them.  There is no need to distribute the source with
ActiveState's Perl binary because it is exactly that: a simple binary
produced exactly from the Perl source tree.  Standard Perl ==
ActiveState Perl now.  Any change we make to the source is part of
Perl development and as such those changes are rolled into Perl
proper.  Our efforts in this respect are to directly support the
Open Source development of Perl.

    Steven> When and if will ActiveState's port of perl be fully
    Steven> rolled into the common source archive?

I guess I answered this above.

-- 
Brad J. Murray                "Cogito ergo am."
ActiveState Tool Corp.


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

Date: 18 Dec 1998 21:29:57 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Writing many files efficiently
Message-Id: <75f335$6ir$1@monet.op.net>

In article <75ep03$ont$1@shell2.ba.best.com>,
K. Krueger <kirbyk@best.com> wrote:
>Right now, I'm essentially gathering the filenames and the contents into a
>big hash, doing a foreach on the keys of that hash (the filenames), opening
>up the file, printing the contents to it, and closing it.  All in a big
>long loop.

Are you opening each file exactly once?  If you open some files more
than once, it will save time if you don't do that.  The standard
`FileCache' module makes this very easy.

Many unix systems show poor performance on directories with many
files.  Whenever you go to open a new file in a directory, it has to
do a liner search on the directory to make sure there is no file with
that name already.  Renaming the files might show an improvement.  For
example, if your files are named 0000, 0001, ... 1999, consider making
twenty subdirectories, 00..19, and storing the files in 00/00, 00/01
 ... 19/99.

Conversely, if all the files happen to be named

	/some/very/long/path/to/the/files/0119

then you can save processing time and disk I/O by chdir'ing to
the /some/very/long/path/to/the/files/ directory and then operating 
on 0000..1999 directly; it won't have to look up the seven
intermediate directories on every open.

>I'd rather find some sort of module that writes lots of files in a
>filesystem-efficient way.

If all you're going to do is open file, write data, close file, then a
module won't help, because the module would still have to open the
file, write the data, and close the file.



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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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