[12854] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 264 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 26 18:07:25 1999

Date: Mon, 26 Jul 1999 15:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 26 Jul 1999     Volume: 9 Number: 264

Today's topics:
    Re: Aliasing long expresions (Neko)
    Re: Beginner-friendly group as cultural adaptation? (I R A Darth Aggie)
    Re: Beginner-friendly group as cultural adaptation? <uri@sysarch.com>
    Re: Extracting plain text from email (Tad McClellan)
        First script -- extracting part of a text file <bender@ece.orst.edu>
    Re: FormMail Year 2000 problem (I R A Darth Aggie)
    Re: FormMail Year 2000 problem <toby@venice.cas.utk.edu>
    Re: FormMail Year 2000 problem (Alan Curry)
    Re: Geekspeak Programming Contest <toby@venice.cas.utk.edu>
        LONG: Object oriented approach in perl <dermot.musgrove@virgin.net>
        make errors <savio.fonseca@usa.net>
    Re: problem size limit of perl (Tad McClellan)
    Re: REAL: help with flock() portability (Tad McClellan)
    Re: reg expression (Tad McClellan)
    Re: Regex-ing (Tad McClellan)
    Re: Regex-ing <cassell@mail.cor.epa.gov>
    Re: remove records from database (Tad McClellan)
        sort database and remove duplicates <chorton@emcoflow.com>
    Re: stopping email overflow on failure (Steve .)
    Re: stopping email overflow on failure <toby@venice.cas.utk.edu>
    Re: Text File Busy (errno = 26) (Abigail)
    Re: Text File Busy (errno = 26) <sohrabSPAMSUX@d2c2.com>
    Re: Which group is appropriate? (I R A Darth Aggie)
    Re: Why use /s in Cookbook recipe 20.6? (Tad McClellan)
        Won't read from STDIN inside html tags <acollado@uiuc.edu>
    Re: Won't read from STDIN inside html tags (I R A Darth Aggie)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 26 Jul 1999 22:00:06 GMT
From: tgy@chocobo.org (Neko)
Subject: Re: Aliasing long expresions
Message-Id: <7nilp6$68u$0@216.39.141.200>

On Mon, 26 Jul 1999 15:30:26 GMT, Sergio Bruno Fedi de Oro <sfedi@dc.uba.ar>
wrote:

>> >		# Here's where I alias the array
>> >		*files = \@{$$ref_paquetes{$paquete_actual}};
>>
>> You are dereferencing an array ref, creating a new array, and taking a
>ref to
>> it.  You are aliasing a *copy* of the array.  Is that what doesn't
>work?
>
>No, I finally made it work, and this wasn't making a copy, it referenced
>to the original array (if you take a reference, then dereference it, and
>take back it reference, why should it make a new copy?)

It doesn't.  I was thinking anon ref which this isn't.

>> Since you already have an array ref to start, just use it:
>>
>>     local *files = $ref_paqetes->{$paquete_actual};
>
>Yep, this worked, and much shorter too. Thanks.
>
>Another thing I had to do to make it work is to prefix the typeglob
>"files" with the package name, that is, all apparitions of "files" where
>replaced by "ConfigIO::files".
>
>Do you know why is this?

'use strict' wants all package variables fully qualified or declared with
'use vars'.

    @ConfigIO::files = ();  # Fully qualified.

    use vars '@files';  # Declared.
    @files = ();

-- 
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=


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

Date: 26 Jul 1999 20:56:21 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: Beginner-friendly group as cultural adaptation?
Message-Id: <slrn7ppivq.7gq.fl_aggie@thepentagon.com>

On 26 Jul 1999 18:51:45 GMT, John Callender <jbc@shell2.la.best.com>, in
<379cae41$0$214@nntp1.ba.best.com> wrote:

+ I realize that proposing a group specifically for Perl newbies is a
+ dicey proposition.

[bunch o' gotcha's raised, and duly noted, and politely ignored ;)]

Ummm...this has been raised before, and I think you've seen this
said, but if not [or those joining us late], but...

A newbie isn't going to post his/her questions in comp.lang.perl.newbie.
They don't want newbie answers to their questions, dammit! They want
expert answers from wizards. Now, if you propose that the newbie group be
named comp.lang.perl.{wizards|gurus}, you may avoid that quirk.

+ But there seem to be some indications from at least some of the group's
+ regulars that it might be worth bringing up again. So I'm bringing it
+ up.

I think it would be a waste of a newsgroup, but what the heck...

+ I'm not saying that a newbie group
+ would be a panacea in that regard, but I believe it could help.

I believe it would be a placebo at best.

+ - a prohibition on cross-posting to other c.l.p.* groups. 

So, instead of xposting, they'll simply post their question twice.
On the other hand, someone with a decent propogation could issue
NoCeM's against such posts in the redundent groups, and that could
be used as an efficient filtering service.

+ Presumably, the group's name would be chosen with a view to encouraging
+ newbie participation. *.wizards might work for that, but would probably
+ lead to too much confusion, and would fail a truth-in-advertising test.

This isn't advertising. Do you want the newbies to participate, or go
looking elsewhere for their answers?

Hmmm...maybe comp.lang.perl.clues ? I dunno.

+ This may well be doomed from the outset.

IMHO, pretty much.

+ If you really hate the idea
+ and would vote against it under any circumstances, please consider
+ letting me know either publicly or privately.

I'd probably vote for it just so I can say "clp.newbies is three
doors down on the right, and you're more likely to get the answer
you seek there. If you really want me to answer this question, I'll
sneer at you, question your parentage, berate your reading skills,
and then tell you to read perlfaqX". :)

James


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

Date: 26 Jul 1999 17:58:17 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Beginner-friendly group as cultural adaptation?
Message-Id: <x71zdvul8m.fsf@home.sysarch.com>

>>>>> "A" == Abigail  <abigail@delanet.com> writes:

  A> John Callender (jbc@shell2.la.best.com) wrote on MMCLV September MCMXCIII
  A> in <URL:news:379cae41$0$214@nntp1.ba.best.com>:
  A> ?? 
  A> ?? This may well be doomed from the outset. If you really hate the idea
  A> ?? and would vote against it under any circumstances, please consider
  A> ?? letting me know either publicly or privately. If the product of (status
  A> ?? of opposing respondent) x (number of respondents opposed) exceeds a
  A> ?? certain fairly low threshold, I'll just drop the notion right now and
  A> ?? save us all a lot of trouble. Say, Abigail plus 3 other regulars; I
  A> ?? wouldn't think there'd be much point in trying to overcome that level
  A> ?? of resistance.


  A> I would vote against it if the group name matches /^comp\..*\.perl/s.

  A> But feel free to create an alt.perl.wussies. ;-)

i thought that is what alt.perl was nicknamed.

so why not tell all newbies here to go to alt.perl. it is probably
active in most servers. let them infect each other with bad perl and
matt's scripts. programming is NOT for kiddies. yes, you can learn to
program with a GED but who would want to? this is flooding the market
with $20/hour cgi cargo cult worshippers. not that i am worrying about
my job situation, it just makes for an annoying field and newsgroup. why
not have a quiz to be passed to enter into c.l.p.misc?

can you put " in a string with out \?

can you make an array of variables without symrefs?

can you create a here doc?

<just being grumpy as i am sick of the noise here>


uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: Mon, 26 Jul 1999 11:30:39 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Extracting plain text from email
Message-Id: <vuuhn7.pti.ln@magna.metronet.com>

Uri Guttman (uri@sysarch.com) wrote:
: >>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:

:   TC>      [courtesy cc of this posting mailed to cited author]
:   TC> In comp.lang.perl.misc, 
:   TC>     lr@hpl.hp.com (Larry Rosler) writes:
:   TC> :form, and getting them to do anything about it would be a Sysiphean 

:   TC> "Sysiphean" =~ y/iy/yi/

: ??? there is no 'iy' in that string.


   No, but there are 'i's where there should be 'y's and vice versa  :-)


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


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

Date: Mon, 26 Jul 1999 14:25:56 -0700
From: Jeff Bender <bender@ece.orst.edu>
Subject: First script -- extracting part of a text file
Message-Id: <Pine.GHP.4.10.9907261357060.22041-100000@rodolfo.ECE.ORST.EDU>


Hi,

I've just created my very first Perl script, which:

1.  scans an output file (given at CL) for a line which indicates the
start of data;
2.  skips four lines of headings etc.;
3.  prints the contents of the next lines, removing multiple spaces, until
4.  it stops when it finds a 'y' as the first character in the line, and
5.  looks for more data.

The script included below does this just fine, and is actually a bit
faster than an Awk script I've been using for a couple years.  But, I
can't help thinking there are some better ways to do things:

1.  Is there a better way to skip lines (eg "skip=" in Awk)?  The four
'$in=' lines work, but look kind of ugly.

2.  There must be a more attractive way to search for the start of the
data and then actually extract the data than using the nested 'while (<>)'
statements..

3.  Any other comments?  I've used what I could from Lemay's "Teach
Yourself Perl in 21 Days" book and read the FAQ's on www.perl.com without
finding anything that jumped out at me which would make this better.
Unfortunately, all ~10 Perl books at our uni library are checked out or
missing too :)  Eventually, though, I want to expand this script to take
the data, do some transformations on it, cut some of the unneeded data
lines (only about 10% of it is interesting; the rest should be thrown away
to save disk space), and send it to gnuplot for plotting in a presentable
form -- so I'd appreciate any help in getting this basic foundation part
in a nice form.

Script:

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

my $in = '';

while (<>) {
        if ( /^  \*{6}  transient analysis/o) {
                $in = <>;
                $in = <>;
                $in = <>;
                $in = <>;
                TWO: while (<>) {
                        if ( /^y/ ) {
                                last TWO;
                        }
                        else {
                                s/[ \t\r\f]+/ /go;
                                print;
                        }
                }
        }
}


A typical data file, if it helps, looks like this, where there may be any 
number of data columns:

<lots of extraneous stuff>

 ******
 transient spice model of a tfel zns:mn device
  ******  transient analysis               tnom=  25.000 temp=  25.000
 ******
x
  
        time      vapp         qe          qi          fp          ia   
  
  2.0000e-03     0.1519     -0.2036     -0.3011     -0.1326     5.829e-06
  2.0001e-03     1.1006     -0.1987     -0.3011     -0.1394     6.601e-03

<lots of data>

  3.0000e-03     0.1504     -0.2008     -0.2969     -0.1308     4.544e-06
y
     
          ***** job concluded
 ******  Star-HSPICE  --    98.2  (980711)  17:03:55  05/03/1999  pa

<more extraneous stuff>


Thanks in advance!



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

Date: 26 Jul 1999 21:13:32 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: FormMail Year 2000 problem
Message-Id: <slrn7ppk00.7gq.fl_aggie@thepentagon.com>

On Mon, 26 Jul 1999 20:45:55 +0100, Simmo <simsi@hotmail.com.nospam>, in
<hV2n3.28$LH1.6488@news.enterprise.net> wrote:

+ Just a quick note - hope it hasnt been covered here but if you use FormMail
+ from Matt Wrights Script Archive like what i does (!) and its over a year or
+ so old (haven't checked latest versions), you may find this line in it:

The latest greatest edition is y2k compliant:

    $year += 1900;
    # Format the date.                                                       #
    $date = "$days[$wday], $months[$mon] $mday, $year at $time";

That would be version 1.6.

James


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

Date: Mon, 26 Jul 1999 17:21:26 -0400
From: toby <toby@venice.cas.utk.edu>
Subject: Re: FormMail Year 2000 problem
Message-Id: <379CD156.D16B58E7@venice.cas.utk.edu>

>
>
> I think I'm going to take a stab at fixing formmail...tho the copyright
> may well induce me not to...
>
> James

You will rewrite the entire friggin' thing, so no copyright violation in my book.
He might nail you on 'look and feel' but crap all looks and feels the same,
doesn't it.

Toby



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

Date: Mon, 26 Jul 1999 21:44:06 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: FormMail Year 2000 problem
Message-Id: <GE4n3.112$m83.3047@news3.ispnews.com>

In article <slrn7ppjmn.7gq.fl_aggie@thepentagon.com>,
I R A Darth Aggie <fl_aggie@thepentagon.com> wrote:
>I think I'm going to take a stab at fixing formmail...tho the copyright
>may well induce me not to...

I've inherited some FormMail users, so I'd be interested in a replacement
that does not suck. If you get any code written, let me know. If I get around
to it first, I'll post here or mail you or something. It'll probably be at
least a few days.
-- 
Alan Curry    |Declaration of   | _../\. ./\.._     ____.    ____.
pacman@cqc.com|bigotries (should| [    | |    ]    /    _>  /    _>
--------------+save some time): |  \__/   \__/     \___:    \___:
 Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman


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

Date: Mon, 26 Jul 1999 17:09:02 -0400
From: toby <toby@venice.cas.utk.edu>
Subject: Re: Geekspeak Programming Contest
Message-Id: <379CCE6E.83E78DEE@venice.cas.utk.edu>

> And who but the Irish say "sarver" for "server"?  (OK, there probably
> are some backwoods Appalachian folks who do).

Whut? Ah'll be derned if'n ah'll let ye git away wit thet? Ah'll hev ye know
thet us'n Tennesseans (by God), got us a boy whut invented that there internet
thingy. He's from Scott County and a-goes by the name o' Gore. Sheeeeet.

Translation for our foreign readers and Yankees:

Excuse me? Let me express my consternation at the impilication that persons
from Southern Appalachia are stupid and not adept technologically. Vice
President Al Gore, by all accounts, a contributor to the success of the
Internet in the mid-to-late '90s, is a native Tennessean (by Jiminy) from
Scott County on the Cumberland Plateau. Hmph.

<Dash out of my lab reaching for Nomex suit>

Toby



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

Date: Mon, 26 Jul 1999 21:35:19 +0000
From: Dermot Musgrove <dermot.musgrove@virgin.net>
To: "gtk-list@redhat.com" <gtk-list@redhat.com>, "glade-devel@glade.pn.org" <glade-devel@glade.pn.org>
Subject: LONG: Object oriented approach in perl
Message-Id: <379CD497.A881F04C@virgin.net>

Dear all, especially perl hackers,

please excuse the long posting and the rather general questions, I hope that
I haven't offended the group's charter - or anyone who doesn't like Perl.

I have written a perl module that generates perl source code from a Glade UI 
definition file. Glade is of course the beautiful Gtk UI builder written by
Damon Chaplin.

I don't have much experience of object-oriented programming so I would
appreciate any advice that people could give me about good practice in
the world of object-oriented perl. I have tried to follow the examples in
perltoot and I have 'read' perltootc but I am not sure how much I have 
_really_ understood about the OO apprach in general and OO perl in particular.

The intention is to produce perl classes that construct a UI using Gtk and
can be inherited and extended by the developer, for instance to provide 
signal handlers for the widgets in the UI. It is important that when the UI 
is changed and the UI construction classes are regenerated, the programmer
should not need to change any of her own code in order to use the new UI
classes (with dynamically AUTOLOADed signal handlers for any signal handlers
that have not yet been written). The programmer might want to construct and
show several copies of any of the UIs simultaneously.

At the moment I generate a separate class for each toplevel window/dialog 
that has been defined and all the classes are perl packages in one single
source file. 

If I haven't put you all off yet, do you think that I am doing this in a
'proper' and scalable OO way? I have real problems throwing off my modular 
habits so please tell me if I have failed to really grasp the OO nettle. 

I expect the programmer's signal handlers to be in a simple perl module and 
to be Export()ed so that they are visible at generation time. This is so 
that the UI can function during the generation run. This approach falls down
if any of the signal handlers construct one of the toplevel windows/dialogs 
that are being generated of course. It does however allow a shorter 
development cycle and also dynamic construction of simple UIs from a string
of XML containing a Glade UI definition.

Perhaps it would be better just to expect the programmer to subclass the UI 
and provide the signal handlers in this new subclass and forget about trying 
to run the UI during the generation phase at all. 

If anyone is interested, a development version of the Glade-Perl source code 
generator is available from:
http://freespace.virgin.net/dermot.musgrove/computers/perl/

Thanks in advance you for absolutely any advice that you can offer.

The (snipped) top of one such generated class/package would be
    (in the file Generated/BusForm.pm)
---------------8<-----------------------------
package BusFrame;
require 5.000; use English; use strict 'vars', 'refs', 'subs';

BEGIN {
  # Run-time utilities and vars
  use Glade::PerlRun; 
  # Existing signal handler modules
  use Existing::BusForm_mySUBS;  
  use vars        qw( @ISA $AUTOLOAD %fields %stubs);
  # Tell interpreter who we are inheriting from
  @ISA          = qw( Glade::PerlRun );
}

%fields = (
  # These are the data fields that you can set/get using the dynamic
  # calls provided by AUTOLOAD (and their initial values).
  # eg $class->FORMS($new_value);      sets the value of FORMS
  #    $current_value = $class->FORMS; gets the current value of FORMS
  TOPLEVEL => undef,
  FORM     => undef,
  PACKAGE  => 'BusFrame',
  VERSION  => '0.0.1',
  AUTHOR   => 'Dermot Musgrove <dermot.musgrove\@virgin.net>',
  DATE     => 'Mon Jul 26 18:38:55 BST 1999',
);

%stubs = (
  # These are signal handlers that will cause a message_box to be
  # displayed by AUTOLOAD if there is not already a sub of that name
  # in any module specified in 'use_modules'.

  'about_Form' => undef,
  'destroy_Form' => undef,
  'on_quit1_activate' => undef,
);

sub AUTOLOAD {
  my $self = shift;
  my $type = ref($self)
    or die "$self is not an object";
  my $name = $AUTOLOAD;
  $name =~ s/.*://;       # strip fully-qualified portion

  if (exists $self->{_permitted_fields}->{$name} ) {
    # This allows dynamic data methods - see %fields above
    # eg $class->UI('new_value');
    # or $current_value = $class->UI;
    if (@_) {
      return $self->{$name} = shift;
    } else {
      return $self->{$name};
    }

  } elsif (exists $stubs{$name} ) {
    # This shows dynamic signal handler message_box for %stubs above
    __PACKAGE__->show_skeleton_message(
      $AUTOLOAD."\n (AUTOLOADED by ".__PACKAGE__.")", 
      [$self, @ARG], 
      __PACKAGE__, 
      'pixmaps/Logo.xpm');
    
  } else {
    die "Can't access method `$name' in class $type";

  }
}

sub run {
  my ($class) = @ARG;
  Gtk->init;
  my $window = $class->new;
  $window->TOPLEVEL->show;
  Gtk->main;
}

sub new {
#
# This sub will create the UI window
  my $that  = shift;
  my $class = ref($that) || $that;
  my $self  = {
    _permitted_fields   => \%fields, %fields,
    _permitted_stubs    => \%stubs,  %stubs,
  };
  my ($forms, $widgets, $data, $work);

  #
  # Create a GtkWindow 'BusFrame'

>> BLAH BLAH BLAH - UI construction Perl/Gtk calls

  #
  # Return all forms in the constructed UI
  bless $self, $class;
  $self->FORM($forms->{'BusFrame'});
  $self->TOPLEVEL($self->FORM->{'BusFrame'});
  return $self;

}

---------------8<-----------------------------

This can be subclassed by, for example:
---------------8<-----------------------------
package BusForm_Subclass;
require 5.000; use English; use strict 'vars', 'refs', 'subs';

BEGIN {
    # Import our existing signal handler modules
    use Existing::BusForm_mySUBS;
    # Now import the UI construction class
    use Generated::BusForm;
    use vars       qw( @ISA
                       %fields
                       $AUTOLOAD
                   );
    # Tell interpreter who we are inheriting from
    @ISA         = qw( BusFrame  Existing::BusForm_mySUBS);

    # Inherit the AUTOLOAD dynamic methods from BusForm
    *AUTOLOAD      = \&BusFrame::AUTOLOAD;
}

%fields = (
# Insert any extra data access methods that you want to add to 
#   our inherited super-constructor (or overload)
    USERDATA    => undef,
    VERSION     => '9.9.9',
);

#======================================================================
#=== These are the overloaded class constructors and so on          ===
#======================================================================
sub new {
    my $that  = shift;
    # Allow indirect constructor so that we can call eg. 
    #   $window1 = BusForm_mySUBS->new; # and then
    #   $window2 = $window1->new;
    my $class = ref($that) || $that;

    # Call our super-class constructor to get an object and reconsecrate it
    my $self = bless $that->SUPER::new(), $class;

    # Add our own data access methods to the inherited constructor
    my($element);
    foreach $element (keys %fields) {
        $self->{_permitted_fields}->{$element} = $fields{$element};
    }
    @{$self}{keys %fields} = values %fields;
    return $self;
}

sub run {
    my ($class) = @ARG;
    Gtk->init;                                
    my $window = $class->new;
    $window->USERDATA({
        'Key1'   => 'Value1',
        'Key2'   => 'Value2',
        'Key3'   => 'Value3',
        });
    $window->TOPLEVEL->show;
    Gtk->main;
}

#=======================================================================
#==== Below are overloaded signal handlers                          ====
#=======================================================================

>> BLAH BLAH BLAH

---------------8<-----------------------------

and the whole thing could be run by for example:
  perl -e 'use BusForm_Subclass; BusForm_Subclass->run()';
  
This approach works but I am not sure how 'correct' it is.

If you have read this far, thanks again for any advice that you have.
Regards, Dermot



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

Date: Mon, 26 Jul 1999 21:02:48 GMT
From: Savio Fonseca <savio.fonseca@usa.net>
Subject: make errors
Message-Id: <7niidj$vv8$1@nnrp1.deja.com>

 Hi -,
I am trying to install a CRYPT module  in perl and as per the install
instructions, one does the following:

perl Makefile.PL
make
make test
make install.

However, I am getting errors in the "make" section itself.
The include is looking for a file <machine/types.h> which is not
present.
However, I have set the Makefile Include Path to use /usr/include/sys
as :
CCFLAGS= -I/usr/local/include -I/usr/include/sys
(where the types.h file is present)

I still keep seeing a lot of errors in the make process.

Does anyone have a solution to this ?

Thanx

Savio Fonseca


--
To abandon something halfway is to fail completely


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Mon, 26 Jul 1999 12:02:50 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: problem size limit of perl
Message-Id: <ar0in7.pti.ln@magna.metronet.com>

Chao Fang (cfang@nwu.edu) wrote:
: I am trying to use a Perl script to process a text database. The main data
: structure of my program is a 4-dimension associative array, which will
: require about 200M of memory while running.


   Estimating the size of a hash is Black Science, but I will
   trust your estimate.


: I am running it on a Ultra5 with Solaris. The program works extremely slow
: after it processes some data and will finally hang up when data size is
: larger than 100M.

: Could somebody give me a point. Is the problem in the 4-dimension
: associative array or Perl can not handle too many datum.


   Perl has no such limits.

   How much RAM does the machine have?

   How much swap does it have?


   If it does not all fit in physical RAM, then it may be
   thrashing the disk.

   Maybe you can use tied hashes instead? (see 'perltie.pod')


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


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

Date: Mon, 26 Jul 1999 11:58:38 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: REAL: help with flock() portability
Message-Id: <ej0in7.pti.ln@magna.metronet.com>

Stefano Ghirlanda (stefano@rerumnatura.zool.su.se) wrote:

: A program that I developed under linux doesn't seem to work on Solaris.
: the offendingn code is related to file locking and reads:

: sysopen PIPE, $pipe, O_RDONLY  or croak "can't open $pipe: $!";
: flock PIPE, LOCK_EX or croak "can't lock $pipe: $!";
: 				
: On solaris a user gets the error:

: can't lock /home/ron/.lyxpipe.out: Bad file number at
: /usr/local/lib/perl5/site_perl/5.005/LyX/Client.pm line 238

: I know that flock() is not the most portable of functions, but my perlport
: manpage does not mention any problem with Solaris. 


   perlfunc mentions a potential problem with locking across
   a network.

   What filesystem are you using?


: Also, I cannot find the
: error message in perldiag. 


   That is because it is not a message from perl, it is a message
   from Solaris.


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


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

Date: Mon, 26 Jul 1999 11:38:34 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: reg expression
Message-Id: <qdvhn7.pti.ln@magna.metronet.com>

llornkcor (llornkcor@llornkcor.com) wrote:
: > The problem you describe is asked in variants about 37 times a day.
: > It's also a FAQ. Go to school, and learn to read. Then read.

: typing....  If you don't have a reasonable answer, or are tired of seeing
: the question, you don't have to post a message insulting me. It's like
: SPAM...hit the damn DELETE button !!!


   I don't think folks that have been here reading and answering
   questions for years are obligated to revamp How Things Are Done
   based on the input of a non-contributor.

   If you don't like How Things Are Done in this newsgroup,
   don't read it.

   *plonk*


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


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

Date: Mon, 26 Jul 1999 12:27:40 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Regex-ing
Message-Id: <s92in7.04j.ln@magna.metronet.com>


[ I don't participate in the alt. wasteland, headers trimmed ]


Banos (nomailpleasewereantispammers) wrote:
^^^^^

: Perl is just
: cryptic 'crap'. 
           ^^^^       appropriate, given your name...


   That is completely correct.

   Perl is not worth learning or using.

   I suggest that you unsubscribe from all Perl newsgroups immediately!


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


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

Date: Mon, 26 Jul 1999 14:44:07 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Regex-ing
Message-Id: <379CD6A7.52162C2C@mail.cor.epa.gov>

Abigail wrote:
> 
> Banos (nomailpleasewereantispammers) wrote on MMCLV September MCMXCIII in
> <URL:news:933010735.20052.0.nnrp-04.c2deffda@news.demon.co.uk>:
> -- This thread has reaffirmed my reluctance to embrace perl. Perl is just
> -- cryptic 'crap'. This should surely be a simple request with a simple tried
> -- and tested unambiguous answer by now.
> --
> -- There must be some alternatives!
> 
> Sure. Try Python.

No, he'll hate that too.  I think we should recommend Intercal.
There's never more than one way to do it in that language, is 
there?  That should take care of his 'ambiguity' problem.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Mon, 26 Jul 1999 11:53:52 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: remove records from database
Message-Id: <ga0in7.pti.ln@magna.metronet.com>

Chad Horton (sandc@sprynet.com) wrote:
: Here is my dilema:

: I have a database like this:

[snip data, repeated below]

: What I need to find the highest value for column 1 for all records per
: domain and remove the duplicate records.


   I don't see *any* duplicate records there, so that part is Very Easy!

   :-)

   If you meant "duplicates in column 2" then you should have said that.

   Precise terminology is important when discussing technical topics.


: So, in this case the results be be this:

: 100|www.pepsi.com|10|10|80|0|
: 10|www.pepsi.de|1|1|8|0
: 65|www.remark.pepsi.com|32|20|10|3|
: 100|www.digipepsi.net|25|30|20|25|


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

my %score;
my %lines;  

while (<DATA>) {
   my($score, $domain, @nums) = split /\|/;

   $score{$domain} = 0 unless exists $score{$domain}; # initial best score

   if ( $score > $score{$domain} ) {   # update the best seen so far for
                                       # this domain
      $score{$domain} = $score;
      $lines{$domain} = $_;
   }
}

foreach (sort keys %lines) {
   print $lines{$_};
}

__DATA__
100|www.pepsi.com|10|10|80|0|
20|www.pepsi.com|1||1|18|0|
20|www.pepsi.com|1|1|18|0|
10|www.pepsi.de|1|1|8|0
65|www.remark.pepsi.com|32|20|10|3|
44|www.pepsi.com|10|10|12|12|
23|www.digipepsi.net|5|15|1|2|
100|www.digipepsi.net|25|30|20|25|
------------------------------------------


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


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

Date: Sun, 25 Jul 1999 10:42:45 -0800
From: inlandpac <chorton@emcoflow.com>
Subject: sort database and remove duplicates
Message-Id: <932928168.7139@www.remarq.com>

Here is my dilema:

I have a database like this:

100|www.pepsi.com|10|10|80|0|
20|www.pepsi.com|1||1|18|0|
20|www.pepsi.com|1|1|18|0|
10|www.pepsi.de|1|1|8|0
65|www.remark.pepsi.com|32|20|10|3|
44|www.pepsi.com|10|10|12|12|
23|www.digipepsi.net|5|15|1|2|
100|www.digipepsi.net|25|30|20|25|

What I need to find the highest value for column 1 for all
records per domain and remove the duplicate records.

So, in this case the results be be this:

100|www.pepsi.com|10|10|80|0|
10|www.pepsi.de|1|1|8|0
65|www.remark.pepsi.com|32|20|10|3|
100|www.digipepsi.net|25|30|20|25|

I have only gotten as far as opening the database!

Please help.
Thanks,
chad.



* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!


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

Date: Mon, 26 Jul 1999 21:32:26 GMT
From: syarbrou@nospam.enteract.com (Steve .)
Subject: Re: stopping email overflow on failure
Message-Id: <379cd3c9.286008804@news.enteract.com>

Whatever you looser.  And I say looser cause you have no clue what you
are talking about and just wrote a page of crap.  Get a life.

On 26 Jul 1999 16:04:34 -0500, abigail@delanet.com (Abigail) wrote:

>Steve . (syarbrou@nospam.enteract.com) wrote on MMCLV September MCMXCIII
>in <URL:news:379cb90c.279163210@news.enteract.com>:
>## I have a program on my unix box that runs every ten seconds.  If it
>## finds a problem, it emails the owner.  Problem is, every ten seconds
>## it will send out another message till the problem is rectified.  I'm
>## trying to work out the logic on how to prevent this.  Something like
>## if problem found, keep checking, but do not warn again for like
>## another hour.  Any ideas?  Thanks.
>
>
>Well, you could put two big aquaria in the server room. Put a goldfish
>in the right one. If the program finds a problem, it first looks where
>the goldfish is; if it's in the right aquarium, it sends out a message,
>and puts the goldfish in the left aquarium. If the goldfish is already
>in the left aquarium, doesn't do anything else anymore.
>
>If there's no problem to be found, it also checks where the goldfish is.
>If it's in the left aquarium, it puts the goldfish back in the right
>aquarium.
>
>This is a general coding problem, not a Perl specific one. I assume you
>can take the story above, and turn it into a solution more suitable for
>a computer. If not, go ask in a general programming group.
>
>
>
>
>Abigail



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

Date: Mon, 26 Jul 1999 17:40:35 -0400
From: toby <toby@venice.cas.utk.edu>
Subject: Re: stopping email overflow on failure
Message-Id: <379CD5D2.752B7938@venice.cas.utk.edu>



"Steve ." wrote:

> Whatever you looser.  And I say looser cause you have no clue what you
> are talking about and just wrote a page of crap.  Get a life.
>

Ummm. *Unless* I am mistaken, she answered your question. It certainly was a
creative (and acerbic) answer, *unless* you can't figure out a simple
language game. Of course, *unless* you are lazy-as-sin, you would have
checked this out in a FAQ or the documentation, but that would be the *last*
thing you would do.

Toby

'Let _loose_ the dogs of war' or something to that effect.



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

Date: 26 Jul 1999 16:07:40 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Text File Busy (errno = 26)
Message-Id: <slrn7ppjfd.lg7.abigail@alexandra.delanet.com>

Sohrab (sohrabSPAMSUX@d2c2.com) wrote on MMCLV September MCMXCIII in
<URL:news:5p0n3.2733$CK6.2823@client>:
<> Hmmm,
<> 
<> Thanks for the pointer to the intro page, quite informative.
<> 
<> Unfortunately, I'm not (well, not explicitly) doing any file I/O (no open()
<> calls in my code).  All I do are opening database connections, executing
<> some SQL, writing the results to www page and closing the connection.
<> 
<> Is there something that is doing file I/O behind my back (in CGI/DBI/DBD) ?

Who knows? It's *your* system, not ours. It's certainly not a Perl
question.



Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Mon, 26 Jul 1999 17:27:29 -0400
From: "Sohrab" <sohrabSPAMSUX@d2c2.com>
Subject: Re: Text File Busy (errno = 26)
Message-Id: <bq4n3.3373$CK6.8247@client>

By the tone of your response I guess one of two things:

(1) You were insulted by my question (sorry, I didn't think you'd take it
personally)
(2) You're not familiar with the scenario/problem/solution and so you
thought that a sharp note like the one you posted would help (??)

Anywho, after a bit of reading about modules in the Cookbook, I've ended all
of my libraries with a "1;" hoping that the problem might be in their return
values.  I've had no more errors since then today, but we'll see how things
go during the week :)

I guess the question WAS a Perl question after all Abigail.

Sohrab

Abigail wrote in message ...
>Who knows? It's *your* system, not ours. It's certainly not a Perl
>question.
>
>
>
>Abigail
>--
>%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)
((.)
>(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of
Hanoi
>
>
>  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News
==----------
>   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
>------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers
==-----




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

Date: 26 Jul 1999 21:34:07 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: Which group is appropriate?
Message-Id: <slrn7ppl6j.7gq.fl_aggie@thepentagon.com>

On Mon, 26 Jul 1999 16:34:22 -0400, toby <toby@venice.cas.utk.edu>, in
<379CC64E.2F775254@venice.cas.utk.edu> wrote:

+ Jonathan Stowe wrote:

+ > No you've just got to read the documentation and then take the
+ > ridicule just like everyone else ... You'll be better for it in the
+ > end.

[sig snipped]

+ Now that's the Socratic Method at work.

Socrates never had students who didn't do their out-of-class assignments.
Or if he did, they aren't mentioned, probably because he threw them out.

Knowing where to find answers and documentation is an out-of-class
assingment. There are dozens of books...articles...web sites.

But as in Real Life, anyone not doing their out-of-class assignments
will receive the appropriate grade.

+ Please, how does ridicule help anyone?

Most people have pride. When that pride is wounded, they're more likely
to _not_ repeat their mistake(s). If that means they are more careful
searching the documentation, then that's great.

+ If so, when exactly does a programmer need to be tough?

When reaching for the <post> button...

+ A cliche (at best), but it illustrates a point: 'Since when is an open
+ society like the Perl community ordered like some badgering Marine Corps
+ platoon exercise?'

Because programming requires discipline?

James


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

Date: Mon, 26 Jul 1999 11:22:33 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Why use /s in Cookbook recipe 20.6?
Message-Id: <pfuhn7.pti.ln@magna.metronet.com>

John Callender (jbc@shell2.la.best.com) wrote:
: I was reading the Perl Cookbook's recipe 20.6, which discusses
: extraction and removal of HTML tags, and was confused about something.
: In the not-quite-completely-naive example (that is, the one that's one
: step up from

: % perl -pe 's/<[^>]*>//g' file

:     $html =~ s/<[^>]*>//gs;

: My question is, why is the /s modifier there? 


   I dunno.


: My understanding is that
: that only affects the behavior of . (making it match a newline).


   For all practical purposes (make that not-deprecated purposes),
   that is correct.

   (If $* is set to 1, the /s turns off its effects for this one match.
    and Tom/Gnat can't be using it for that either, 'cause there are
    no anchors there for $* to affect anyway.
   )


: Doesn't the negated character class [^>] match \n without the /s
: modifier? 


   Yep.


: Am I missing something obvious here? 


   Looks like book errata to me.


: Is it maybe just a stylistic
: thing, a clue for the reader of the code that the expression is
: expected to match across multiple lines, rather than something that's
: strictly necessary from perl's point of view?


   That could be. Hmmm. Using it as a "reminder" wouldn't have 
   even occured to me...


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


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

Date: Mon, 26 Jul 1999 16:10:26 -0500
From: Andy Collado <acollado@uiuc.edu>
Subject: Won't read from STDIN inside html tags
Message-Id: <379CCEC2.9868C713@uiuc.edu>

This is some of the code I am using to redirect my users to their home
directories.
The supply their username and that directs them to their home pages..

   &parse;
   $yourpage=$FORM{yourpage};

   print "<html>\n";
   print "<frameset rows=\"70%,30%\" border=\"1\">\n";
   print "<frame src=\"/$yourpage/\" scrolling=auto noresize
border=\"1\">\n";
   print "<frame src=\"/delete2.html\" scrolling=auto noresize
border=\"1\">\n";
   print "</frameset>\n";
   print "</html>\n";


But all it prints out is this:

  <html>
  <frameset rows="70%,30%" border="1">
  <frame src="//" scrolling=auto noresize border="1">
  <frame src="/delete2.html" scrolling=auto noresize border="1">
  </frameset>
  </html>


Please advise.

Thanks a ton.



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

Date: 26 Jul 1999 21:47:54 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: Won't read from STDIN inside html tags
Message-Id: <slrn7ppm0e.7gq.fl_aggie@thepentagon.com>

On Mon, 26 Jul 1999 16:10:26 -0500, Andy Collado <acollado@uiuc.edu>, in
<379CCEC2.9868C713@uiuc.edu> wrote:

+ The supply their username and that directs them to their home pages..

+    &parse;
+    $yourpage=$FORM{yourpage};

What is the value of $FORM{yourpage}? do you check it in &parse to make
sure it is valid? 

Tip:

I bet the first line of your script does NOT contain a '-w'
option. Add this to that first line and see if you get an error.
You'll have to check your httpd's error.log file, tho, so you may want
to add:

use CGI::Carp 'fatalsToBrowser';

to produce a copy of the error message in the browser.

Tip: Using one print with a here-doc:

print<<HTML;
<html>
<frameset rows="70%,30%" border="1">
<frame src="/$yourpage/" scrolling=auto noresize border="1">
<frame src="/delete2.html" scrolling=auto noresize border="1">
</frameset>
</html>
HTML

Do note that the location of the ending HTML delimiter is important.
One could also use the qq() operator for a similar effect, namely to
eliminate the ugly and somewhat tricky \" escape.

+ But all it prints out is this:
+   <frame src="//" scrolling=auto noresize border="1">

Sure looks like $FORM{yourpage} is undef. Heck, I know it is, since
I tested the above here-doc example as-is, and I got exactly what you
got in your <frame src="//"...>.

James


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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 264
*************************************


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