[10850] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4451 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 18 05:09:09 1998

Date: Fri, 18 Dec 98 02:00:20 -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: 4451

Today's topics:
    Re: $&, $', and $` and parens.... (Ilya Zakharevich)
    Re: $&, $', and $` and parens.... (Larry Rosler)
    Re: $&, $', and $` and parens.... (Ilya Zakharevich)
        A basic module not found  (Kevin M. Counts)
    Re: A basic module not found (brian d foy)
    Re: ANNOUNCE: Countdown Lite v1.0 (Ronald J Kimball)
        clearing ISAP cache. <rahulk@iname.com>
    Re: Close and ReOpen File (Ronald J Kimball)
    Re: Complicated sorting problem (Ronald J Kimball)
    Re: constructors and object methods <rakesh_puthalath@hotmail.com>
    Re: constructors and object methods (Mark-Jason Dominus)
    Re: constructors and object methods (Ilya Zakharevich)
        Happy Birthday! (Mark-Jason Dominus)
    Re: Help needed - Dynamic loading configuration <qdtcall@esb.ericsson.se>
        How to send a simple mail to a lotus notes server ? frederic.corne@erli.fr
    Re: HTML stripping scripts result in strange error (Tad McClellan)
        log using CGI.pm (6})lRD)
    Re: log using CGI.pm (brian d foy)
    Re: Need to exclude certain Characters (Tad McClellan)
    Re: Origin of 'local'? (sthoenna@efn.org)
        Parsing image tags pedja@dds.nl
    Re: Searching through a 10MB file (Ronald J Kimball)
        Shipping Script??? Help? vivekvp@hotmail.com
    Re: sort it ? (Micha3 Rutka)
    Re: Syntax Error...Not able to find. <uri@sysarch.com>
    Re: Using Exporter... (Sean McAfee)
    Re: Why Is Perl not a Language? (Ronald J Kimball)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 18 Dec 1998 04:37:10 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: $&, $', and $` and parens....
Message-Id: <75cm5m$f58$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.10e3463c25cc4ea29898d7@nntp.hpl.hp.com>:
> > I would make it
> > 
> >   m/\A(.*?)(...whatever...)(.*)/s;
> 
>       ^^   ^
> 
> \A -- Isn't the anchor-to-start implicit, just as the anchor-to-end is?

Do not know what do you mean here.  anchor-to-end?  What is this?

It *may* happen that the optimization which deals with leading [x]*
will happen in this case too, so in the case of no-match the REx will
not be tried at different offsets: one may need to check this with
-Mre=debugcolor.

> (.*?) -- Yes, to preserve the semantics of 'first match' instead of 
> 'last match'.  But I was concerned about performance impacts.  'Greedy' 
> is faster if it preserves the semantics, yes?

Depends.  As I wrote in another message, nongreedy has a potential to
be up to 3x quickier than greedy - in newer Perls only.

> > Still, it may disable many important optimizations.
> 
> More than using $` or $' does? 

$` and friends give a linear overhead only.  If an optimization
converts a super-exponential case to a linear one...

> I understand $& has been 'fixed' in 
> 5.005, but is there any reason to use $& instead of parens around the 
> match?.

No idea - offhand.

Ilya


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

Date: Thu, 17 Dec 1998 23:30:12 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: $&, $', and $` and parens....
Message-Id: <MPG.10e3a4605a6be45d989964@nntp.hpl.hp.com>

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

In article <75cm5m$f58$1@mathserv.mps.ohio-state.edu> on 18 Dec 1998 
04:37:10 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> says...
> [A complimentary Cc of this posting was sent to Larry Rosler
> <lr@hpl.hp.com>],
> who wrote in article <MPG.10e3463c25cc4ea29898d7@nntp.hpl.hp.com>:
> > > I would make it
> > > 
> > >   m/\A(.*?)(...whatever...)(.*)/s;
> > 
> >       ^^   ^
> > 
> > \A -- Isn't the anchor-to-start implicit, just as the anchor-to-end is?
> 
> Do not know what do you mean here.  anchor-to-end?  What is this?

What I meant was this:  Isn't /\A(.*?) ... equivalent to /(.*?) ... just 
as ... (.*)/ is equivalent to ... (.*)\Z/ ?

> It *may* happen that the optimization which deals with leading [x]*
> will happen in this case too, so in the case of no-match the REx will
> not be tried at different offsets: one may need to check this with
> -Mre=debugcolor.

But you imply that despite the semantic equivalence, there may be an 
optimization involved with the explicit anchor.  Should I infer from 
this that, in general, the apparently redundant /\A.* ... or /^.* ... is 
preferable to just /.* ... ?  That might be a fact of general interest.

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


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

Date: 18 Dec 1998 08:39:02 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: $&, $', and $` and parens....
Message-Id: <75d4b6$ras$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.10e3a4605a6be45d989964@nntp.hpl.hp.com>:
> What I meant was this:  Isn't /\A(.*?) ... equivalent to /(.*?) ... just 
> as ... (.*)/ is equivalent to ... (.*)\Z/ ?

Neither pair is equivalent wrt how REx will match, so I have no idea
what you mean.  With //s they may provide identical results, but we
are discussion performance here, not semantic?

> > It *may* happen that the optimization which deals with leading [x]*
> > will happen in this case too, so in the case of no-match the REx will
> > not be tried at different offsets: one may need to check this with
> > -Mre=debugcolor.
> 
> But you imply that despite the semantic equivalence, there may be an 
> optimization involved with the explicit anchor.  Should I infer from 
> this that, in general, the apparently redundant /\A.* ... or /^.* ... is 
> preferable to just /.* ... ?  That might be a fact of general interest.

If you trust Perl optimizer, they may be close in performance.  I
would not trust it with non-greedy stuff until -Mre=debugcolor.

Ilya


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

Date: Fri, 18 Dec 1998 07:28:40 GMT
From: digicat@mindspring.com (Kevin M. Counts)
Subject: A basic module not found 
Message-Id: <Iune2.2443$Ji3.286@newse2.tampabay.rr.com>

Am I crazy or should Text::Balanced be included
w/ the Perl 5.04 distribution?

When I run this test perl script:

#!/usr/bin/perl -w

use Text::Balanced;

<snip> 

I get:

Can't locate Text/Balanced.pm in @INC (@INC contains: /usr/lib/perl5/i386-linux/5.00404 /usr/lib/perl5 /usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .) at ./test_file.pl line 3.

I'd appreciate any pointers!

Thanks,

Kevin Counts - A.K.A. "DigiCat"
digicat@mindspring.com


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

Date: Fri, 18 Dec 1998 04:03:33 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: A basic module not found
Message-Id: <comdog-ya02408000R1812980403330001@news.panix.com>

In article <Iune2.2443$Ji3.286@newse2.tampabay.rr.com>, digicat@mindspring.com (Kevin M. Counts) posted:

> Am I crazy or should Text::Balanced be included
> w/ the Perl 5.04 distribution?

why do you think it should be included?  if you make a good case
perhaps it will become part of the distribution.

> Can't locate Text/Balanced.pm in @INC (@INC contains: /usr/lib/perl5/i386-linux/5.00404 /usr/lib/perl5 /usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .) at ./test_file.pl line 3.
> 
> I'd appreciate any pointers!

get it from CPAN and install it?

-- 
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: Fri, 18 Dec 1998 00:27:31 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: ANNOUNCE: Countdown Lite v1.0
Message-Id: <1dk7gw9.1flv2mboct4xiN@bay1-157.quincy.ziplink.net>

E. Preble <preble@ipass.net> wrote:

> I'd like to announce a new free script that acts like a counter
> for file downloads.  When linked to, Countdown Lite will update a
> counter file, and then autoforward the user to the download file.

So your Countdown script actually counts up?

Weird.

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 17 Dec 1998 22:56:25 -0600
From: Rahul K <rahulk@iname.com>
Subject: clearing ISAP cache.
Message-Id: <3679E079.5A25C781@iname.com>


Hi,

I have a perl script that was working sucessfully on IIS 4.0. I recently
turned on ISAPI caching  as I have some .asp applications and microsoft
recommends to turn it on for optimum performance of the server.

What the script does is very simple. When the person clicks on a button
on the page, the perl script does a ftp connection to retrieve a
file(abc.html)  from another server. The file on the other server
changes in content every 30 seconds. When I click on the button after 35
seconds, because of the ISAPI caching ( i think) , the script does not
go out a second time to retrieve abc.html. Instead it uses the old
abc.html. Is there a way I can force perlscript to clear the buffer? i
tried $| = 1 but it does not work.

I am on a winnt server sp3.

thanks in advance,

-rahul



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

Date: Fri, 18 Dec 1998 00:27:32 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Close and ReOpen File
Message-Id: <1dk7h1h.13hdrir1ot7wlcN@bay1-157.quincy.ziplink.net>

Bryce Pursley <hbpursle@duke-energy.com> wrote:

> Is there any reason I can't close and then immediately reopen a file?
> The code doesn't work when I do it in consecutive lines of one program

No, there's no reason why you can't close and then immediately reopen a
file.

There must a bug in your code.  I'd say it's where you...  oh, wait, I
haven't actually seen your code.  Never mind.

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Fri, 18 Dec 1998 00:27:33 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Complicated sorting problem
Message-Id: <1dk7h4h.frk5x794f0meN@bay1-157.quincy.ziplink.net>

Bart Lateur <bart.lateur@skynet.be> wrote:

> Uri Guttman wrote:
> 
> > tom c is on the side of just use
> >defined in an expression.
> 
> That sometimes makes life more complicated than needed.
> 
> [...]

As Uri said, this has already been discussed to death on perl5-porters.
Most recently:

<http://www.dejanews.com/dnquery.xp?search=thread&recnum=%3c199809131627
 .MAA04247@monk.mps.ohio-state.edu%3e%231/1&svcclass=dnserver>

Enjoy!

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Fri, 18 Dec 1998 12:16:28 +0800
From: Rakesh Puthalath <rakesh_puthalath@hotmail.com>
Subject: Re: constructors and object methods
Message-Id: <3679D71B.129654FC@hotmail.com>

Thank you Mark for responding.
I think what Andrew mailed was correct, although he did'nt post it on the
group,  and I assume not much differennce exists between invocation of  a
class and an object method syntatically.

Thanks
Rakesh

in Person->new()  you do not try to use the first argument
as a hash ref ... you merely use it to find out the class
name

in Person->get_name()  you immediately try to use the
first argument (a class name, not an object) as a
hash ref ... it isn't one.

hope that helps
regards
andrew

Mark-Jason Dominus wrote:

> In article <3679BEDF.F9D9EC56@hotmail.com>,
> Rakesh Puthalath  <rakesh_puthalath@hotmail.com> wrote:
> >Can't use string ("Person") as a HASH ref while "strict refs" in use at
> >Person.p
> >m line 32.
> >The suspect the problem is because of the last line in the code.
> >$x = Person->get_name();
>
> Person->get_name() is the Perl syntax for calling a class method.  But
> get_name is an object method, not a class method.
>
> What is Person->get_name() suppsoed to mean?  What object is it
> supposed to return the name of?  It doesn't make any sense, and so
> `strict' has diagnosed a real error in your program.
>
> >Why does strict compain now, although it works fine for a similar call
> >ie. after all both are object methods .
> >$he = Person->new();
>
> `new' is also a class method; that's why Person->new() works.
>
> >Does strict differentiate constructors and object methods ?
>
> No.  The complaint here is that you have asked for the ->{Name} member
> of something that is not an object, because you have called `get_name'
> as if it were a class method, and it is not a class method.
>
> >sub get_name {
> >  my $self = shift;
> >  return defined($self->{Name}) ? $self->{Name} : "Unknown";
> >}

 



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

Date: 17 Dec 1998 23:48:24 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: constructors and object methods
Message-Id: <75cmqp$2am$1@monet.op.net>

In article <3679D71B.129654FC@hotmail.com>,
Rakesh Puthalath  <rakesh_puthalath@hotmail.com> wrote:
>I assume not much differennce exists between invocation of  a
>class and an object method syntatically.

There is no syntactic difference at all.  It is a semantic difference.
A class method expects a string as its first argument.  
An object method expects an object as its first argument.

When you write

	Person->get_name()

you supplied the literal string `Person' as the first argument to the
object method `get_name'.



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

Date: 18 Dec 1998 08:34:42 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: constructors and object methods
Message-Id: <75d432$r5q$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Mark-Jason Dominus
<mjd@op.net>],
who wrote in article <75cmqp$2am$1@monet.op.net>:
> When you write
> 
> 	Person->get_name()
> 
> you supplied the literal string `Person' as the first argument to the
> object method `get_name'.

When you write

      Person->get_name()

you never know what will happen, since it may be either

      'Person'->get_name()

or

      Person()->get_name()

(usually depending on things out of your control).

Ilya


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

Date: 18 Dec 1998 05:10:53 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Happy Birthday!
Message-Id: <75co4t$1gk$1@picasso.op.net>

Perl is 11 years old today.

Happy birthday, Perl!  Congratulations, Larry!



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

Date: 18 Dec 1998 10:10:09 +0100
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: Help needed - Dynamic loading configuration
Message-Id: <isbtl195ou.fsf@godzilla.kiere.ericsson.se>

Gary Greenberg <greeng@nospam.young.epc.lmms.lmco.com> writes:

> I have selected ext/DynaLoader/dl_none.xs out of the list and config
> and make finished successfully,

On every Solaris machine I've tried it on (2.4, 2.5.1, 2.6 and 2.7)
the configure script gives the correct value as the default. Doesn't
it do that on your machine? If so, what value *does* it give?
-- 
   Calle Dybedahl, qdtcall@esavionics.se, http://www.lysator.liu.se/~calle/
      Truth is stranger than fiction, because fiction has to make sense.


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

Date: Fri, 18 Dec 1998 08:12:10 GMT
From: frederic.corne@erli.fr
Subject: How to send a simple mail to a lotus notes server ?
Message-Id: <75d2op$bkb$1@nnrp1.dejanews.com>

Hi,

I am trying to transpose  a very trivial  thing on unix to a NT machine
connected to a lotus Notes E-mail server.
On unix to send a e-mail to my SMTP server I do :
open (OUT , "| mail john@foo.bar") || die "open mail : $!\n";
print OUT "...."
close OUT;
and it is all !

On nt I have to use W32:OLE but I am unable to write more than one line !:
my $Notes = Win32::OLE->new('Notes.NotesSession') || die "...";

and now ? how to specify my account , to send my password, to compose a
message ? (I want only to send a message, not to consult the incomming
messages or the database)

Any help apreciated  (any hint, any example , any url , any doc ...) !

Thanks you in advance

FC

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


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

Date: Thu, 17 Dec 1998 22:26:01 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: HTML stripping scripts result in strange error
Message-Id: <pglc57.ioq.ln@magna.metronet.com>

Mark Wright (markscottwright@hotmail.com) wrote:

: /<(?:[^>'"]*|(['"]).*?\1)*>/: regexp *+ operand could be empty at
: d:\bin\striphtml.pl line 2.

: What the heck does this mean?


   The messages that perl might issue are documented in the 
   'perldiag' man page that is included with the perl distribution.


---------------------
=item regexp *+ operand could be empty

(F) The part of the regexp subject to either the * or + quantifier
could match an empty string.
---------------------


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 18 Dec 1998 05:05:08 GMT
From: youzi.bbs@MSIA.pine.ncu.edu.tw (6})lRD)
Subject: log using CGI.pm
Message-Id: <3S8AdP$8Oy@MSIA.pine.ncu.edu.tw>


        I used remote_host() to read where the user came from,
        but when remote user use proxy server to catch data,
        I can only know the proxy server's IP, but not the real one,
        what shall I do?  
        Thanks for answering.
--

                DreamSite...-\|/-\|/-...loading

                        http://MSIA.pine.ncu.edu.tw/~youzi/

!0 (S7=:!E$j,u*a*:0j+W MSIA.pine.ncu.edu.tw!E[FROM: sserv.cc.ncu.edu]


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

Date: Fri, 18 Dec 1998 00:32:17 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: log using CGI.pm
Message-Id: <comdog-ya02408000R1812980032170001@news.panix.com>

In article <3S8AdP$8Oy@MSIA.pine.ncu.edu.tw>, youzi.bbs@MSIA.pine.ncu.edu.tw (6})lRD) posted:

>         I used remote_host() to read where the user came from,
>         but when remote user use proxy server to catch data,
>         I can only know the proxy server's IP, but not the real one,

that's how it is.

>         what shall I do?  

something else.  down that road is a dead end.

-- 
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: Thu, 17 Dec 1998 22:05:24 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Need to exclude certain Characters
Message-Id: <4akc57.fkq.ln@magna.metronet.com>

Michael (mdevivio@vitamins.net) wrote:

: I need to exclude certain characters from a screen name field I am
: working on. I just want [a-z][A-Z][0-9] but want to make sure nothing
: else gets in such as $^&*( etc.


die "'$name' is an illegal screen name" unless $name =~ /^[a-zA-Z0-9]+$/;


: I am unsure of the format of this. My e-mail address is
: mike@vitamins.netX (remove the X after net so I don't get spammed).


   remove the X after net so you can get email responses.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 16 Dec 1998 17:04:15 GMT
From: sthoenna@efn.org (sthoenna@efn.org)
Subject: Re: Origin of 'local'?
Message-Id: <Pg+d2gzkgqDM092yn@efn.org>

In article <756odr$2bos$1@beast.euro.net>, Hans Mulder <hansmu@xs4all.nl> wrote:
>David L Nicol <david@kasey.umkc.edu> wrote:
>>Steven Morlock wrote:
>>> I have had an opportunity to develop in several different
>>> languages and I never encountered anything quite like 'local'.
>>>
>>Really?  Ever "develop" in Pascal?  Local implements scoping so that
>>references to non-declared variables in called routines get the variable
>>with that name from the calling function rather than the global
>>namespace, just like Pascal variables.
>
>Errhm, no.  That's what "my" does.  "Local" does dynamic binding.
>Dynamic binding is featured in some ancient Lisp dialects, but not
>in modern language.  To see the difference, consider:
>
>	$x = "hello\n";
>
>	sub print_x { print $x; }
>
>	sub call_it {
>	        local $x = "goodbye\n";
>	        &print_x;
>	}
>
>	&call_it;
>
>This prints "goodbye", i.e. the value of $x at the time &print_x
>is called.  If you replace the "local" by a "my", you'd get "hello",
>i.e. the value of the variable $x in scope at the point where
>&print_x is defined.
>
>If you translate the example to Pascal, you get "hello", since
>Pascal does lexical scoping.

Perhaps what he was thinking about was:

$x = "hello\n";
sub call_it {
   my $x = "goodbye\n";
   local *print_x = sub { print $x; };

   &print_x;
}
&call_it;

Here, the corresponding pascal code would indeed print "goodbye", not
"hello".  But Pascal still is doing lexical scoping, it just has a more
sophisticated mechanism than C.


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

Date: Fri, 18 Dec 1998 08:05:33 GMT
From: pedja@dds.nl
Subject: Parsing image tags
Message-Id: <75d2cc$b9c$1@nnrp1.dejanews.com>

Hi,

I am new in perl..
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.
Sorry for bad english!


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


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

Date: Fri, 18 Dec 1998 00:27:34 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Searching through a 10MB file
Message-Id: <1dk7i1t.1nzm2ag167zvdhN@bay1-157.quincy.ziplink.net>

Christian M. Aranda <christian.aranda@iiginc.com> wrote:

> Thanks for all the help, guys!  Below, please find my modified version
> of the mudule.  It is MUCH faster than the first.  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?  ;-)

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Fri, 18 Dec 1998 09:20:00 GMT
From: vivekvp@hotmail.com
Subject: Shipping Script??? Help?
Message-Id: <75d6nu$fj1$1@nnrp1.dejanews.com>

Hello!

I want a script that lists shipping costs.  I would like it to be a drop down
menu that would list ups or fedex...land, air...and their costs for each.

this price - depending on selection would be tacked on to the total price of
the  item i want to sell..

any help on this or where i could look?

thanks!!

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


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

Date: 18 Dec 1998 09:41:45 +0100
From: rutka@lucent.com (Micha3 Rutka)
Subject: Re: sort it ?
Message-Id: <wsm67b9q1ti.fsf@hzsac328.nl.lucent.com>

John Porter <jdporter@min.net> writes:
> Micha3 Rutka wrote:
> > 
> > Alternativly, you can speed up a little bit by using a construction,
> > which I invented during problem of sorting IP addresses (look in
> > Dejanews for articles from October of this year). Here is the code:
> > 
> > @vendors = map{ substr($_,9) }
> >            sort
> >            map{ sprintf("%9.2f",(split " ",$_)[$field]).$_ } @vendors;
> 
> I'm as grateful as anyone for Michal pointing out the performance
> advantage of using the built-in sort comparison.
> However, unlike the ST, this is not an invention but a general
> rule-of-thumb: Using the built-in sort comparison (if possible) is usually
> much faster than explicit comparison code.

Well, yes and no ;-). Let me explain a little. During our argument
which of us posted a better method to sort IP addresses, you
banchmarked ST and it occured that it suffers from dereferencing
inside sort. At this point, I asked myself, 'how ST can be adopted to
not include anything in sort?'. Using a little bit of my computer
knowledge about how two memory areas can be compared, I answered that
all what is needed is 'linearization' (i.e. reducing number of indexes 
in an array) of the anonymous array used by ST. This trick removes
need for index manipulation.

I call the above process an 'invention'.

What we get after it is something simpler that ST itself. Simple is
beautiful, therefore you can say that it should be rule-of-thumb. But
rule-of-thumb is usually something very complicated reduced to a
simple sentence. If I say to somebody, which does not now much how
computers operate, that 'sort comparision is usually much faster than
explicit comparison code', then he certinaly ask - WHY? Note that my
construction is against another rule-of-thumb, which says 'larger code 
is usually faster than a compact code, performing the same task'.

As you see, for me using one rule-of-thumb against another is not so
obvious. This is why I wanted some time ago to name my rule-of-thoumb,
simply because I think that it is very useful and should not be
overlooked when solving more complicated sorting problems. For me
'General Sorting Rule-of-Thumb (GSRT)' is a fine name, as long as one
knows what it is all about.

BTW. I would not find this rule-of-thumb if I did not know ST
(and its drawback) first ;-).

-- 
Dr. Ir. Michal Rutka       Lucent Technologies - Huizen, The Netherlands
Senior System Engineer     mailto:rutka@lucent.com


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

Date: 18 Dec 1998 00:06:33 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Syntax Error...Not able to find.
Message-Id: <x7d85inina.fsf@sysarch.com>

>>>>> "MD" == Mark-Jason Dominus <mjd@op.net> writes:

  MD> In article <19981217153906.04524.00000593@ng-ca1.aol.com>,
  MD> Groovy94 <groovy94@aol.com> wrote:
  >> I see no apparent errors in the syntax, 

  MD> Well, Uri found three, and here's another four:

hey, i was inundated with broken code here. i couldn't find them all! :-)

  MD> Maybe you need to look at more examples.

yes indeed!

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Fri, 18 Dec 1998 07:17:49 GMT
From: mcafee@joust.rs.itd.umich.edu (Sean McAfee)
Subject: Re: Using Exporter...
Message-Id: <xkne2.2099$4w2.8397804@news.itd.umich.edu>

In article <75c4gr$kn7$1@hiram.io.com>,
Top Changwatchai <wtc@schultz.io.com> wrote:
>I have some questions about using the "Exporter" module with the "strict"
>module.

>My fundamental goal is that I want to share some variables between packages,
>and I want to be able to "use strict" in all packages.

[snip code]

>However, as you can see, it seems I have to specifically "use vars" for the
>shared variables inside TestMod.  Apparently the Exporter module doesn't do
>this for the variables in @EXPORT.  Is this the generally accepted solution?
>It could get a bit unwieldy if there's a large list of shared variables which
>is frequently updated--this list would have to be updated in both the @EXPORT
>list and the "use vars" list.

>In order to avoid this duplication, I tried having a common list of shared
>variables (@export_list, below), but it doesn't work:

[reformatted slightly to reduce space:]
>============================= TestMod2.pm =================================
>package TestMod2;
>use Exporter ();
>@ISA = qw(Exporter);
>
>my @export_list = qw( $sharevar );
>
>@EXPORT = @export_list, qw( f1 );
>
>use strict;
>use vars @export_list;
>
>sub f1 {
>    print "2 - $sharevar\n";
>    $sharevar = "new value";
>}
>===========================================================================

>If I try to use TestMod2, I get this error:
>$ mainprog
>Global symbol "sharevar" requires explicit package name at TestMod2.pm line 19.
>Compilation failed in require at ./mainprog line 3.
>BEGIN failed--compilation aborted at ./mainprog line 3.

>Why doesn't TestMod2 work?

Because @export_list and @EXPORT aren't assigned until run time, but the
"use vars" happens at compile time, when @export_list is still empty.

>What is an elegant way to code this (assuming I do
>want to have shared variables)?

You could wrap your assignment to @export_list in a BEGIN block, but I
think this looks nicer:

use vars @TestMod::EXPORT = qw($sharevar $and @other @shared %variables);

push @TestMod::EXPORT, qw(f1 and other exported subroutines);

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu




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

Date: Fri, 18 Dec 1998 00:27:35 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Why Is Perl not a Language?
Message-Id: <1dk7iax.18fj29y1u81msoN@bay1-157.quincy.ziplink.net>

John Moreno <phenix@interpath.com> wrote:

> Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
> 
> > This works for "interactive", but for "interface", this is the most
> > ridiculous definition I've ever seen.
> 
> But he's not using it as a definition for "interface" but rather for an
> "interactive interface".  And that's a pretty fair description of what
> is necessary for an interactive interface.

Actually, I changed my mind.  His definition doesn't make sense for
"interactive interface" either, because "interactive interface" is
redundant and means the same thing as "interface".

How could you have a non-interactive interface??  An interface by
definition involves interaction.

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

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

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