[6683] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 308 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 15 18:07:14 1997

Date: Tue, 15 Apr 97 15:00:23 -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           Tue, 15 Apr 1997     Volume: 8 Number: 308

Today's topics:
     $= <lorraine@ait.nrl.navy.mil>
     Re: [Q] How to capitilize beginning of words (Michael J. Maravillo)
     Re: [Q] Returning an array of hashes (Martin Cohen)
     Re: An extended e-mail parser (Kevin Johnson)
     Re: DBM Obsolete? (Brooks Davis)
     Re: How do I randomly re-order the lines of a file?  <nealnach@cr.usgs.gov>
     Re: How to extract string starting with n characters? (Craig Berry)
     Implemenation of "Virtual Classes" <kevina@clark.net>
     Info about Oraperl <cdm2@formalsys.ca>
     Re: Kudos to Tom Christiansen and problems with OO (Nathan V. Patwardhan)
     looking for smart etags for perl (Curtis Hrischuk)
     Needed: Perl-based mailto filter (Christopher B. Browne)
     Re: Ousterhout and Tcl lost the plot with latest paper (Dan Haskell)
     Re: Ousterhout and Tcl lost the plot with latest paper <a-l-e-x-e-y@o-d-d-j-o-b.u-c-h-i-c-a-g-o.e-d-u>
     Parsing hex characters (Alejo Balingit)
     Re: Perl code for POST and GET? (Nathan V. Patwardhan)
     Re: Perl code for POST and GET? (Danny Aldham)
     perl--- DOS? <lorraine@ait.nrl.navy.mil>
     Re: POP3 perl script (Danny Aldham)
     Re: Reply to Ousterhout's reply (was Re: Ousterhout and <bhouse@dazsi.com>
     Sorting files <coop5b30@nortel.ca>
     Strict Mode Referencing I need help..... <Greg@Limo.Net>
     Thread Synchronization? jcoleman@alison.sbc.edu
     Re: Unix and ease of use  (WAS: Who makes more mikeh@iac.net
     Re: What does "UNIX" stand for.. <achrist@easystreet.com>
     Re: Why is $Line=~ s///; erasing = (Brand Hilton)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 15 Apr 1997 16:54:15 -0400
From: Brian Lorraine <lorraine@ait.nrl.navy.mil>
Subject: $=
Message-Id: <3353EAF7.2781@ait.nrl.navy.mil>

DO I have to associate the predefined "$=" to the file i'm refering to
somehow or will it automatically assume it's counting the lines in the
LAST FILE that I opened? I'm trying to create just a quick perl script
that reads a file and tells how many lines are in it.
You can view the perl code here:
"http://www.ait.nrl.navy.mil/people/lorraine/example1.txt"
And you can try out the actualy script here:
"http://www.ait.nrl.navy.mil/people/lorraine/example1.html"

would greatly appreciate any feedback thanks a lot >:)

--------------------------------------------------------------
Brian "the BrAiN" Lorraine           lorraine@ait.nrl.navy.mil
        -Music is the ONLY thing that keeps me sane-
--------------------------------------------------------------


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

Date: 16 Apr 1997 12:47:30 GMT
From: mmj@masskara.philonline.com.ph (Michael J. Maravillo)
Subject: Re: [Q] How to capitilize beginning of words
Message-Id: <slrn5l9iri.65b.mmj@masskara.philonline.com.ph>

amas@lhr-sys.dhl.com <amas@lhr-sys.dhl.com> wrote:
> I have looked in O'Reilly's Learning Perl book, but can't seem to
> find a solution to this problem.  I have a string of words that are
> all in caps and I would like to convert it to lower case and then
> capitilize the beginning of each word. I know how to do the first
> part:
>    $myString =~ tr/A-Z/a-z/;
> 
> Though I am not too sure how to do the second part. Also since
> it is for a web server, a solution that does not take too long to
> execute would be appreciated, though I am ready to accept anything.

I'm not much of a perl programmer but this one works:

$myString =~ tr/A-Z/a-z/;
$myString =~ s/(^|\s)(\w)/$1\U$2\E/g;

Maybe someone out there could reduce this to just one line of code?


Regards,
Mike

-- 
Michael J. Maravillo                                   Philippines Online
http://www.philonline.com.ph/~mmj/                 InfoDyne, Incorporated
9045319E7CC15251528F5C6E89E896DC    1184 Pasong Tamo, Makati, Philippines


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

Date: 15 Apr 97 11:22:50 GMT
From: mcohen@arl.mil (Martin Cohen)
Subject: Re: [Q] Returning an array of hashes
Message-Id: <3353650A.3780@arl.mil>

Vegard Bakke wrote:
- sub Func ()
- {
-    my(@A, %H, $I);
- 
-    for($I=0; $I < 5; $I++) {
-       $H{'pos'} = $I;
-       $H{'neg'} = -$I;                <------------------
-       $A[$I] = \%H;
-       print "Func: $I $A[$I]->{'pos'}\n";
-    }
- 
-    return @A;
- }

- Why is every tuppel in the array @Ar equal to the
- last tuppel of @A? It gets the number of tupples right.
- 
- --
-                            Vegard Bakke,
-                        vegard.bakke@hibu.no
-                Kirkegata 9, 3600 Kongsberg, Norway
- 
-    "My spelling is Wobbly.  It's good spelling but it Wobbles,
- and the letters get in the wrong places."      --  Winnie the Pooh

See the marked spot above.  At that point you are *changing* the same
hash element, not defining a new one.  Perhaps you thought  my %H; was
in the loop?  But I don't think that would work for your purpose.  Try
changing the line  $A[$I] = \%H;  to  $A[$I] = [%H];  and read Chapter
4 of the new Camel.  (I find that I've had to read some sections more
than once.)
-- 
Martin Cohen - AMSAA-North - Custom House Rm 800 Phila PA 19106-2976


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

Date: 15 Apr 1997 09:07:01 -0700
From: kjj@primenet.com (Kevin Johnson)
Subject: Re: An extended e-mail parser
Message-Id: <5j0935$rtp$1@nnrp01.primenet.com>

Peter Jastreboff <jast@ms.com> wrote:
>I am trying to write an e-mail parser which will take emails sent to
>an predefined id and do the following.

>1. separate and sort the subject information.
>2. take the main message body and post it in an HTML file.
>3. Allow differnt parameters to sort the Subject information.

>I have a good handle on how to Subject informatin, however, I am having
>trouble parsing out the message body and then sending it to and HTML
>file.  Any ideas or example scripts I could follow?

I recommend taking a look at the MailTools package in CPAN. It makes short
work of parsing email messages.

If you're brave, you could also take a look at MailFolder, but it's
still in alpha release.

-- 
thx,
kjj@pobox.com   http://www.pobox.com/~kjj/


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

Date: 15 Apr 1997 19:09:27 GMT
From: brdavis@orion.ac.hmc.edu (Brooks Davis)
Subject: Re: DBM Obsolete?
Message-Id: <5j0jp7$n0b$1@cinenews.claremont.edu>

Parillo (lparillo@newshost.li.net) wrote:
: My Perl Doc in HTML format appears to say the DBM is obsolete, and
: has been replaced with tie and untie. However the example in the doc:
:     # print out history file offsets
:          tie(%HIST, NDBM_File, '/usr/lib/news/history', 1, 0);
:          while (($key,$val) = each %HIST) {
:              print $key, ' = ', unpack('L',$val), "\n";
:          }
:          untie(%HIST);
: does not seem to work for me (I think it may be realted to NDBM_File),
: while DBM still seems to work.

No, you misunderstand.  The dbmopen/dbmclose calls have been replaced with
tie and untie which are far more powerful.  However, this does not mean
DBM is obsolete.  (Actually, it is, but for reasons unrelated to Perl.)

Actually, with the addition of the AnyDBM_File package to update the 
dbmopen/dbmclose functions to be more useful, they are far stronger then
they were before.  The purest would probably argue that you should always
use tie, but in the little DBM work I've done, AnyDBM_File has made my
life easier and ment that I could ignore ties until I really have time
to learn them properly.

-- Brooks

--
Brooks Davis            +------------------------------------------------+
brdavis@hmc.edu         | "_Slackware_ [Linux] is the MacOS of UNIXes."  |
Harvey Mudd College     |                    -- Richard Garnish          |
340 E. Foothill Blvd.   |                       on alt.sysadmin.recovery |
Claremont, CA 91711     +------------------------------------------------+


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

Date: Tue, 15 Apr 1997 20:34:20 GMT
From: Neal Nachtigall <nealnach@cr.usgs.gov>
Subject: Re: How do I randomly re-order the lines of a file? 
Message-Id: <Pine.D-G.3.91.970415153250.5789A-100000@dlgek.cr.usgs.gov>

This was just a first stab, but the following might do what
you want:

  srand(time^$$);

  open F, "$ARGV[0]" || die "Quickly:$!\n";
  @lines = <F>;
  close F;

  open F, "> $ARGV[0]" || die "Quickly:$!\n";
  while(@lines)
  {
    printf F splice(@line,rand(@lines),1);
  }
  close F;

HTH,

--
Neal L. Nachtigall * nealnach@edcmail.cr.usgs.gov 
Hughes STX * EROS Data Center

Swing hard, in case they throw the ball where you're swinging. -Duke 
Snider

On 15 Apr 1997, Adam H. Lewenberg wrote:

> I need to RANDOMLY re-order the lines of a small text file (between 20
> and 50 lines). Preferably, I would like to say something like 'reorder
> file' and get the re-ordered file sent to standard output. A perl
> solution would be good, but I could also use awk, sed, or any of the
> other standard UNIX tools. 
> 
> Example
> original file:
> 
> line 1
> line 2
> line 3
> line 4
> 
> after re-ordering:
> 
> line 3 
> line 4
> line 2
> line 1
> 
> -- 
> University of Illinois at Champaign-Urbana, Dept. Of Mathematics
> INTERNET: adam@math.uiuc.edu   or    lewenber@uiuc.edu
> 
> 
> 


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

Date: 15 Apr 1997 19:42:45 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How to extract string starting with n characters?
Message-Id: <5j0lnl$64b$1@marina.cinenet.net>

Jim Michael (jim.michael@gecm.com) wrote:
: I am looking for a function for extracting a string starting with a 
: specific substring, and ending with a specific character, e.g. all names 
: starting with "John", ending with a space (Johnson, Johnstone, Johns,..).
: Does this already exist in Perl? Pointer to appropriate reference 
: appreciated. TIA.

RE style you're looking for is e.g. /\b(John.*?)\b/ .  This says "Find me 
a word starting and ending at a word boundary, the first part of which is 
the characters 'John', after which any word characters can follow up to 
the trailing boundary."  The string found will be in $1.

How you actually *use* this RE depends on your specific application, of 
course.  Best of luck!

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Tue, 15 Apr 1997 16:32:14 -0600
From: Kevin Atkinson <kevina@clark.net>
Subject: Implemenation of "Virtual Classes"
Message-Id: <861136836.11350@dejanews.com>

The following is my implemenation of what I call "Virtual Classes".
I would like some poeple to look this over to a) see if I am doing
everthing in the best manner b) to see if I explain everthing well and
c) for spelling and grammer problems (WITH corrections).
I am especally interested in making that one like I marked as not
inheritable inheritable.

I hope to eventully get this incorperationg into some of the perl
docs.

==Cut==

package Virtual;

# This file is Copyrighted 1997 by Kevin Atkinson.  You may use it and
# incorperate it into your own docs if you like as long as you give me
# credit.  You may also use this in you own code as long as you give
# me credit some how with in the code so that people who look at your
# code now that you got the idea from me (users of the code do not
# need to know).  Please include my email address with my name.  My
# email address is kevina@clark.net.  If you are unsure simply ask.

# This Modules demonstrates how to implement what I call a "Virtual
# Classes" for lack of a better name.  A Virtual Class is a copy of a
# class which has its own private set of Class Data and is represented
# by a variable and not a package name
#
# Why would you ever want to do something like this?  There are
# several reasons.  However, the most obvious reason is so that
# functions can have there own private Virtual Class by declaring then
# with a my.  So, that when the function does something that modify
# its copy of a Virtual Class the function will not be interfering
# with the current state of the class in other functions.
#
# For example suppose you have a class which has default tags which
# you can modify.  Now a function wants to modify these tags for its
# own purposes. If the function had nothing to work with but a plain
# old Class with global class defaults it will have basically two
# choices.  It could either modify the defaults and not worry about
# how it would affect other functions.  Or it could store the current
# state of that tag in a variable, modify the variable, than change
# the tag back to original state when its done. In some cases this can
# be a real pain.
#
# However with virtual classes all the function has to do is to
# create a virtual class and then simply modify and use the virtual
# class instead of the global class.  If the virtual class was
# declared with a my than it would be destroid when it is done.
#
# Perhaps this example will make its usefulness apparent:
# (The default behavior of the Fraction Class is to report fraction
# in their improper form, ie 5/3 not 1 2/3)
# sub func1 {
#   my $frac = virtual Fraction;
#   $frac->modify_tag('MIXED', 1);
#   my $frac1 = $frac->new(5,3);
#   print "$frac1\n";     # Will output "1 2/3"
# }
# sub func2 {
#   my $frac = virtual Fraction;
#   my $frac1 = new $frac(5,3);
#   print "$frac1\n";     # Will output "5/3", its default behavior
# }
#
# If this was done with out virtual classes it would have to be done
# something like this:
# sub func1 {
#   my $tmp = Fraction->get_tag_state('MIXED');
#   Fraction->modify_tag('MIXED', 1);
#   my $frac1 = Fraction->new(5,3);
#   print "$frac1\n";     # Will output "1 2/3"
#   Fraction->modify_tag('MIXED', $tmp);
# }
# sub func2 {
#   my $frac = virtual Fraction;
#   my $frac1 = new $frac(5,3);
#   print "$frac1\n";     # Will output "5/3", its default behavior
# }
# As you can see this is a bit more complicated.  It will be even
# more complicated if more than one tag is modified or the function
# does not always exit at the end (like if a return, die, or croak is
# used some where). With a virtual class you do not have to worry
# about resetting the tags when the function exits.
#
# Notes:
#
#   The Objects created via Virtual classes have no actual way if
#   knowing what Virtual Class they belong two.  They simply know
#   what set of data to use.
#
#   When a Virtual Class is destroid any objects created from that
#   virtual class or NOT nessasary destroid.  In fact the objects
#   created from that virtual class will still function as normal
#   with the same set of shared class data still in tact (you just
#   won't be able to create new objects with that same set of
#   class_data).  However this should generally not be a problem
#   because all objects created from that virtual class should have
#   the same scope, so that when the virtual class is destroid so are
#   the objects.
#
# This code should be fairly easy to follow.  I have put in comments
# any any points where I think there might be confusion.  The main
# purpose of this code is show how to implimit Virtual Classes and
# not to be really useful.  It you want to see if you understand this
# try to modify if it to behave like the example using the Fraction
# class does above.  (You might want to replace the 'print
# "$frac1\n"' to 'print $frac1->str, "\n"' to avoid having to use
# operator overloading.)
#

use strict;
use Carp;

use vars qw(%def_class_data $class_data $AUTOLOAD);

%def_class_data = (val1=>'123v', val2=>'456v');
$class_data = {%def_class_data};   # make a copy

# Create a new object

sub new {
  my $class = shift;
  my $self = {id => 'object', val1 => 'abc', val2 => 'def'};
  if (ref $class) { # it is a virtual class
    croak "Must be a Virtual Class object not a normal object"
                                            if $class->{id} ne 'virtual';
    $self->{'_class_data'} = $class->{'_class_data'};
          #^ point _class_data to the location of the class data for the
	  #^ virtual class
    bless $self, ref $class;
  } else {
    $self->{'_class_data'} = $class_data;
          #^ point _class_data to the location of the class data for the
	  #^ Class.
    bless $self, $class;
  }
  return $self;
}

# Create a new virtual class with its own private Class_Data optionally
# getting its class data from the class its was called from (ie if it was
# called by "virtual Virtual" it will get its class data from Virtual, if
# it was called from an other virtual class (say $v) than it it will get
# its class data from $v)

sub virtual {
  my ($class, $use_prev) = @_;
  my $self  = {id => 'virtual'};
  if (not $use_prev) {
    # make a copy of the default values if the flag is not set
    $self->{'_class_data'} = {%def_class_data}
  } else {
    # make a copy of the other class's data if the flag is set
    my $VAL = $class->getref;  # figure out which data set to use
    $self->{'_class_data'} = {%{$VAL}};
  }
  bless $self, ref($class) || $class;
  return $self;
}

# isa = is a
sub isa {
  my $self = shift;
  my $name = shift || "This";
  return "$name is a ".ref($self)." of type $self->{id}." if ref($self);
  return "$self is a Class"
}

sub dump {
  my $self = shift;
  my $name;
  my $isa = $self->isa(shift);
  my $VAL = $self->getref;
  print <<"---";
$isa
  val1: $VAL->{val1}
  val2: $VAL->{val2}
---
  print <<"---" if exists $VAL->{_class_data};
  _class_data:
    val1: $VAL->{_class_data}{val1}
    val2: $VAL->{_class_data}{val2}
---
}

# This method figures out which data set the user wants to use and
# return a ref to that data set (It could be Class data, Virtual
# Class data, or Object data)

sub getref {
  my ($self, $use_class_data) = @_;

  return $self->{'_class_data'} if ref($self)
                                          and $self->{id} eq 'virtual';
       #^ If a Virtual Class, use the Virtual Class data

  return $self                  if ref($self) and !$use_class_data;
       #^ If an Object and the deff flag is not use the Object's data

  return $self->{'_class_data'} if ref($self) and  $use_class_data;
       #^ If an Object and $deff set use the data for its "stem" class
       #^ (could be a Class or a Virtual Class)

  return $class_data;           # This is NOT inheritable :(
       #^ If none of the above must be real class, use the Class data
}

# Used to modify and access the Class, Virtual Class, and Object Data

sub AUTOLOAD {
  my ($self, $value, $use_class_data) = @_;

  my $name = $AUTOLOAD; # $name = the name of the variable to change.
  $name =~ s/.*://;     # strip fully-qualified portion

  my $VAR = $self->getref($use_class_data);
               #^ Figure out what actual data hash needs to be modified.

  croak "Sorry $name does not exist.\n" unless exists $VAR->{$name};

  local $^W = undef; # because its does not like $value eq undef;
  return $VAR->{$name} = $value unless $value eq undef;
                  #^ test it this way to allow the $value to be 0 or ""
  return $VAR->{$name};
}

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


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

Date: Tue, 15 Apr 1997 09:14:03 -0300
From: Craig Morris <cdm2@formalsys.ca>
Subject: Info about Oraperl
Message-Id: <3353710B.11C6@formalsys.ca>

If anyone has any information concerning Oraperl, the Oracle/Perl
interface language, could you please let me know. 


					


Regards,

Craig Morris
cdm2@formalsys.ca


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

Date: 15 Apr 1997 20:21:03 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Kudos to Tom Christiansen and problems with OO
Message-Id: <5j0nvf$ua@fridge-nf0.shore.net>

nelson (nmljn@wombat.netsinc.com) wrote:

: {Andrew hauled away by long cane amidst volley of rotten vegetables}
: BTW, are we talking jazz {piano,violin}, classical, country...?
: Any other jazz pianist Perl types out there besides myself?

Not me.  Although I like classical/jazz, I'm a rock/fusion guitarist - I
used to play in a heavy metal band, then my head started to hurt so I
found myself buying up large portions of the Stanley Jordan and Wes
Montogomery collection(s).  I'd listen to Al DiMeola a bit more, but in
large doses his compositions make my head spin around like that girl
from the _Exorcist._  :-)  I still listen to Helmet, though, and Rush.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 15 Apr 1997 19:21:08 GMT
From: ceh@arcturus.sce.carleton.ca (Curtis Hrischuk)
Subject: looking for smart etags for perl
Message-Id: <CEH.97Apr15152108@arcturus.sce.carleton.ca>

Hi.  I am using the ptags perl script for generating emacs TAG files.
However, because I am using packages quite heavily it is getting
confused.  Is there a smarter etags generator available?

Thanks

Curtis
-- 
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ Curtis Hrischuk (PhD Cand)  "in reality that comes from above      _/
_/ ceh@sce.carleton.ca          God is calling                        _/
_/ Carleton University          there's no bigger love                _/
_/ Ottawa, On., Canada, K1S-5B6 It's his reality that welcomes us back_/
_/ Ph  (613) 520-2600 x1762     Trust and obey                        _/
_/ FAX (613) 520-5727           there is no other way..." the newsboys_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


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

Date: 12 Apr 1997 17:33:20 GMT
From: cbbrowne@news.brownes.org (Christopher B. Browne)
Subject: Needed: Perl-based mailto filter
Message-Id: <slrn5kvhfp.187.cbbrowne@knuth.brownes.org>

My ISP doesn't offer me CGI access, and so if I wish to do anything
with forms, it must be by using mailto: tags for the FORM action.
Unfortunately, the email is dumped out looking like the following:

longname=name&email=address&phone=telno&contacttype=dunno&big6=&client=&compan
y=&region=dunno&province=&city=&sapsystem=dunno&db=dunno&os=mscrap&connect=&tr
avel=dunno&dresscode=dunno&paybasis=dunno&amount=&perwhat=year&vacation=dunno&
text=

My intent is to take these bits of email, have MH's delivery features
pass them to a Perl (or perhaps Python; this feels like a good
exercise for learning the language...) script which deconstructs this,
and builds back up a nicer piece of email.  Or perhaps drops the data
into a "database" table.

I just did a web search (Yahoo, Excite, AltaVista) for "mailto tools"
and didn't find anything faintly relevant.  If there isn't anything,
I'll just code something up.

But if someone has written something that makes the data (for
instance) look like what you'd have going into a CGI script, 'twould
be nice to be able to "Steal this Code."  I'd written a Perl CGI
script to process the form; it would be really nice to be able to use
that code.

URL's welcomed.
-- 
Christopher B. Browne, cbbrowne@unicomp.net, chris_browne@sdt.com
PGP Fingerprint: 10 5A 20 3C 39 5A D3 12  D9 54 26 22 FF 1F E9 16
URL: <http://www.conline.com/~cbbrowne/>
Linux: When one country worth of OS developers just isn't enough...



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

Date: 15 Apr 1997 20:02:53 GMT
From: danh@danpc.cris.com (Dan Haskell)
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <slrn5l7ncu.1ka.danh@danpc.cris.com>

In article <5ilbk6$f85$2@news.du.etx.ericsson.se>, Robert Virding wrote:
[lots snipped]
>A final question which has long interested me and which seems relevant
>to this whole discussion: who would use Tcl if it DIDN'T have such a
>integrated interface to Tk?

Anyone who wanted a simple scripting language that could be easily embedded
into their applications. Last time I checked Tcl was the only language you
could do this with. There was something called libscheme that came close,
but did not really allow for full integration with the application.

Not too long ago I added a Tcl interpreter into my pet application (a GIS
data conversion tool). It was an easy task and it has (IMHO) greatly improved
the usefulness of the application. Users can now write their own extensions
to my program in Tcl. It also provides a framework for them to make calls to
compiled libraries.



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

Date: Tue, 15 Apr 1997 20:23:09 GMT
From: Alexey Goldin  <a-l-e-x-e-y@o-d-d-j-o-b.u-c-h-i-c-a-g-o.e-d-u>
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <m1u3l8f32q.fsf@spot.uchicago.edu>

danh@danpc.cris.com (Dan Haskell) writes:

> 
> Anyone who wanted a simple scripting language that could be easily embedded
> into their applications. Last time I checked Tcl was the only language you
> could do this with. There was something called libscheme that came close,
> but did not really allow for full integration with the application.

Have you tried SIOD? CLISP?



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

Date: Tue, 15 Apr 97 19:50:49 GMT
From: ab20@tntvax.ntrs.com (Alejo Balingit)
Subject: Parsing hex characters
Message-Id: <1997Apr15.144831.6309@news.ntrs.com>

I am new to perl and am really amazed at how fast people have come up with the 
solutions to my postings.  I've replaced a C program to parse our data with 2 
lines of perl code which really amazed me.  On to the question......

I searched the programming perl book, and read the newsgroups, but I was not 
able to find a way to remove hex data from a file. We have a C program to do 
the following:


The following data comes from the mainframe:

 ^Z|XYZ     | ^Z| 00001.| ^Y|1994-05-10 00:00:00:000|   ? ^Z|ABCD    | 
^Y|1994-05-10 00:00:00:000| ^Z|331 | ^Z|    | ? ^B||


The output looks like this:

XYZ     | 00001.|1994-05-10 00:00:00:000||ABCD    |1994-05-10 00:00:00:000|331 
|   |||


Notice that the hex characters are removed including the trailing delimiter, 
but if thare is a "?" in the field AND a hex character, the delimiter is not 
deleted.  What can I use to check/remove hex characters?


Thanks in advance....

Alejo


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

Date: 15 Apr 1997 20:25:08 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Perl code for POST and GET?
Message-Id: <5j0o74$ua@fridge-nf0.shore.net>

Keat Lim (ragloh@menger.eecs.stevens-tech.edu) wrote:
: does anyone know if there is a way to push data equivalent to a POST or
: GET from a html form? i'm trying to get around a server with a password
: but i do not want the people to fill in the user+password, but instead
: have a cgi-bin script to do it so i can have only certain people to get
: into it without typing the user+pass.

As for your implementation details, I can't help you, but I'd suggest
that you look into the libwww (LWP) modules, which include the GET and
POST scripts which might help you out.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 15 Apr 1997 14:15:01 -0700
From: danny@hendrix.postino.com (Danny Aldham)
Subject: Re: Perl code for POST and GET?
Message-Id: <5j0r4l$h7j@hendrix.postino.com>

Keat Lim (ragloh@menger.eecs.stevens-tech.edu) wrote:
: does anyone know if there is a way to push data equivalent to a POST or
: GET from a html form? i'm trying to get around a server with a password
: but i do not want the people to fill in the user+password, but instead
: have a cgi-bin script to do it so i can have only certain people to get
: into it without typing the user+pass.

Check out the LWP Modules at CPAN. They will do what you want.

--
Danny Aldham    SCO Ace, MCSE    www.postino.com


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

Date: Tue, 15 Apr 1997 15:55:07 -0400
From: Brian Lorraine <lorraine@ait.nrl.navy.mil>
Subject: perl--- DOS?
Message-Id: <3353DD1B.167E@ait.nrl.navy.mil>

Anyonw know if there is such a thing as a perl compiler for MD-DOS? Not
allowed to do anything "fun" on the puters at work so i have to do
whatever on my pc at home  >:P

thanks,

-the BrAiN-


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

Date: 15 Apr 1997 14:12:41 -0700
From: danny@hendrix.postino.com (Danny Aldham)
Subject: Re: POP3 perl script
Message-Id: <5j0r09$h6q@hendrix.postino.com>

Generic Blues (root@gblues.grey.org) wrote:
: I want to write a perl script that will make a connection to a POP3
: server, login, etc. and grab any new mail I have and move it to
: /var/spool/mail. While I can handle most of this, what I don't know how to
: do is establish the network connection and communicate over it. Can
: someone give me an example of a) establishing the connection, b) sending
: something (i.e. "USER gblues") over that connection, and c) recieving
: data over it as well? I'd appreciate it.

You want to try using the Mail::POP3Client module, such as:

#!/usr/bin/perl -w
use Mail::POP3Client ;
$pop = new Mail::POP3Client("user","password","host.domain.com") ;

open(MAIL,">>/var/spool/mail/user") ;
print "Start Loop\n";
print " Number of messages : ",$pop->Count ,"\n" ; 
$Number = $pop->Count  ; 
if ($Number eq 0 ) { print "NO MAIL !!!" }
for ($i = 1 ; $i <= $pop->Count ; $i++) {
      print "Pulling message number : ",$i,"\n" ;
      print MAIL $line = $pop->Head($i) ;
      print MAIL $line = $pop->Body($i) ;
      }

--
Danny Aldham    SCO Ace, MCSE    www.postino.com


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

Date: 15 Apr 1997 20:09:16 GMT
From: "Bill House" <bhouse@dazsi.com>
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <01bc49d7$6102c8e0$03d3c9d0@wjh_dell_133.dazsi.com>

Frederic BONNET <fbonnet@irisa.fr> wrote in article <3353A025.52BB@irisa.fr>...
> 
> Actually, I hate to see bad tecchnology (and techniques) go over utilized. (HHOS!) 
> I think about DOS, Windows, Intel x86, and so on (all this is of course IMHO).
>

One leads to the other.

Bill House
-- 
bhouse@dazsi.com
http://www.dazsi.com




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

Date: Tue, 15 Apr 1997 14:53:58 -0400
From: Paulo Bellem <coop5b30@nortel.ca>
Subject: Sorting files
Message-Id: <3353CEC6.5D8B@nortel.ca>

Hello

I am having a problem with sorting files.
I have a bunch of data files i.e.

10.2.97
11.3.97
2.6.97
etc. in a directory

Now I have a script which checks these files for certain phrases and
then do the following in order to get only the information that I need.
$cmd = "find $fn*.dat -print |xargs grep '$fstring' 2>&1 |";


After I use open(DATA,$cmd)

and start to read in line by line from DATA.  How can I sort this
inorder to
get the info from 2.6.97 before 10.2.97 and 11.2.97. 

If anyone can help me I would appreciate it.

Paulo


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

Date: 15 Apr 1997 20:03:48 GMT
From: "Greg Schiedler" <Greg@Limo.Net>
Subject: Strict Mode Referencing I need help.....
Message-Id: <01bc49d8$4c4539a0$a58ca3ce@server-1>

I have started using strict mode and I can't seem to get this code to work
as it did previously due to my lack of knowledge about strict mode
refencing.

Im looking to set $main::additional to a scalar value ie.  117

Without using strict mode this example formats to $main::additional =
@Deluxe1(Hdaily)

I concatenate $main::type and $main::pickupzone for the array name

And I concatenate $main::season and the text 'daily' for the element that I
want the scalar value for.

$main::additional = "@{$main::type . $main::pickupzone}{($main::season .
'daily')}";    # Set the Base Rate for Ouptut Information

The 2nd problem is the same situation except that I use all varriables and
no text.


This is the values that each of these contain before the $main::price
assignment is made.

$main::type = "Deluxe";
$main::pickupzone = "1";
$main::season = "H";
$main::rates = "3Night";

$main::price = "@{$main::type . $main::pickupzone}{($main::season .
$main::rates)}";	# Formats to @Deluxe1{H3Night};

I know this is some incredible stupid error on my part but I can't seem to
get the correct syntax down for what I think I'm doing.

Any help would be appreciated....

Greg@Limo.Net



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

Date: 15 Apr 97 15:06:37 EDT
From: jcoleman@alison.sbc.edu
Subject: Thread Synchronization?
Message-Id: <1997Apr15.150637.278@alison.sbc.edu>

I'm looking for advice on thread synchronization in perlis.dll.  I'm using
NT4.0, IIS 3.0, Access 95, Jet 3.5.  Basically I'm having multithreading
collisions with ODBC connections, and need some ideas on how to keep my threads
separated.

TIA

John Coleman
jcoleman@sbc.edu


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

Date: Tue, 15 Apr 1997 15:51:29 -0600
From: mikeh@iac.net
Subject: Re: Unix and ease of use  (WAS: Who makes more
Message-Id: <861137172.11745@dejanews.com>

Tim Behrendsen (tim@a-sis.com) wrote:
> Steve Mading <madings@earth.execpc.com> wrote in article
> <5j071r$530$1@earth.execpc.com>...
> > Tim Behrendsen (tim@a-sis.com) wrote:
> > : >
 >
> > : Or how about self-extracting archives?
> >
> > A nice thing if you don't mind limiting yourself to one machine
> > archetecture.  (Imagine trying to run a self-extracting exe on
> > Windows NT on a non-intel box like Alpha.)  The Unix community
> > does not want this feature since the Unix community has zillions
> > of different archetectures to pass files between.  Since gzip
> > came from Unixy people - it has no self-extracting exe format.
> > This has nothing to do with it being free and everything to do
> > with it being from Unix.
>
> I must admit this a good point.  It would an interesting project
> to write a very small extracter in C that could be imbedded with
> the binary data, and all that wrapped in a shell script.  The
> shell script could create the binary file and a .c file, compile
> it, and then do the extraction.  Of course, not all Unix hosts
> have C compilers, so this still wouldn't be a perfect solution.
>
> Or write the extractor using the bourne-shell ... ugh.
>

Actually, I once wrote such a thing.  It was my first Perl
program, before I became a (semi-)real programmer.  It
will tar, gzip, and produce a bourne shell wrapper for any
file set.  It is actually still in use at several companies
as a way to distribute software -- the nice feature for a
commercial company is its "shrink-wrap license" feature where
you must reply "yes" to a message before it will extract.

It is verified to run on 11 different Unix flavors, and even
runs on the MKS Korn shell for Dos, though 8.3 file naming was
a problem at the time I did it.

It has a whole host of options for building configurable
extractors from the command line, which allows it to be
put in a Makefile to build the module (complete with kickoff
of platform-specific installation).

If anyone would be interested, let me know, and I will dig
up a URL for it.

Regards,
Mike

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


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

Date: Mon, 14 Apr 1997 10:56:50 -0700
From: Al Christians <achrist@easystreet.com>
Subject: Re: What does "UNIX" stand for..
Message-Id: <33526FE2.7CFD@easystreet.com>

If you don't stand for something, you'll stand for anything.


Al


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

Date: 15 Apr 1997 18:44:38 GMT
From: brand@bnr.ca (Brand Hilton)
Subject: Re: Why is $Line=~ s///; erasing =
Message-Id: <5j0iam$jf2@crchh327.rich.bnr.ca>


In article <5iun05$ha@pirate.shu.edu>,
David Alan Black <dblack@icarus.shu.edu> wrote:
>Hello -
>
>Tom Christiansen <tchrist@mox.perl.com> writes:
>
>> [courtesy cc of this posting sent to cited author via email]
>
>>In comp.lang.perl.misc, obsidian@shore.net (Kevin Swope) writes:
>>:why does:
>>:$Blank_var="";
>>:$Tag=~ s/$Blank_var//;
>>:occasionally erase the = from variable $Tag when it contains a =
>>:the line:
>>:$Tag=~ s///;
>>:does the same thing.
>
>>Because
>
>>    if ( /something/ )  {
>>	s//bar/;
>>    }
>
>>changes "something".  This is mentioned in perlop.
>
>Admitting that I couldn't find mention of this in perlop or
>the Camel - testing it in any case gave me a segfault:
>
>candle:~/hacking/perl$ perl -w
>$_ = "abc";
>if (/a/) { s//e/; }
>^D
>Segmentation fault

First off, this doesn't generate any kind of fault on my HPUX 9.05
machine.


Second off, to quote from perlop:

      s/PATTERN/REPLACEMENT/egimosx
              [deletia]
                                                            If the pattern
              evaluates to a null string, the last successfully executed
              regular expression is used instead. 

Since $Blank evaluates to a null string, the last successfully executed
regular expression (presumably /=/) is used.  Try this to see it more 
clearly:

$_='=';
/=/;   # successful regexp match

$Tag='abc=def';

$Blank_var="";
$Tag=~ s/$Blank_var//;  # null string... use /=/

print "$Tag\n";  # prints abcdef




-- 
---------------------------------------------------------
The opinions expressed here are not mine.  I had my own opinions 
surgically removed several years ago.  They don't belong to BNR
or Northern Telecom, either, since they let their license lapse.


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


------------------------------
End of Perl-Users Digest V8 Issue 308
*************************************

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