[7921] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1546 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 29 13:10:47 1997

Date: Mon, 29 Dec 97 10:00:23 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 29 Dec 1997     Volume: 8 Number: 1546

Today's topics:
     Re: capturing strings <jdporter@min.net>
     Complex shell pipes to perl? <dkhosla@compaq.com>
     extract using reg. expr p.babu@giasmd01.vsnl.net.in
     Re: extract using reg. expr <rra@stanford.edu>
     Re: extracting data from a file to be put in a variable (Michael Budash)
     Re: How to get unique list value (Mike Stok)
     Re: learning perl <patrick.philippot@hol.fr>
     Re: Merry XMas perl monsters <jdporter@min.net>
     Re: Merry XMas perl monsters (brian d foy)
     MIME::Base64 troubles <brian@criticalpath.net>
     Re: Mysterious FileHandle + fork() behavior; possible P <achen@nssdc.gsfc.nasa.gov>
     need URL parsing help <brian@criticalpath.net>
     Re: next == continue?? (& switch statements) (Kevin Reid)
     Re: perl <STDOUT> to gnuplot <STDIN> (Andrew M. Langmead)
     Re: Perl editor needed <jdporter@min.net>
     Printing EOT? (Wade Williams)
     Re: Printing EOT? <doug@tc.net>
     Re: Printing EOT? <joseph@5sigma.com>
     Re: Programmer needed <jdporter@min.net>
     question about syntax <cboget@apdi.net>
     Re: Reloading HTML <burleigh@hackberry.chem.niu.edu>
     Re: Sorting files <jdporter@min.net>
     Re: Which language pays most? Smalltalk, not C++ nor Ja <pats@acm.org>
     Re: Which language pays most? Smalltalk, not C++ nor Ja <carla@ici.net>
     Win32::NetResource::GetSharedResource Problem <fgint@dial.oleane.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 29 Dec 1997 09:54:23 -0500
From: John Porter <jdporter@min.net>
Subject: Re: capturing strings
Message-Id: <34A7B99F.27B@min.net>

Tushar Samant wrote:
> 
> mocat@nospam.best.com writes:
> >more simply put, i want the "alt" to reflect the "src" image name.
> 
> Use HTML::TreeBuilder. (This one looks gross but at least it's a
> one-liner...)
> 
> #!/usr/local/bin/perl -MHTML::TreeBuilder
> 
> print HTML::TreeBuilder
>     ->new
>     ->parse_file(\*STDIN)
>     ->traverse(
>         sub {
>             my($node) = @_;
>             $node->attr("alt", $node->attr("src"))
>                 if ref($node) and $node->tag eq "img";
>             1;
>         }
>     )
>     ->as_HTML;


Not gross at all, Tushar!  It's a work of art!
I mean that sincerely.

I gotta start using HTML (module) more.

John Porter
jporter@logicon.com


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

Date: Mon, 29 Dec 1997 16:01:35 GMT
From: "Deepak Khosla" <dkhosla@compaq.com>
Subject: Complex shell pipes to perl?
Message-Id: <01bd1473$aa961900$b90e12ac@print-tst01>

Hi,
I have a complex 'application' written in ksh. For quite a while I have
been contemplating  converting it to perl (over 200K lines of code!). My
primary reason has been that it may be easier to run on NT (if I chose) and
it would probably be a little faster since there would be a lot fewer
system calls.

However, the primary purpose is to backup system files. I do a lot of pipes
and backgrounding of tasks to run in parallel for performance. I have
looked through the FAQ and tried to keep up once in a while on the WIN32
advances and I have a couple of (what I consider) stumbling blocks.

1) Handling of pipes is not very straightforward...e.g. in shell I do the
following:

Prog1:
=====
func_in ()
{
	$IN_FUNC	# e.g. dd if=input_file; send output to STDOUT
	STAT_IN=$?
}

func_proc ()
{
	$PROC_FUNC	# e.g. compress; takes STDIN, process, send to STDOUT
	$STAT_PROC=$?
}

func_out ()
{
	STAT_OUT=1
	STAT=`$OUT_FUNC`	# e.g "rsh host 'some_script'" whose output shows stat
	[ "$STAT" = "OKEYDOKEY" ] && STAT_OUT=0
}

and in main for Prog1

$in_proc | $func_proc | $func_out

And then check the STAT_* variables for status of each step of the pipe. (I
have to be able to use  system provided tools for each of the 3 steps in
the pipe above).

Prog2:
====
Calls several Prog1sin background i.e.
	Prog1 &
	Prog1 &
and checks on them peirodically till done and then gets their status.

Q1: How easy and portable is this in perl? I looked at some pipe examples
that deal with a single pipe and in the foreground. While my brain finally
got around to understanding that, this situation had me overwhelmed not
considering all the cautions about signals etc. that the shell
makes real easy for me.....

Q2) Since Win32 does not support 'fork', is the above situation become so
difficult to manage that it is not worth considering the port?

Q3) Is perl the right choice for this type of app? soemone want to port it
for me for a price? :-)


Any experiences/words of wisdom would be appreciated.


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

Date: Mon, 29 Dec 1997 10:33:15 -0600
From: p.babu@giasmd01.vsnl.net.in
Subject: extract using reg. expr
Message-Id: <883412774.505282576@dejanews.com>

I am facing a couple of problems with regular expressions. I am unable to
find a good tutorial on regular expressions.

For example, I have a perl code like:

$str='Hello <a href="mailto:samy@ppp.com">mail me</a>';
$str =~ s/:[^@]*[^"]*//;
print $&;

The above program prints out:

:samy@ppp.com

I want to extract "samy@ppp.com". Is it possible to it using one
expression. Also, if

$str = "Hello : E-Mail : cyrus@cytel.com <BR>";

The above program prints out:

: E-Mail : cyrus@cytel.com <BR>

Is it possible to print out email address alone using a single expression?

To put it in a simple way, I want to scan a line of text for the
occurrence of '@' character and retrieve all the characters before and
after the '@' till the occurrence of white space or ":" or "\"". Is it
possible to do it using a single reg. expression?

Thanks.,
Babu

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


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

Date: 29 Dec 1997 08:51:17 -0800
From: Russ Allbery <rra@stanford.edu>
To: p.babu@giasmd01.vsnl.net.in
Subject: Re: extract using reg. expr
Message-Id: <m3ius8ay9m.fsf@windlord.Stanford.EDU>

[ Posted and mailed. ]

p babu <p.babu@giasmd01.vsnl.net.in> writes:

> I am facing a couple of problems with regular expressions. I am unable
> to find a good tutorial on regular expressions.

If you can, get _Mastering Regular Expressions_ by Jeff Friedl, published
by O'Reilly.  It's the best reference work on regexes available.

> To put it in a simple way, I want to scan a line of text for the
> occurrence of '@' character and retrieve all the characters before and
> after the '@' till the occurrence of white space or ":" or "\"". Is it
> possible to do it using a single reg. expression?

($address) = ($line =~ /(?:[:\"\s]|^)([^\@]+\@[^ :\"\s]+)/)

-- 
#!/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


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

Date: Mon, 29 Dec 1997 08:40:29 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: extracting data from a file to be put in a variable
Message-Id: <mbudash-2912970840290001@d102.pm3.sonic.net>

In article <349DE160.491EA9D6@diagdata.com>, melton@diagdata.com wrote:

>> I have a password data file - ascii
>> ie  
>> bob bobm
>> where bob is user and bobm is password
>> want to add extra data
>> bob bobm 12345 12457 32456
>> and in the perl script, take the extra data and put
>> it into a variable so the data in the variable
>> would look like 12345 12457 32456
>> and then take the data in the variable and set in an html file
>> <INPUT type=hidden name=KEYW2 value="12345 12457 32456"
>> how should I do it.?

see perl's split operation (hint: use its optional third parameter)

-- 
Michael Budash, Owner * Michael Budash Consulting
mbudash@sonic.net * http://www.sonic.net/~mbudash
707-255-5371 * 707-258-7800 x7736


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

Date: 29 Dec 1997 12:36:29 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: How to get unique list value
Message-Id: <688n2t$136$1@stok.co.uk>

In article <34A70EC6.6B39F196@5sigma.com>,
Joseph N. Hall <joseph@5sigma.com> wrote:
>Here's the grep-free, temporary-free version from my book:
>
>  @uniq = sort keys %{ { map { $_, 1 } @list } }

Yes, but surely there is an anonymous temporary hash in there?

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: 29 Dec 1997 17:44:03 GMT
From: "Patrick Philippot" <patrick.philippot@hol.fr>
Subject: Re: learning perl
Message-Id: <01bd146d$d229afa0$02000001@mainsoft>

You could have a look at:

http://language.perl.com
http://www.perl.com
http://www.gsm.uci.edu/~bmehling/perl
http://www.att.com/homes/chsiao/perl.html

Just to name a few. These pages are enough for a kick start and they
contain links to other pages of interest.

-- 

Patrick Philippot

-pp (MainSoft sarl)
------------------------------------

patrick.philippot@hol.fr
Compuserve: mainsoft / mainsoft@compuserve.com
http://ourworld.compuserve.com/homepages/mainsoft
tel/fax: +33 (0)1 69 40 94 85


Joe <no1joe@geocities.com> wrote in article
<34A70E0F.FD99D627@geocities.com>...
> hi im interested in getting started on learning perl/cgi scripts can
> any1 point me to some good sites on the net to help me out or anything
> else i may be interested in?
> 
> thanx in advance
> Joe
> 
> 


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

Date: Mon, 29 Dec 1997 10:30:17 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Merry XMas perl monsters
Message-Id: <34A7C209.33C@min.net>

brian d foy wrote:
> 
> sub laugh
>    {
>    my $self = shift;
> 
>    qq|Ho, Ho, Ho|;
>    }
> 

sub new {
  ...
  bless {
    chuckle => 'ho',
    jollity_level => 3
  }, $class;
}

sub laugh {
  my $self = shift;
  local $" = ", ";
  ucfirst "@{[ ( $self->{chuckle} ) x $self->{jollity_level} ]}";
}


> >sub DESTROY {
>    my $self = shift;
>    undef $self;
> >  print "See you next christmas\n";
> >}

(Followups directed to alt.santa.die.die.die.)

John Porter
jporter@logicon.com


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

Date: Mon, 29 Dec 1997 10:48:57 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Merry XMas perl monsters
Message-Id: <comdog-ya02408000R2912971048570001@news.panix.com>
Keywords: from just another new york perl hacker

In article <686vgl$858$1@mendelevium.btinternet.com>, Gellyfish@btinternet.com (Jonathan Stowe) wrote:


>It was more like persuading Santa to destroy himself after he outlived his 
>function, is there a newsgroup dedicated to the assasination of said figure 
>perhaps?  This could be an object lesson to all of us.

that does give new perspective to the variable suicide issue.  but the
more interesting issue is a package that stomps all over the namespaces
of other packages:

package AntiSanta;

sub new { ... #normal constructor things }

sub killkillkill 
   {
   my $self = shift;
   local $^W = 0;  #let's do this real quiet like
   undef %Santa::  #let's be dastardly
   }

-- 
brian d foy                                  <comdog@computerdog.com>
Institute For the Organically-Challenged
   <URL:http://computerdog.com/brian/Institute.html>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Mon, 29 Dec 1997 08:28:09 -0800
From: brian moseley <brian@criticalpath.net>
Subject: MIME::Base64 troubles
Message-Id: <34A7CF99.BAE506A2@criticalpath.net>

i'm forwarding a message i sent to Lincoln Stein last week. I suspect
he's been having too much holiday fun to have time for random support
email :)

-- 

* brian moseley *
{ perl warrior | agent of chaos => critical path }

------- Start of forwarded message -------

Subject: Re: New version of CGI.pm
To: lstein@w3.org
X-Criticalpath-Sent: 24 Dec 1997 16:07:28 GMT
From: Brian Moseley <brian@criticalpath.net>
Cc: brian@criticalpath.net
Return-Path: <brian@criticalpath.net>
Date: 24 Dec 1997 08:07:28 -0800
Message-Id: <19971224160728.20058.cpmta@fillmore.criticalpath.net>


>  > 3) does anybody know what the proper forum is for asking questions about
>  > MIME::Base64? i sure hope it's something better than comp.lang.perl.misc.
> 
> I've used it a bit.  What's the question?

i'm writing a web-based mail client. for some reason, my base64-encoded 

attachments aren't being decoded properly by other clients, although
they are handled correctly by my client.

as an example, i attached the same jpg to a composition in eudora and a 

composition in my client and sent both messages to a shell account so i
could save each message as a folder with pine. interesting results.

these are the headers for and the first few lines of the attachment, for
each message.

from eudora:

--=====================_882595579==_
Content-Type: application/octet-stream; name="Bridesmd.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Bridesmd.jpg"

/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a
HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy
MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAFlAMgDASIA
AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA

and from my web client:

------------=_882566924-17652-3
Content-Type: image/jpeg; name="Bridesmd.jpg"
Content-Disposition: attachment; filename="Bridesmd.jpg"
Content-Transfer-Encoding: base64

LzlqLzRBQVFTa1pKUmdBQkFRRUJMQUVzQUFELzJ3QkRBQWdHQmdjR0JRZ0hC
d2NKQ1FnS0RCUU5EQXNMCkRCa1NFdzhVSFJvZkhoMGFIQndnSkM0bklDSXNJ
eHdjS0RjcExEQXhORFEwSHljNVBUZ3lQQzR6TkRMLwoyd0JEQVFrSkNRd0xE
QmdORFJneUlSd2hNakl5TWpJeU1qSXlNakl5TWpJeU1qSXlNakl5TWpJeU1q

notice that the encoded lines generated by MIME::Base64 (60 chars) are
much shorter than those generated by eudora (76 chars). (incidentally,
also notice that eudora sent a jpg as application/octet-stream. ugh.)

my assumption is that the line length is the problem. this seems to be 

hard-coded into Base64.pm so i don't want to muck with it if i don't
have to. i'm sure others have been able to deliver correctly-encoded
attachments .. do you have any insight? if not, i guess i'll be fwd'ing
to comp.lang.misc.perl.

thanks - bm


------- End of forwarded message -------


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

Date: Mon, 29 Dec 1997 10:27:02 -0500
From: Allen Chen <achen@nssdc.gsfc.nasa.gov>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Mysterious FileHandle + fork() behavior; possible Perl bug?
Message-Id: <Pine.OSF.3.95.971229101851.10337B-100000@nssdc.gsfc.nasa.gov>

> >   $pid=fork();
> >   if ($pid==0) {        # child
> 
> Yep, there it is. When that's true, that _might_ be the child process, but
> it may be a failed fork. If you're trying to start 20 processes at once,
> it's pretty important to check for a failed fork.

Thanks for the feedback.  I always forget about checking for that when I
fork!  I fixed the forking code as follows:

if ((defined($pid = fork)) && ($pid==0)) {    #child
  ...
  exit(0);
} else {                                      #parent
  return $pid;
}

Unfortunately, this did not correct my problems.  I am still getting the
exact same behavior.  Any ideas on what else might be wrong?

Thanks much,
-Allen

Allen Chen   /   Systems Programmer    /   Hughes STX Corporation  ////
SSDOO Software, Systems / International Solar-Terrestrial Physics /////
e-mail: achen@nssdc.gsfc.nasa.gov   /     voice: (301) 286-7376  //////



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

Date: Mon, 29 Dec 1997 09:24:29 -0800
From: Brian Moseley <brian@criticalpath.net>
Subject: need URL parsing help
Message-Id: <34A7DCCD.FC615282@criticalpath.net>

i'm using Tom C's "plaintext URL -> hyperlinked URL" regexp from TPJ #1. sadly,
it doesn't handle the situation in which the URL is surrounded by HTML-encoded
characters (i've tested so far with angle brackets and with quotes).

given:

    &lt;http://www.maz.org/&gt;

i want: 

    &lt;<a href="http://www.maz.org/">http://www.maz.org/</a>&gt;

but the regexp (correctly) gives me: 

    &lt;<a href="http://www.maz.org/&gt">http://www.maz.org/&gt</a>;

what's the best way to modify the regexp to handle this situation?

---- here's the sub:

sub _urlify {
    my $line = shift;
    my $urls = '(' . join ('|', qw{http telnet gopher file wais ftp}) . ')';
    my $ltrs = '\w';
    my $gunk = '/#~:.?+=&%@!\-';
    my $punc = '.:?\-';
    my $any = "${ltrs}${gunk}${punc}";
    $line =~ s{
       \b           # start at word boundary
       (            # begin $1
         $urls :    #  need resource and a colon
         [$any] +?  #  followed by one or more
                    #  of any valid character, but
                    #  be conservative and take
                    #  only what you need to....
       )            # end $1
       (?=          # a look-ahead,
                    #  non-consumptive assertion
           [$punc]* # either 0 or more punctuation
           [^$any]  #  followed by a non-url char
         |          # or else
            $       # then end of the string
       )
     }{<a href="$1">$1</a>}igox;
    return $line;
}

-- 

* brian moseley *
{ perl warrior | agent of chaos => critical path }


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

Date: Mon, 29 Dec 1997 12:16:31 -0500
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: next == continue?? (& switch statements)
Message-Id: <1d1z9iv.16vzqr1st1yb6N@slip166-72-108-236.ny.us.ibm.net>

Andrew M. Langmead <aml@world.std.com> wrote:

> sassee@unx.sas.com (Steve Evans) writes:
> 
> I have no idea about the "last"/"next" thing. I would guess that it
> would have to do with being words that better describe their function
> than the C keywords.
> 
> > And another thing,
> >all the books mention "there is no switch statement, 
> >but you can easily write one with if-else".   Why!?
> >It's a useful construct, what's the problem adding it??
> >You could probably replace many keywords (while, unless, etc)
> >with if-else's and goto's, but who'd want to?
> 
> It depends on whether you think switch statements were there to
> enhance a program readability or to implement a different an entirely
> different programming construct.
> 
> If you look at C or similar procedural languages from an assembler
> programmer's point of view, it may seem that "if" statements are in
> the language to implement conditionals and "switch" statements are
> there to implement jump tables. If the people creating languages back
> then were implementing optimizing compilers, would they have creating
> a switch construct?

Here's a couple of ideas:

#!perl -w

# ---------------- #1 Simple but ugly
sub foo {print "one\n"}
sub bar {print "two\n"}

%jtable = (
  1 => \&foo,
  2 => \&bar,
  3 => sub {print "three\n"}
);

for (1..3) {
  &{$jtable{$_}}
}


# ---------------- #2 like Pascal
sub case ($@) {
  my ($value, %cases) = @_;
  
  &{$cases{$value}};
}

for (1..3) {
  case ($_,
    1 => sub {print "uno\n"},
    2 => sub {print "dos\n"},
    3 => sub {
      print "tres\n"
    }
  );
}

__END__

This isn't the "normal" way to do it, but it is A way. TMTOWTDI.

-- 
Kevin Reid


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

Date: Mon, 29 Dec 1997 15:04:45 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: perl <STDOUT> to gnuplot <STDIN>
Message-Id: <ELyHvx.n4u@world.std.com>

ron@farmworks.com (Ronald L. Parker) writes:

>That's not a file.  Isn't it documented somewhere that the return from
>opening a pipe isn't very useful?  Does the Tom Phoenix 'bot need an
>adjustment?

Its not that the return value (whether the fork() succeeded) isn't
useful, its just on *as* useful as many people want it to
be. (expecting it to tell whether the following exec() succeeded as
well.)

-- 
Andrew Langmead


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

Date: Mon, 29 Dec 1997 10:14:30 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Perl editor needed
Message-Id: <34A7BE56.497E@min.net>

Lars Kristensson wrote:
> I have to mention QEdit for DOS. I have a faint feeling it has changed
> name since I last used it but anyway, It's really a killer!

It is now called The Semware Editor (TSE) as it's made by Semware.
(Why TSE is a better name than QEdit is anybody's guess.)
One thing about this program: it only runs under DOS (or a DOS box).
Here's my endorsement: it's the only piece of shareware I've ever
liked enough to pay the registration fee for!

John Porter
jporter@logicon.com


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

Date: Mon, 29 Dec 1997 11:02:00 -0600
From: wwilliam@cisco.com (Wade Williams)
Subject: Printing EOT?
Message-Id: <wwilliam-2912971102010001@sj-dial-4-44.cisco.com>

I've looked through all the documentation and I've been unable to find an
answer to this one.

How does one print special characters such as EOT (control-d)?

I've opened sendmail with the "ignore periods" option:

  open(MAIL,"|/usr/lib/sendmail -ti") 

and I need to send a EOT to indicated the end of the message.  How can I do it?

Thanks,

Wade

-- 
 ---------------------------------------------------------------------------
 Wade Williams                      "Any escape might help to smooth the
 Systems Engineer                    unattractive truth, but the suburbs
 Cisco Systems, Inc.                 have no charms to soothe the restless
 Brentwood, TN                       dreams of youth." 
 615-221-2918                              - N. Peart
 wwilliam@cisco.com    
 ---------------------------------------------------------------------------


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

Date: 29 Dec 1997 12:25:48 -0500
From: Douglas McNaught <doug@tc.net>
Subject: Re: Printing EOT?
Message-Id: <m21zywukmb.fsf@ono.tc.net>

wwilliam@cisco.com (Wade Williams) writes:

> I've looked through all the documentation and I've been unable to find an
> answer to this one.
> 
> How does one print special characters such as EOT (control-d)?

print("\04");  # see 'man perlop'

But that's not what you want; see below.

> I've opened sendmail with the "ignore periods" option:
> 
>   open(MAIL,"|/usr/lib/sendmail -ti") 
> 
> and I need to send a EOT to indicated the end of the message.  How
> can I do it?

Close the filehandle.  Sendmail will get an EOF on its input and send
the message.  The EOT character has no special meaning when sent
through a pipe; it's the tty driver that intercepts it and tranlates
it into an EOF.

-Doug
-- 
sub g{my$i=index$t,$_[0];($i%5,int$i/5)}sub h{substr$t,5*$_[1]+$_[0],1}sub n{(
$_[0]+4)%5}$t='encryptabdfghjklmoqsuvwxz';$c='fxmdwbcmagnyubnyquohyhny';while(
$c=~s/(.)(.)//){($w,$x)=g$1;($y,$z)=g$2;$w==$y&&($p.=h($w,n$x).h($y,n$z))or$x==
$z&&($p.=h(n$w,$x).h(n$y,$z))or($p.=h($y,$x).h($w,$z))}$p=~y/x/ /;print$p,"\n";


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

Date: Mon, 29 Dec 1997 10:38:33 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Printing EOT?
Message-Id: <34A7E019.72442B4C@5sigma.com>

Wade Williams wrote:
> 
> I've looked through all the documentation and I've been unable to find an
> answer to this one.
> 
> How does one print special characters such as EOT (control-d)?

print "\cD";

BUT ....

> I've opened sendmail with the "ignore periods" option:
> 
>   open(MAIL,"|/usr/lib/sendmail -ti")
> 
> and I need to send a EOT to indicated the end of the message.  How can I do it?

No, what you need to do is indicate END OF FILE.  The way you do
that is you close the pipe.  The way you do that is with the
close operator:

  close MAIL;

	-joseph
	 http://www.effectiveperl.com


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

Date: Mon, 29 Dec 1997 11:14:22 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Programmer needed
Message-Id: <34A7CC5E.3E30@min.net>

Vladimir Geshanov wrote:
> 
> Hey there!
> 
> Need some perl script. Description is attached in txt format.
> 
> Thanks
[snip]

The answer to this question is in the FAQ.  ;-)


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

Date: Mon, 29 Dec 1997 11:54:25 -0500
From: "Sorrow" <cboget@apdi.net>
Subject: question about syntax
Message-Id: <688ks1$krc$1@news2.cais.com>

I was reading the perlfunc manpage and came across
the following:

@articles = sort {$a cmp $b} @files;

what is the {} doing?  I believe I know what the curly
brackets are used for, but the above doesn't fit.
Also, I saw this snippet of code in a message:

map{"@$_\n"}
sort{$a->[1]<=>$b[1]}

where is the $a and $b coming from?  (those are
the first 2 lines of the code, so the $a and $b aren't
being declared or set up in any way prior to the
sort line).
Thanx for any help.

Chris



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

Date: Mon, 29 Dec 1997 10:54:48 -0600
From: Darin Burleigh <burleigh@hackberry.chem.niu.edu>
Subject: Re: Reloading HTML
Message-Id: <34A7D5D8.6A67@hackberry.chem.niu.edu>

Ho Seng Yip wrote:
> 
> Hi,
> 
> I will like to ask after my perl script has written the output to a file,
> how can I force the newly created html output page to reload itself once.
> This is so because, although the new entry is written into the html file,
> it seems that whenever I go to that page, it seems to load the previous
> page from the cache and the new entry only come in when I reload the page
> myself manually.
> 
> Will appreciate some help here. ;-)
> 
> Thanks.
> 
> Regards,
> Seng Yip

--

** this is Yet Another CGI *NOT* Perl question.

** this Question comes up Frequently in CGI discussions.

** Supposedly you can set timeouts and stuff, but browsers tend
 not to respect them. So there is no 'correct' way to do it.

** From an HTML page to a script, I haven't found any good
ways to do it. Maybe using Javascript or something. From
CGI to CGI, I often generate a random number and stick it
in somewhere.
==========================================================
 - darin
burleigh@hackberry.chem.niu.edu
\\//\\//.\\//\\//.\\//\\//. http://hackberry.chem.niu.edu/HOME/dcb/
 '2 kinds of green, look out!' - dieter rot


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

Date: Mon, 29 Dec 1997 09:50:31 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Sorting files
Message-Id: <34A7B8B7.6139@min.net>

Randal Schwartz wrote:
> Now, if it's more than about 20 names or so, you should step up to
> a Schwartzian Transform (or some other technique).  See examples
> of this in my "sorting" column from UnixReview at:
> 
>         http://www.stonehenge.com/merlyn/UnixReview/

Randal,
I looked at this file (col06.html), and found no mention of anything
called a Schwartzian (or any other kind of) Transform.
What technique specifically did you mean to refer to by this name?

John Porter
jporter@logicon.com


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

Date: Mon, 29 Dec 1997 07:11:18 -0800
From: Patricia Shanahan <pats@acm.org>
Subject: Re: Which language pays most? Smalltalk, not C++ nor Java.
Message-Id: <34A7BD96.47200066@acm.org>

John Porter wrote:
> 
> Robert Dewar wrote:
> > OK, so your compiler can compile memfoo without compiling. Wunderbar! But
> > that does NOT mean that you can actually go ahead and call a routine memfoo
> > if the standard forbids it. To do so would be incompetent programming.
> 
> So now a "language" is not defined by the compiler -- or even by the
> preprocessor+compiler+linker+etc, as some have it...
> I am forbidden by a piece of paper from calling a function 'memfoo'!
> 
> John Porter
> jporter@logicon.com

I would put it in a more positive light. You are promised that
programs that don't call a function "memfoo" and meet some other
conditions WILL compile with any correct C compiler, not just the
current version of the compiler you are using today.

Patricia


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

Date: 29 Dec 1997 17:18:12 GMT
From: "Alicia Carla Longstreet" <carla@ici.net>
Subject: Re: Which language pays most? Smalltalk, not C++ nor Java.
Message-Id: <01bd147e$11496760$6a28b4cf@carla.ici.net>

John Porter wrote:
: Robert Dewar wrote:
: > OK, so your compiler can compile memfoo without compiling. Wunderbar!
But
: > that does NOT mean that you can actually go ahead and call a routine
memfoo
: > if the standard forbids it. To do so would be incompetent programming.
 
: So now a "language" is not defined by the compiler -- or even by the
: preprocessor+compiler+linker+etc, as some have it...
: I am forbidden by a piece of paper from calling a function 'memfoo'!

No the language is *not* defined by any single compiler, neither is it
defined by any piece of paper.  A language is defined by usage.  A
combination of compilers and the standard.

The ISO Standard defines the core of the language.  Any C compiler *must*
support this common core, but it may also support various extensions to
support the specifics of its platform.  Just like the English language is
not 'defined' by any single dictionary, rather the dictionary is a
'snapshot'  of the language (or part of the language) at a particular point
in time.

Similarly the ANSI/ISO Standard is a snapshot of the common core of the C
language.  The language itself continues to grow and evolve.  Actually C9X
recognizes this but preparing a new 'snapshot' of the language (or at least
the core).

The standard is needed to keep the language balance.  To keep it from
changing out of control.  It is always an 'after the fact' situation.

-- 
If at first you don't succeed -- give up!  No use being a damn fool.
No job is so simple that is can't be done wrong.
You can only be young once, but you can be immature forever.
==========================================================
 Alicia Carla Longstreet                    carla@ici.net
 Web Page  http://www.ici.net/cust_pages/carla/index.html
==========================================================
READ THE FAQ for more information:
   C-FAQ ftp sites: ftp://ftp.eskimo.com or ftp://rtfm.mit.edu
   Hypertext C-FAQ: http://www.eskimo.com/~scs/C-faq/top.html

Remember: Those who think they know it all...
          Are very annoying to those of us who do.


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

Date: 29 Dec 1997 16:36:44 GMT
From: "Didier JEANROBERT" <fgint@dial.oleane.com>
Subject: Win32::NetResource::GetSharedResource Problem
Message-Id: <01bd1477$c02c14a0$bc16030a@fgi04084>

How to use Win32::NetResource::GetSharedResource ?

Some body have a exemple ? List all shared ressources from a server ? how
to !?

Please can anyone help ?


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

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

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