[10227] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3820 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 25 06:07:24 1998

Date: Fri, 25 Sep 98 03:00:16 -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           Fri, 25 Sep 1998     Volume: 8 Number: 3820

Today's topics:
    Re: Bug in Net::FTP for ActivePerl? <duff@duffduff.com>
    Re: Database with Perl <marco.jaeger@dwm.ch>
    Re: Database with Perl <zenin@bawdycaste.org>
        FS Check <pgh@ga.nl>
    Re: help with pattern matching (Patrick Timmins)
        HELP:: s/// problem... hampus@my-dejanews.com
    Re: HELP:: s/// problem... <sam@peritas.com>
    Re: in-place-edit regex substitution in multiple files <uri@sysarch.com>
    Re: Interesting method technique: Default $self (Brad Appleton)
    Re: Perl & Java - differences and uses <zenin@bawdycaste.org>
    Re: Perl & Java - differences and uses <zenin@bawdycaste.org>
    Re: Perl & Java - differences and uses <zenin@bawdycaste.org>
        Perl 5.00502 error messages (h3o)
    Re: Poll: How Did You Learn Perl? Lee.Lindley@bigfoot.com
    Re: Poll: How Did You Learn Perl? <zenin@bawdycaste.org>
    Re: Poll: How Did You Learn Perl? <jerryp.usenet@connected.demon.co.uk>
        Regular Expression Operator Precedence isaacw@my-dejanews.com
    Re: Rotating an array. <ckc@dmi.dk>
    Re: Where to put cgi-lib.pl (Patrick Timmins)
    Re: Where to put cgi-lib.pl <jwb79@mail.idt.net>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Fri, 25 Sep 1998 10:28:01 +0100
From: "Gary Mc Closkey" <duff@duffduff.com>
Subject: Re: Bug in Net::FTP for ActivePerl?
Message-Id: <6ufnpj$9sb$1@ezekiel.eunet.ie>

>Net::FTP=GLOB(0xcb6d40)>>> PORT 10,0,1,137,0,0
This is the killer line. It should be returning something along the lines of
PORT 192,168,6,6,18,133.

Do you have a IP filter/firewall on the NT system. Whatever, net::ftp isn't
seeing the correct IP address.

G.

--
gmc_duff@indigo.ie. Remove underscore_duff to mail me.

NOTICE TO BULK E-MAILERS: Pursuant to US Code, Title 47, Chapter 5,
Subchapter
II, 227, and all unsolicited commercial e-mail sent to this address is
subject
to a download and archival fee in the amount of $500 US.




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

Date: Fri, 25 Sep 1998 08:33:46 +0200
From: Marco =?iso-8859-1?Q?J=E4ger?= <marco.jaeger@dwm.ch>
Subject: Re: Database with Perl
Message-Id: <360B394A.44CE7299@dwm.ch>

Hi there

It seems to be not that easy i thought ;-). I can give you a few more
details.
Our customer has 8 Products with about 1000 different types. He wants us
to create a CD-ROM on that their customers can search this Products (for
every of this 8 Products a picture must be shown), then customer should be
able to look for the specification (also prices) of every Product. (The
database itself isn't the problem). But he wants us to create this
'application' in a way that we he can use this also on his (virtual)
web-server. We have no database like informix available. Anything must be
programmed. This CD-ROM must run on UNIX, Mac OS and Windows 95/98/NT -
Workstation. That's why I thought a 'Web-Browser-application' would be
appropriate.

Shall I use Perl ? (the customer must not have to start a web-server
first) So far as I know I can write a Web-Seite (e.g for Data Input)
directly with Perl. Do I need cgi-skripts in this way ? Can I generate a
(simple) database in perl that is big enough for about 8-10'000 Entries ?

or shall I better use JavaScript/Java ?

I hope i have explained it better.



Marco Jdger wrote:

> Hi everybody
>
> I have to produce a CD-Rom for a customer. Because the content must be
> copied to a web-server, i'd like to do it with HTML and Perl. Can I
> program a database access with perl without using a web-server ?
> (Anything must be viewable with a browser).
>
> Thanks a lot for any clues ;-))
>
> Marco Jdger
> Digitale Werbemedien AG
> Switzerland



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

Date: 25 Sep 1998 09:31:27 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Database with Perl
Message-Id: <906715828.180136@thrush.omix.com>

Marco =?iso-8859-1?Q?J=E4ger?= <marco.jaeger@dwm.ch> wrote:
: It seems to be not that easy i thought ;-). I can give you a few more
: details.
: Our customer has 8 Products with about 1000 different types. He wants us
: to create a CD-ROM on that their customers can search this Products (for
: every of this 8 Products a picture must be shown), then customer should be
: able to look for the specification (also prices) of every Product. (The
: database itself isn't the problem). But he wants us to create this
: 'application' in a way that we he can use this also on his (virtual)
: web-server. We have no database like informix available. Anything must be
: programmed. This CD-ROM must run on UNIX, Mac OS and Windows 95/98/NT -
: Workstation. That's why I thought a 'Web-Browser-application' would be
: appropriate.

	Personally, I'd probably build a simple web server in Perl (which
	can be as tight as 30 lines of code), and build the database using
	Berkeley DB, SDBM, and or DBD::CVS and friends.  DBI/DBD::CVS can
	do SQL queries, but it may be a bit slow on 10k record tables,
	depending.  It should however, be cross-platform and combined with some
	functionality from Berkeley DB or SDBM when it make sense, shouldn't
	be unacceptable as far as speed.  Also, being built on DBI it can
	be moved later too and from a "real" database (Oracle, MiniSQL, etc)
	almost transparently.  DBD::ODBC is another option as well since I
	think it can talk to Access on Win32 systems (anyone care to comment
	on this?).  And even another option is to use both with a switch for
	each system. -Since the API layer is the same, you'd only need the
	OS switch for the connect().  And yet even another option is to
	exploit the in-memory databases that Berkeley DB can support.  That
	is, when the application starts up you build an in-memory database
	from some form of data file.  While this would slow startup time (no
	worse then MS Word though;-) it shouldn't eat too much memory if
	using Berkeley DB and speed would not be an issue at all. -I would
	not recommend using perl primitives directly for a similar effect
	however, as you'll eat up far, far more memory since even a single
	integer will need at least 28 bytes of storage and strings are
	far, far worse.

: Shall I use Perl ? (the customer must not have to start a web-server
: first)

	I'd recommend Perl, yes.  Java is also a good choice for client
	apps, but for many reasons it has limitations for server work.  Your
	application needs to work in both worlds.

	The web server can be started by perl, transparently.  As can the
	web browser and if you need to run an active database daemon, it can
	start that too.  Of course, so can batch files and shell scripts, so
	this should not be a factor for or against nearly any language.

: So far as I know I can write a Web-Seite (e.g for Data Input)
: directly with Perl.

	Yes.

: Do I need cgi-skripts in this way?

	Hmm, depends.  If you build a small web server in Perl, that doesn't
	require it to act like a normal, generic web server.  Since this is
	a very specialized web server, it needs only speek HTTP to talk to
	the browser correctly.  Beyond that, it is free to do anything it
	likes.

	For example, if the URL given is:

		http://localhost:1234/foo.cat/12345.prod

	Your web server could simply translate this to mean lookup product
	ID "12345" in the category "foo" and display an dynamically built
	HTML page based on the result.  A directory called "foo.cat" nore
	a file in it called "12345.prod" need actually exist at all.  This
	is what I mean by "free to do anything it likes".  If it saw
	"foo.html" it could just as simply revert to showing the actual page
	instead of doing database queries, simply because of the .html
	extension.

	I do this kind of black magic with Apache all the time (mod_perl
	rocks!:-), but that is likely far more generalized power then you
	need, as well as not quite being as cross-platform in so much as
	you would need to have a copy of Apache for every target machine you
	wanted to use.  As it is, you need to do that for Perl.

: Can I generate a
: (simple) database in perl that is big enough for about 8-10'000 Entries ?

	Yes.  Although you may need to do a bit of work to make it
	efficient.

: or shall I better use JavaScript/Java ?

	Java really doesn't buy you anything at this point in time.  You're
	talking about a pretty basic system for the most part.  Java would
	work of course, you would just take a lot longer to do the same
	work and not gain anything in this particular case by it. -Unless of
	course, you wanted a full independent application that didn't need
	a web browser to run, however then you're talking about a *lot* more
	work regardless of the language.

	I'd say keep JavaScript around.  You're in a web browser, and
	probably one you'd be shipping yourself on the CDROM so you know
	exactly what you're working with.  JavaScript, while being an
	utterly poor excuse for a language, does allow a level of web browser
	control that you can not get otherwise.   Regardless of the backend
	language, if you are using a web browser as your GUI, JavaScript should
	likely be kept.
-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Fri, 25 Sep 1998 11:32:04 +0200
From: Patrick <pgh@ga.nl>
Subject: FS Check
Message-Id: <360B6314.3813@ga.nl>

Hi,

Does someone have a example of a script to check a FS.
What is should do is:

Check a FS and when it's > 80%, post a mail, write a message on screen
or create an pop-up screen.

Thanks, Patrick.


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

Date: Fri, 25 Sep 1998 06:07:04 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: help with pattern matching
Message-Id: <6ufbu8$538$1@nnrp1.dejanews.com>

In article <6uemft$s19$1@nntp.Stanford.EDU>,
  remove <westiland.stanford.edu> wrote:
> I am sure the answer to this is probably obvious. I don't have alot of
> experience with Perl, but I have tried everything and I cannot figure it
[snip]

Show us just a small piece of 'everything' please.

Code! Code! Code! Code! (can you hear the chanting from Perl types
around the world?). "Learning Perl" (Schwartz, et al), "Programming Perl"
(Wall, et al), and "Master Regular Expressions" (Friedl, just Friedl) are
all published by O'Reilly and Associates. You should buy them all if
you're just starting out.

Patrick Timmins
$monger{Omaha}[0]

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 25 Sep 1998 07:39:54 GMT
From: hampus@my-dejanews.com
Subject: HELP:: s/// problem...
Message-Id: <6ufhca$avm$1@nnrp1.dejanews.com>

Hello everone.

I have some problem with the following: I want to do a search/replace in a
text-file. The format of the textfile is like this
($star,$starpic,$starpicnr,$description) example: star,3,5,this is a
star;star2,6,7,this is also a star;star3,4,4,ssstttaaarr; ----- Now, I want
to change one of the numbers in the string. This is done by first using
($star and $starpic already have values - in this case let's say thay match
the star2): ---- $filen=~m/$star,$starpic,(.*),(.*);/; $starpicnr=$1;
$starpicnr++; ---- so far - no problems... now - I want to write back that
variable: ----
$filen=~s/$star,$starpic,.*,.*;/$star,$starpic,$starpicnr,$description;/; ---
And well... the number is increasing - but the rest of the file is gone... I
mean - all entries after the one changed disappear. So after writing it back
to the file - it all looks like this: --- star,3,5,this is a
star;star2,6,7,this is also a star;

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 25 Sep 1998 10:21:53 +0100
From: Simon Matthews <sam@peritas.com>
To: hampus@my-dejanews.com
Subject: Re: HELP:: s/// problem...
Message-Id: <360B60B1.E6D585B6@peritas.com>

hampus@my-dejanews.com wrote:
> 
> Hello everone.
> 
> I have some problem with the following: I want to do a search/replace in a
> text-file. The format of the textfile is like this
> ($star,$starpic,$starpicnr,$description) example: star,3,5,this is a
> star;star2,6,7,this is also a star;star3,4,4,ssstttaaarr; ----- Now, I want
> to change one of the numbers in the string. This is done by first using
> ($star and $starpic already have values - in this case let's say thay match
> the star2): ---- $filen=~m/$star,$starpic,(.*),(.*);/; $starpicnr=$1;
> $starpicnr++; ---- so far - no problems... now - I want to write back that
> variable: ----
> $filen=~s/$star,$starpic,.*,.*;/$star,$starpic,$starpicnr,$description;/; 

The problem here appears to be the .* bit. This would seem to be mathing
lots of stuff up to the last record in the file. It think what you want
is the first part of the REGEX to look more like this:

s/$star,$starpic,[^,]*,[^;]*;/

This is probably also true for you match operation.

Hope this helps

SAM


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

Date: 25 Sep 1998 02:04:27 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: in-place-edit regex substitution in multiple files
Message-Id: <x7ww6svic4.fsf@sysarch.com>

>>>>> "FCM" == Fred C Miller <fredmill@jaws.greatwhite.com> writes:

  FCM> #!/usr/bin/perl -w
  FCM> use strict;

good for you that you use -w and strict!

  FCM> my $dir = shift;       #name the start-directory on the command line
  FCM> my @list;
  FCM> my @files = `find $dir -type f` or die "problem with find: $!";

  FCM> for (@files) {
  FCM>     chomp $_;                #This surprised me a bit
  FCM>                              #    I thought the filenames from find would be
  FCM>                              #    null terminated

if you use -print0 they are.

  FCM>      -T $_ and push @list, $_;
  FCM> }

this last loop could be written as

chomp( @files ) ;
@list = grep( -T, @files ) ;

  FCM> my $file;
  FCM> foreach $file (@list){
  FCM>     my $contents = "";
  FCM>     open(CHANGE, "$file") or die "urp...$file will not open: $!";
  FCM>     while (<CHANGE>){$contents .= $_}

why not just undef $/ and slurp in the files in one read. much faster
and cleaner.

local( $/ ) ;
$contents = <CHANGE> ;

  FCM>     close CHANGE;
  FCM>     if ($contents =~ s/www\.fire/samson.fire/gs){

the /s option on the s/// only makes . match \n and you don't have . in
the regex so the option is not needed.

  FCM>         open(FIX, ">$file") or die "Cannot open $file for fixing: $!";
  FCM>         print FIX $contents;
  FCM>         close FIX;
  FCM>      }
  FCM> }

how about this instead:

perl -0777pi.bak -e 'next unless -T $ARGV; s/www\.fire/samson.fire/g' `find $dir -type f`

remove the .bak if you don't want backup files.

this does slurp in entire files which may not be efficient. but for web
files this should be ok.

hth,

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: 25 Sep 1998 00:07:11 GMT
From: bradapp@enteract.com (Brad Appleton)
Subject: Re: Interesting method technique: Default $self
Message-Id: <6uemrf$qtd2@nntp.cig.mot.com>

In article <19980918133002.7916.qmail@plover.com>,
 Mark-Jason Dominus <mjd@plover.com> writes:
>You can create a database object $db with `new', and then make calls
>on it with the object method $db->query(...).  That is very ordinary.
>
>For lightweight queries, maybe you don't want to go to the trouble of
>explicitly allocating and destructing a database object.  In that
>case, you can just do DB->query(...), and it will automatically
>allocate a default database object for you and use that database.  It
>caches the default object and reuses it if you make any more queries.

I do something like this in one of my modules. But in my case, its
not both a class method and an instance method, its both a function
and an object.

The thing to note here is that my module is a wrapper around a
command that has lots of subcommands:

   toolname update arg1 arg2 arg3
   toolname query arg1 arg2 arg3
   toolname delete arg1 arg2 arg3
   etc.

So I have a module ToolName.pm that provides a class so you can create
ToolName objects and use them like so:

   my $tn = new ToolName(%opts);
   $tn->update($arg1, $arg2, $arg3);
   $tn->query($arg1, $arg2, $arg3);
   $tn->delete($arg1, $arg2, $arg3);
   etc.

But I realize some folks want the usage to look as similar as possible
to the commandline, so for them I export a toolname() function:

   sub toolname (@) { ... }

Now they can use it almost the same as they would on the command line:

   toolname "update arg1 arg2 arg3";
   toolname qw(query arg1 arg2 arg3);
   toolname 'delete', qw(arg1 arg2 arg3);

However, if they invoke toolname with NO arguments, it returns a default
ToolName object:

   toolname->update($arg1, $arg2, $arg3);
   toolname->query($arg1, $arg2, $arg3);
   toolname->delete($arg1, $arg2, $arg3);

Works swell!
-- 
Brad Appleton <bradapp@enteract.com> | http://www.enteract.com/~bradapp/
 "And miles to go before I sleep."   |  3700+ WWW links on CS & Sw-Eng


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

Date: 25 Sep 1998 06:56:18 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl & Java - differences and uses
Message-Id: <906706519.983344@thrush.omix.com>

Hunter Kelly <retnuh@corona.pixar.com> wrote:
: This is blatantly false.   Joseph Allen Dane <jdane@hawaii.edu> showed 
: that this was possible, yet you flamed him because _you_ don't know
: how to compile a java program.
	>snip<

	Which was my hasty mistake, I admit.  It is also why you'll notice
 	(if your news server isn't broken, many are) that I canceled that
	message less then 10 minutes after I posted it, and made a new one
	in its place.

	With the freedoms of Perl so common at my control, I often forget
	the exact bonding that other languages require (eg, forced use of
	two files to compile a small code snip). :-)

: It binds the values all at run time.  Looks like your perl
: example to me.  Well, alot more code, granted, but it still
: does the same thing.
	>snip<
: What part is it lacking?  Give us another example in perl showing what
: Java can't do.  I'm not being antagonistic or saying that there isn't
: anything, just that Java can do what you've described so far.

	Quite true.  Which is why the second reply made the closure magic
	a little more explicit and visible.  Please look for it on your
	server.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: 25 Sep 98 07:14:53 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl & Java - differences and uses
Message-Id: <906707928.97309@thrush.omix.com>

Brendan Johnston <bjohnsto@usa.net> wrote:
: I will investigate these closures more.
: At this point I can't see anything more than a way to add state to a
: function pointer.
	>snip<

	Of course, with the same argument I could say that for objects,
	I can't see anything more then a way to add control to the data.

	:-)

	The two paradigms are similar, but inverted.

: Since Java's function pointers are pointers to objects they already have
: a better mechanism for dealing with state than closures.

	Hmm, I don't follow how this is "better"?  Now granted, most of my
	examples have been far to simplified to really make the point clear,
	which is why I latter posted this, somewhat more practical example:

    #!/usr/local/bin/perl
    
    use strict;
    use Tk;
    
    my $MW = new MainWindow;
    
    {
        my $Button = 0;
    
        sub makeMeAnAlertButton {
            my $frame       = shift;
            my $showText    = shift;
            my $button      = ++$Button;
    
            $frame->Button (
                -text    => "($button) Push me" . ($button > 1 ? " too!" : "..."),
                -command => sub {
                    my $alert = $frame->Toplevel();
                    $alert->Label   (-text  => $showText)->pack;
                    $alert->Button  (
                        -text       => "ok $button",
                        -command    => sub { $alert->destroy() },
                    )->pack();
                },
            )->pack();
            return $button;
        }
    }
    
    for (
        my $button = makeMeAnAlertButton ($MW, "default");
        print("button $button>"), my $alertText = <STDIN>;
    ) {
        $button = makeMeAnAlertButton ($MW, $alertText);
    }
    
    MainLoop;

    __END__

: Zenin's example required references versus values.

	Or a run time that can track lexical scoped elements beyond there
	given block, albeit at least internally with references.

: Java does not have the ideal language consturct for every occasion.

	Which (if anyone can still remember...) is the argument we've been
	debating here mostly.

: It does have a very small set of simple constructs which still cover a
: very large range of design idea's.

	And this is one of the other main arguments in this thread.  Most
	languages are primarily bent to one paradigm or another, which
	almost always can fit the comment you state above.  This basically
	being that while they can likely solve a lot of designs with there
	chosen paradigm cleanly, they are unlikely to be able to solve all
	of them, at least not cleanly.

	The argument both for and against Perl is simply that based on this
	conclusion that no single paradigm can solve everything, it bends
	over backwards to "support" many paradigms quite well and reduces
	"enforcement" of any particular paradigm to minimum in order to
	allow the user as much freedom as possible to decide for themself
	which paradigm is best for there particular application.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: 25 Sep 98 07:46:13 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl & Java - differences and uses
Message-Id: <906709807.795743@thrush.omix.com>

Joseph Allen Dane <jdane@hawaii.edu> wrote:
: Zenin <zenin@bawdycaste.org> writes:
	>snip<
: Your point is taken.  In order to make closures work, objects to be
: closed over need to have indefinite extent.  They can't be allocated
: on a stack.  So I was mistaken above that Java could close over
: primitive types, which can only be allocated on the stack.  But Java
: objects can be closed over in the way you describe above.
	>code sniped<
: Is this not a closure?

	You're right, it fits the definition of a closure.  I must concede
	this point.  Well done.

	Now, as far as readability, maintainability, et al are
	concerned (ie, how we originally got to this issue) that the
	verbose and (IMHO) confusing code need to do handle such a
	construct is highly counter productive, both for the programmer
	and the program, as it requires the maintainer to search through
	possibly thousands of lines of code to find where this inner class
	was defined to know what magic it might be trying to do, among other
	problems.  This is quite similar to the problems with goto.

	There is the point that Java, being OO, should likely use an
	entirely different (more OO) based solution where a functional
	language would use a closure, and that such a OO solution would
	infact be simple, readable, maintainable, etc.

	Which brings us back to practical design problems and examples.

	Below is an practical example of Perl code, using OO, functional,
	and procedural paradigms.  Now, I would like to see what the
	pure OO model/algorithm would look like.  Not a retyping of this
	algorithm in Java or Python (we've been through that one with the
	Perl to Python CGI example), but the same problem solved using
	whatever the best OO style for such a problem might be.  Why? Simply
	because the main argument of this thread (ok, of George) has been
	that in most practical, real world usage, the OO paradigm can
	create such easier to read, maintain, extend, understand, etc code
	then can be done with other paradigms, or god forbid using multiple
	paradigms (which George has explicitly stated is a bad idea in any
	form).  So, for all intents please consider this example a
	functional spec only, and not a design spec.  With this functional
	spec in hand, I would like to see the OO design spec that fits this
	application.

    #!/usr/local/bin/perl
    
    use strict;
    use Tk;
    
    my $MW = new MainWindow;
    
    {
        my $Button = 0;
    
        sub makeMeAnAlertButton {
            my $frame       = shift;
            my $showText    = shift;
            my $button      = ++$Button;
    
            $frame->Button (
                -text    => "($button) Push me" . ($button > 1 ? " too!" : "..."),
                -command => sub {
                    my $alert = $frame->Toplevel();
                    $alert->Label   (-text  => $showText)->pack;
                    $alert->Button  (
                        -text       => "ok $button",
                        -command    => sub { $alert->destroy() },
                    )->pack();
                },
            )->pack();
            return $button;
        }
    }
    
    for (
        my $button = makeMeAnAlertButton ($MW, "default");
        print("button $button>"), my $alertText = <STDIN>;
    ) {
        $button = makeMeAnAlertButton ($MW, $alertText);
    }
    
    MainLoop;

    __END__

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Fri, 25 Sep 1998 08:47:02 +0200
From: h3o@veda.is (h3o)
Subject: Perl 5.00502 error messages
Message-Id: <h3o-ya02408000R2509980847020001@news.proventum.net>

I have just installed Perl 5.00502 on a machine running RedHat 5.1 - all
went well, but every operation done that involves Perl gets me the
following error messages - although all is well othewise - the scripts
execute as expected. as follows:

perl: warning: setting locale failed.
perl: warning: please check that your locale settings:
   LC_ALL = (unset)
   LC_TYPE = 'iso8859-1',
   LANG = (unset)
are supported and installed on your system.

where am I to set these? I cannot find the relevant place.

any help most gratefully received.

andrew mckenzie


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

Date: Fri, 25 Sep 1998 05:46:33 GMT
From: Lee.Lindley@bigfoot.com
Subject: Re: Poll: How Did You Learn Perl?
Message-Id: <6ufanp$3ns$1@nnrp1.dejanews.com>

In article <yl4stycyja.fsf@windlord.stanford.edu>,
> The man pages had all of the information I needed to understand the
> existing code as I was learning it, and I still use them constantly.  Much
> more convenient than books.
>
> --
> #!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
> $^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
>  00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
> rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
>

Although I have not yet completely evolved beyond occasionally grunting
to a questioning neophyte some softened variant of the phrase
"read the freaking man page (rtfm)", I find the "index" in the
camel book to be a better reference.  So though I'm a proponent of
on-line documentation and terse manual pages in general, I have to admint
that a good index in a "good" book like the blue camel
is a bit faster for me personally when I have questions.

--
// Lee.Lindley@Bigfoot.com
// Be nice.  It isn't that hard to do and it
// makes people happy.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 25 Sep 1998 08:00:08 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Poll: How Did You Learn Perl?
Message-Id: <906710349.995324@thrush.omix.com>

[posted & mailed]


Lee.Lindley@bigfoot.com wrote:
	>snip<
: Although I have not yet completely evolved beyond occasionally grunting
: to a questioning neophyte some softened variant of the phrase
: "read the freaking man page (rtfm)", I find the "index" in the
: camel book to be a better reference.  So though I'm a proponent of
: on-line documentation and terse manual pages in general, I have to admint
: that a good index in a "good" book like the blue camel
: is a bit faster for me personally when I have questions.

	$ perl -MCPAN -e 'install "Text::English"
		 ...time passes...
	$ perlindex -index
	         ...time passes...
	$ perlindex socket
	1  2.121 lib/perl5/i386-freebsd/5.00404/IO/Socket.pm
	2  2.121 lib/perl5/site_perl/LWP/SecureSocket.pm
	3  2.121 lib/perl5/site_perl/LWP/Socket.pm
	4  2.121 lib/perl5/i386-freebsd/5.00401/IO/Socket.pm
	5  2.121 lib/perl5/IO/Socket.pm
	6  2.121 lib/perl5/pod/perlipc.pod
	7  1.061 lib/perl5/Socket.pm
	8  1.061 lib/perl5/i386-freebsd/5.00401/Socket.pm
	9  1.061 lib/perl5/i386-freebsd/5.00404/Socket.pm
	a  0.998 lib/perl5/ExtUtils/Embed.pm
	b  0.943 lib/perl5/site_perl/Net/DummyInetd.pm
	c  0.795 lib/perl5/site_perl/HTTP/Daemon.pm
	d  0.742 lib/perl5/IO/Select.pm
	e  0.707 lib/perl5/i386-freebsd/5.00401/IO.pm
	f  0.707 lib/perl5/i386-freebsd/5.00404/IO.pm

	Enter Number or 'q'>

	Why Text::English and with it perlindex aren't part of the standard
	distribution I do not understand.  I makes grep look like Windows
	"find".  I've found it to be far better then any book index, simply
	because it indexs not only the standard distribution, but everything
	I've installed over it as well.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Fri, 25 Sep 1998 09:24:56 +0100
From: Jerry Pank <jerryp.usenet@connected.demon.co.uk>
Subject: Re: Poll: How Did You Learn Perl?
Message-Id: <AX9PgAAYN1C2EwAA@connected.demon.co.uk>

In <comp.lang.perl.misc> 
John Porter <jdporter@min.net>, writes:
>So here's a poll for everyone.
>From what resource(s) did you learn Perl?
>

        Llama v.2
        Camel v.2

>. Other book (give name)
        Mastering Reg Ex        - Friedll
        Web Client              - Wong
        CGI Programming         - Gundavaram
        Perl Cookbook           - Christiansen  ##

>.Docs included in the distribution
        Not so easy [PoB]

>. Something on the WWW
        c.l.p.m.
        Various archives :-(

## Covers almost everything I have ever tried to do in Perl.
Only these examples work!

I wasted a highlighter pen on this book, marking the interesting
sections. I now have a pure yellow book :-)
-- Jerry Pank                    mailto:jerryp.usenet@netconnected.com

Remember though that
THERE IS NO GENERAL RULE FOR CONVERTING A LIST INTO A SCALAR.
-- Larry Wall in the perl man page


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

Date: Fri, 25 Sep 1998 08:40:16 GMT
From: isaacw@my-dejanews.com
Subject: Regular Expression Operator Precedence
Message-Id: <6ufkth$e21$1@nnrp1.dejanews.com>

Could someone please help me by telling me the standard UNIX regular
expression operators in order of precedence ? I'm writing a Finite State
Machine regular expression matcher as part of a debugging tool and need to
know the relative precedences of the operators. I also need to know which
operators are of equal precedence. Basically I need a C-like
operator/precedence listing. It needs to be correct for the standard UNIX
regexp metachars. If someone could tell me this, I would be very grateful.

Isaac Wilcox

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 25 Sep 1998 08:42:17 +0200
From: Casper Kvan Clausen <ckc@dmi.dk>
Subject: Re: Rotating an array.
Message-Id: <Pine.GSO.3.92.980925083547.10724M-100000@edb>

On Thu, 24 Sep 1998, Larry Rosler wrote:

> I made no complaint -- I just posted the data, and let people draw their
> own conclusions.

And thanks for that, BTW. Nice to know that I more or less accidentally
stumbled upon a Perl optimization.

> I think Casper Kvan Clausen was being whimsical about "strange and
> twisted", as he seems to have wanted answers in time to make into his
> code.

Not at all. I was planning on putting my original version in the
production code and secretly adding the most twisted answer to my
personal version, thus allowing me to cackle in insane glee whenever I
read the code. So call me strange :)

> So many people posted the same "array slice" solution (without a
> single comment about it being "strange and twisted", let alone
> inefficient) that I feared it might become enshrined as "The Way To Do
> It".

That would, of course, have been Not Good. I think, though, that there has
been enough evidence of the efficiency of splice() to convince almost
anyone. Still deserves mention, of course.

I guess this problem doesn't really lend itself to a twisted solution.
Shame.

Kvan.

-------Casper Kvan Clausen------ | 'Political correctness: Has it had
----------<ckc@dmi.dk>---------- |  its day? We interview a leading
           Lokal  544            |  poof.'
I do not speak for DMI, just me. |        - Mel Smith.



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

Date: Fri, 25 Sep 1998 05:49:21 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: Where to put cgi-lib.pl
Message-Id: <6ufat1$3oa$1@nnrp1.dejanews.com>

In article <360AB864.28D78901@tritechnet.com>,
  Eric Von Zee <evonzee@tritechnet.com> wrote (while snipping out that
ptimmins@netserv.unmc.edu wrote the '> >' parts) :

> > Oh go on! You STRANGE have a sure way of doing things!
>
> Strange has a sure way of doing things?  All-righty-then....

You two, obviously.

> >Where does this 'BEGIN' block go? Oh, you mean in his *CGI* script, which he
> > has placed in the *cgi*-bin (or where ever the web server is configured to
> > look for *CGI* scripts)? I assumed he could put cgi-lib.pl in the same
> > place, since he has access to it for his *CGI* script. But, I guess you know
> > where you can put it!
>
> Looks to me like s/CGI/Perl/gm works here just peachy...

Looks to me like you're as confused as the other guy (note the 'two' above)
 ... so answer the question: Where does this 'BEGIN' block go? Why not just
put the cgi-lib.pl file in the same directory as the perl script that is
calling it, since the web server already knows where this file is at?
The web server setup will determine where the server looks for CGI activated
programs, whether they are Perl scripts or not. So, as I said before:

> > Of course, this has NOTHING to do with Perl!

To which you mistakenly replied:

> Is that a fact?  So, by virtue of being used on the Web, do Perl scripts
> somehow lose their 'Perlness'?

No, not at all. The vast majority of web interactivity is thanks to Perl
scripts and their inherent 'Perlness'. But you just chose to ignore all
that, and instead focused on something that had nothing to do with Perl.

You may want to read this over two or even three or four times so that
you'll understand it forever.

Have a nice day.

Patrick Timmins
$monger{Omaha}[0]

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 25 Sep 1998 06:56:51 GMT
From: "Jim Babbington" <jwb79@mail.idt.net>
Subject: Re: Where to put cgi-lib.pl
Message-Id: <01bde851$cd3109e0$6488fdc7@dixon>

: It's worked that way on every webserver I've ever used. Which ones doesn't
: this work on?

One that I know of.....

Netscape Enterprise Server 3.x




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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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