[12131] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5731 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 20 03:07:15 1999

Date: Thu, 20 May 99 00:00:22 -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           Thu, 20 May 1999     Volume: 8 Number: 5731

Today's topics:
    Re: An /e for a match rather than a substitution (Tad McClellan)
    Re: Binary image file reading or $x as a number. armchair@my-dejanews.com
    Re: boolean test input... <ebohlman@netcom.com>
    Re: File Opening Problem (Tad McClellan)
        Help on pattern matching, very diffcult one tvn007@my-dejanews.com
    Re: Help on pattern matching, very diffcult one (Larry Rosler)
    Re: How to make directory handles local? (Mark-Jason Dominus)
        Invoke a script from another script? <joe@chatpr.org>
        IPC::Open2 is being nonbidirectional. (Rollin Thomas)
        Is it a file or a link? (John Horne)
    Re: Making executables from .pl files? smnayeem@my-dejanews.com
        Parsing email headers.. <raufeisen@home.com>
        Parsing email headers <raufeisen@home.com>
        Parsing email headers fortyoz@my-dejanews.com
    Re: Perl "constructors" <rra@stanford.edu>
    Re: perltootc - OO Tutorial for Class Data in Perl <ebohlman@netcom.com>
    Re: search msoffice documents <nick@perlfect.com>
        setting file/dir attrribs correctly when using Net::FTP <kal@valistech.com>
    Re: Tie Fighter (Fuzzy Warm Moogles)
        Using perl to port a telnet session to HTML <hawkwynd@adelphia.net>
        Validating a subnet mask... <portboy@home.com>
    Re: XML::XQL <ebohlman@netcom.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 19 May 1999 19:24:22 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: An /e for a match rather than a substitution
Message-Id: <67hvh7.0hc.ln@magna.metronet.com>

Steven Primrose-Smith (primrosesmith@magnet.at) wrote:
: Tad McClellan said:

: Mississippi

: ....and an expression...

: Mis+s+p+i

: ....it needs to know whether there is a match.


   That string does not match that pattern.

   The 'Mis+s+' part matches 'Miss'

   The next character is an 'i', but your pattern requires that
   the next character be a 'p', so the match fails.


: > $string = "Mississippi";
: >                    ^
: >                    ^   the $expression cannot match that letter...

: >   Did you go fix the expression and try it?
: >   I think not!
: >   How come?

: Have you calmed down now? 


  Have you fixed your pattern now?


: What is wrong with
: Mis+s+p+i as a match expression - 


  the $expression cannot match the 'i', as I already said.

  What part of that are you not understanding?


: it should match Mississippi
: correctly (and Missssssisssssippppi, etc.) ?


   Your pattern allows 'i' only as the last character.

   (I think the pattern in this post is not the same as in
    the earlier one, but neither of them can match Mississippi
   )

   Both of those strings have 'i's that are not the last
   character, so neither of them can match.

   You _still_ need to f-i-x y-o-u-r p-a-t-t-e-r-n.



: So how can the expression be matched with the string
: if they are read in at runtime rather than provided as strings in
: the code itself.


   I've already told you how to do that.

   Larry and others have already told you how to do that.


   I give up.


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


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

Date: Thu, 20 May 1999 05:31:09 GMT
From: armchair@my-dejanews.com
Subject: Re: Binary image file reading or $x as a number.
Message-Id: <7i06mu$9f6$1@nnrp1.deja.com>

In article <7hvqau$15r$1@nnrp1.deja.com>,
  armchair@my-dejanews.com wrote:
> In article <7hvoqf$9a$1@nnrp1.deja.com>,
>   mc_david@my-dejanews.com wrote:
> > I can't seem to find anywhere in the reference books
> > that I'm using (I'm
> > looking in O'Reilly) how I can convert a character that I got
> > with getc
> > to a binary (or hex) type.
> >
> > I am reading a binary image char by char and trying to
> > convert each char
> > to a hex text representation.
> >
> > I'm sure there is some easy way to do it, and I apologize for
> >  being a
> > newbie, but when I have a character via $byteMe = getc INFILE
> > I get an
> > error when I try to print it as a hex number via print sprintf "%x",
> > $byteMe.  The error is: Argument "x" isn't numeric in sprintf ...
> >
> > So how do I make it numeric; or alternatively how should I
> > read a file
> > char by char so that I can work with each char as a hex value.
>
> There may be better ways, but this seems to work:
>
> my $byteMe = getc INFILE;
> my $byte2  = unpack("C",$byteMe);
> print sprintf "%x", $byte2;


Instead of getc() you can use read():

open(FILE,"test.txt") || die "could not open file ";
binmode(FILE);

my $data;
my $bytes = 4;
read(FILE,$data,$bytes);
my ( $byte1, $byte2a, $byte3, $byte4) = unpack("C$bytes",$data);
printf "%x", $byte1;
printf "%x", $byte2a;
printf "%x", $byte3;
printf "%x", $byte4;


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


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

Date: Thu, 20 May 1999 04:57:17 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: boolean test input...
Message-Id: <ebohlmanFC0LrH.3tL@netcom.com>

Jeremiah J Marble <jjm69@columbia.edu> wrote:
: i was wondering if anyone had written, or could refer me to, a good
: function to parse a line like 

: -->
: html AND javascript AND (perl NOT (vb OR java))
: <--

Take a look at Text::Query::Advanced (which, as of version 0.04, no 
longer requires 5.005).  There are some slight differences in syntax from 
what you wrote here (NOT is a unary operator rather than an abbreviation 
for AND NOT), but you should be able to either use it as is or change the 
parsing routines (simple recursive-descent parser with overridable 
code-generation methods) to get what you want.



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

Date: Wed, 19 May 1999 20:54:20 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: File Opening Problem
Message-Id: <sfmvh7.3hc.ln@magna.metronet.com>

[  Please fix your word wrap.  ]


Brian Frutchey (frutchey@usc.edu) wrote:
: I was hoping someone could provide some insight to a very frustrating
: problem.


   The docs that are on your hard disk can help you when you are
   getting messages from perl.

   Then you can find out what the problem is in less time than
   it took you to type in your article!


: I am using Perl 5.005_02, and have never had problems opening files for
: writing
: only before (ie, with >).  But suddenly, 


   *Something* had to change.

   Are you maybe running them as setuid now and you weren't before?

   Installed a new perl?

   Getting data that you never happened to get before?


: all of my scripts which use
: write mode
: are giving me the error "Insecure dependency in open while running
: setgid at
: ..../.../... line ...".  


   
   All of the messages that perl might generate are documented
   in the 'perldiag.pod' file that comes with perl.

   For your message it says:

----------------------------------------
=item Insecure dependency in %s

(F) You tried to do something that the tainting mechanism didn't like.
The tainting mechanism is turned on when you're running setuid or setgid,
or when you specify B<-T> to turn it on explicitly.  The tainting mechanism
labels all data that's derived directly or indirectly from the user,
who is considered to be unworthy of your trust.  If any such data is
used in a "dangerous" operation, you get this error.  See L<perlsec>
for more information.
----------------------------------------


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


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

Date: Thu, 20 May 1999 03:55:34 GMT
From: tvn007@my-dejanews.com
Subject: Help on pattern matching, very diffcult one
Message-Id: <7i013m$5vi$1@nnrp1.deja.com>

Hi,

Please some one help me on this, it is somewhat complicate for me.
You ( Tad and Larry ) were help me on simliar problem yesterday.
However,
this time the input is more complicated.


Here is the sample of input files:

 A B C D E F G I J;
 10XLHXXL1;
 11XLHLXL1;
 10LXXLXL1;
 01LHHHXL1;

the output should be:

"column C stuck at L"
"column E stuck at H"
"column G stuck at X"
"column I stuck at L"
"column J stuck at 1"

I really appreciated your help.




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


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

Date: Wed, 19 May 1999 22:47:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Help on pattern matching, very diffcult one
Message-Id: <MPG.11ad41dcb4756829989ac3@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7i013m$5vi$1@nnrp1.deja.com> on Thu, 20 May 1999 03:55:34 
GMT, tvn007@my-dejanews.com <tvn007@my-dejanews.com> says...
> Please some one help me on this, it is somewhat complicate for me.
> You ( Tad and Larry ) were help me on simliar problem yesterday.
> However, this time the input is more complicated.

Not enough more complicated to make it necessary to tweak more than two 
lines in my code.

> Here is the sample of input files:
> 
>  A B C D E F G I J;
>  10XLHXXL1;
>  11XLHLXL1;
>  10LXXLXL1;
>  01LHHHXL1;
> 
> the output should be:
> 
> "column C stuck at L"
> "column E stuck at H"
> "column G stuck at X"
> "column I stuck at L"
> "column J stuck at 1"

How can that be the output?  Column C is not stuck at L; column E is not 
stuck at H.

Below is the revised program.  The two commented lines are the previous 
versions.  The new version would have worked with the previous data 
format also.  TMTOWTDI.

You should be able to make such modifications yourself in the future.



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

#my @data = map { [ $_, { } ] } split ' ', <DATA>;
 my @data = map { [ $_, { } ] } <DATA> =~ /\w+/g;

while (<DATA>) {
#    next unless (my @vals = split) == @data;
     next unless (my @vals = /\w/g) == @data;
    ++$_->[1]{shift @vals} for @data;
}

for (@data) {
    next unless (my @keys = keys %{$_->[1]}) == 1;
    print "column $_->[0] stuck at $keys[0]\n"
}
__END__
 A B C D E F G I J;
 10XLHXXL1;
 11XLHLXL1;
 10LXXLXL1;
 01LHHHXL1;
 
-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 20 May 1999 05:46:55 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: How to make directory handles local?
Message-Id: <7i07js$oqu$1@monet.op.net>

In article <7hvd54$o2e$1@nnrp1.deja.com>, Anand  <anand@my-dejanews.com> wrote:
>For this I need to make the directory handle (that I use in opendir)
>local. How do I do it?

Put

	local *DIR;

at the top of your subroutine.


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

Date: Thu, 20 May 1999 01:54:40 -0400
From: "Joe" <joe@chatpr.org>
Subject: Invoke a script from another script?
Message-Id: <vnN03.166$cF3.6364@news13.ispnews.com>

Hi there!

Hi have a simple cgi which base function is to show pictures.

The user writes on querys the pictures he wants to see and the cgi show it.

example: /cgi-bin/showpic.cgi?picname=florida-beach.jpg&width=400&height=60

now, the problem is that i want another cgi to be written in the resultant
"html" page, my banner.cgi

please visit

http://www.surfpr.com/cgi-bin/showpic.cgi?picname=norte/losalmendros/panoram
ic&width=416&height=267&alt=HI+&spot=Los+Almendros&place=Camuy

in that "html" i want that http://www.surfpr.com/cgi-bin/banner.cgi runs in

i will have a page like this:
http://www.surfpr.com/map/norte/losalmendros/03.shtml

any help please
[sorry for the english, is morning and i have to sleep, the cgi had me all
night here]




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

Date: 20 May 99 05:00:59 GMT
From: thomas@mail.nhn.ou.edu (Rollin Thomas)
Subject: IPC::Open2 is being nonbidirectional.
Message-Id: <thomas.927176459@bubba>

I'm sorry, but I'm having this trouble with open2.  On accepting a 
client, this server is supposed to fork into a reading process and
a writing process, talking to something specified in $program.  The
relevant part is this:

 open2(*WRITEME,*README,"$program");
 WRITEME->autoflush(1);
 while($client=$server->accept())
 {
  $client->autoflush(1);
  print "[Connect.]\n";
  next if $pid=fork;
  while($input=<$client>)
  {
   print "I:$input";
   print WRITEME "$input";
  }
 } continue {
  while($output=<README>)
  {
   print "O:$output";                    # This part does not
   print $client "$output";              # work.
  }
 }

But even when I don't make it fork, I get not a peep on README.  It's 
utterly silent.  If it's important, for now $program is something
that just returns whatever input you give it.  If you give it 1, it
puts "1" on STDOUT.  But nothing makes it back to my client.  The
server doesn't indicate "O:" like it's supposed to even.  It gets
the input from the client okay, though.

Thanks.

Rollin
--
 Rollin C. Thomas - thomas@mail.nhn.ou.edu - www.nhn.ou.edu/~thomas          
  "I am an indecent driver and sportsman." - Andrea Previtera (Guy)


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

Date: 19 May 1999 10:55:37 GMT
From: john@jhorne.csd.plym.ac.uk (John Horne)
Subject: Is it a file or a link?
Message-Id: <37428a99@palantir.pbs.plym.ac.uk>

Hello,

I am trying to write a section of perl which will be looking
in a directory containing a lot of 'files'. However, I need to be
able to discern between a real (?) file and a symbolic (soft) link.

The test 'if ( -f $filename)' will be positive if the file is real
or a link. The test 'if (-l $filename)' will tell me if it is a link,
and I know I could combined them into
  'if (-f $filename && ! -l $filename)'
to let me know if it is a real file (i.e. not a link). But is there
an easier way? I have a lot of tests to do and the use of this combined
form seems a bit clumsy. I thought perhaps a '-F' test to say it's a
real file and '-f' remains as a file or link.

I have looked at '-T' but that gives the same as '-f' in this
case. I could use stat/lstat but again it seems a bit 'clumsy' for a
testing if a file is a file.

Thanks,

John.
-----------------------------------------------------------------------------
John Horne, University of Plymouth, UK                Tel: +44 (0)1752 233914
E-mail: jhorne@plymouth.ac.uk                         ICQ: 36532881
Home page: http://jhorne.csd.plymouth.ac.uk
Finger for PGP key: john@jhorne.csd.plymouth.ac.uk


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

Date: Thu, 20 May 1999 04:51:47 GMT
From: smnayeem@my-dejanews.com
Subject: Re: Making executables from .pl files?
Message-Id: <7i04d3$7vd$1@nnrp1.deja.com>

In article <t5Es$Lxm#GA.202@rejz.ij.net>,
  ehpoole@ingress.com (Ethan H. Poole) wrote:
> [Posted and Emailed]  In article <7h638m$l66$1@nnrp1.deja.com>,
> smnayeem@my-dejanews.com says...
> >hmm where can i find this perlcc? i checked the activeperl
> >documentation, all it has is perl2exe but that never gave me the
right
> >exes, well it gives me an exe but i cant ever run it if i use any
> >modules, it just says cant locate such and such modules and aborts.
>
> You have to tell Perl2Exe which modules to include when you create the
exe,
> otherwise the executable will attempt to load the modules (externally)
at run
> time.
>
> --
> Ethan H. Poole              | Website Design and Hosting,
>                             | CGI Programming (Perl & C)..
> ========Personal=========== | ============================
> * ehpoole @ ingress . com * | --Interact2Day, Inc.--
>                             | http://www.interact2day.com/
> =======FREE WEBSITE DESIGN PROMOTION UNTIL 5/31/99!=======
>
>
How do i tell the perl2exe which modules to include?
oh and i have tried including the modules with my exe but that isnt
working either.
say for example if i want to make the exe of this simple program :

use Net::SMTP;
$smtp = Net::SMTP->new('mail.agni.com',
                       etrn => 'junk.agni.com',
                       timeout => 30,
                       debug => 3)
                       or die "cant connect";
                           # connect to an SMTP server
$smtp->mail('smnayeem@agni.com');     # use the sender's address here
$smtp->to('smnayeem@agni.com');        # recipient's address
$smtp->data();                      # Start the mail
$smtp->datasend("This is a testmail from the not-so-state-of-the-art
mail program of smnayeem\n");
$smtp->dataend();                   # Finish sending the mail
$smtp->quit;                        # Close the SMTP connection

say i name it mail.pl and the exe i make with perl2exe is mail.exe
what happens is at one stage the following error comes up :

Global symbol "%NetConfig" requires explicit package name at Net/SMTP.pm
line 29.

and then i am stuck. and this much trouble i had to go through just for
a simple program, what will happen when my program uses more modules.

smnayeem


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


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

Date: Thu, 20 May 1999 05:43:03 GMT
From: David Raufeisen <raufeisen@home.com>
Subject: Parsing email headers..
Message-Id: <37444989.89AB4C2@home.com>

I have "John Doe <jdoe@somewhere.com>" in variable $HEADER{'from'}

how would i do the following

put

John into $fname
Doe into $lname
jdoe@somewhere.com into $email
jdoe into $user

thanks =}


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

Date: Thu, 20 May 1999 05:23:27 GMT
From: David Raufeisen <raufeisen@home.com>
Subject: Parsing email headers
Message-Id: <374444F1.49BC03C5@home.com>

I have "John Doe <jdoe@somewhere.com>" in variable $HEADER{'from'}

how would i do the following

put

John into $fname
Doe into $lname
jdoe@somewhere.com into $email
jdoe into $user

thanks =}


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

Date: Thu, 20 May 1999 06:43:54 GMT
From: fortyoz@my-dejanews.com
Subject: Parsing email headers
Message-Id: <7i0ava$ccc$1@nnrp1.deja.com>

I have "John Doe <jdoe@somewhere.com>" in variable
$HEADER{'from'}

how would i do the following

put

John into $fname
Doe into $lname
jdoe@somewhere.com into $email
jdoe into $user

thanks =}


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


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

Date: 19 May 1999 22:07:30 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl "constructors"
Message-Id: <yl90aktjl9.fsf@windlord.stanford.edu>

armchair <armchair@my-dejanews.com> writes:
> Russ Allbery <rra@stanford.edu> wrote:
>> armchair <armchair@my-dejanews.com> writes:

>>> I think there is some benefit to be looking at code and instantly see
>>> that a method is a constructor, or not.

>> Why?  Seriously.

> The quicker you can see what someone's code is doing, the quicker you
> can get on to making your changes.

Sure.  You want to be able to quickly grasp their algorithm.  I'd argue
that whether a given method is a constructor is irrelevant to that.  The
important part is the algorithm expressed by the code, not the language
semantics used to write it.  You normally just won't care whether
something constructs an object or just returns an object from somewhere
else, or something else entirely; you care what to do with the result and
how to use it.  I don't think knowing what's a constructor and what isn't
helps with that at all.

> Regardless of if there are some cases where the above is true, if you
> had to look over a large amount of Perl programs that I had written, you
> would be muttering over and over again - "this is C code, this guy
> doesn't know how to code in Perl. What's he doing now....".

I mutter over other people's code always.  I've yet to read the code of
any other package and not want to rewrite something or other to make it
look cleaner.  :)  I deal.  Particularly with Perl, which I find just
generally easier to read almost regardless of the style in which it's
written provided that there's some modicum of comments and consistent
formatting and the regexes aren't too hairy.

-- 
#!/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: Thu, 20 May 1999 04:44:45 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: perltootc - OO Tutorial for Class Data in Perl
Message-Id: <ebohlmanFC0L6L.35F@netcom.com>

Andrew Allen <ada@fc.hp.com> wrote:
: phat-ic: (n) : of, relating to, or being speech used for social
: or emotive purposes rather than for communicating information. 

I've always thought of it in terms of speech whose primary purpose is to 
"keep the channel open" or to acknowledge the receipt of information.

: Why would perl docs have "social or emotive purposes"? Perhaps
: parenthetical? Also autovivification is (again) the wrong term.

I should certainly think that Perl docs have social purposes; the whole
*point* of them is to create a community of people with a shared frame of
reference (how many serious Perl programmers would disagree with "you have
to read the docs to consider yourself part of the Perl community"?), which
is a social purpose in my book.  As for emotive purposes, in a TMTOWTDI
environment people's choices of WWTDI are in some cases essentially 
emotive and docs can convey the diversity of such choices.
 



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

Date: Thu, 20 May 1999 07:10:12 +0000
From: Nick Moraitakis <nick@perlfect.com>
Subject: Re: search msoffice documents
Message-Id: <3743B554.E4DF0794@perlfect.com>

Alastair wrote:
> Well, I'm not speaking from experience. I'd just treat the 'msoffice' files as
> normal and read them as binary (see 'binmode'). Maybe as fixed blocks ('read'
> perhaps). Look to match your 'string' using a regular expression ('perldoc
> perlre').

You can even go a step further and use the 'strings' to
isolate the strings from the binary file... then do the
search.

-- 
Nick Moraitakis


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

Date: Wed, 19 May 1999 23:28:01 -0700
From: "kal@valistech.com" <kal@valistech.com>
Subject: setting file/dir attrribs correctly when using Net::FTP
Message-Id: <3743AB71.D6A2DC22@valistech.com>


--------------20DB2AD484DAC2E64D2A2877
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Greetings,
I run a perl script after I login to a linux box. The script
connects to an ftp site, then downloads files to my local account.
The problem I'm having is: the script creates a local dir reflecting the
remote one.
Then copies all files on the remote dir to the local, newly created dir.
The copy (or get)
is unsucessful, telling me 'permission denied', despite the process
running under my uid.
Also, the new dir created by the script has the wrong attribs. even
though it's told to create it
as 755, it creates the dir as dr----x--t

Any help greatly appreciate it.
Regards

Kal

PS. please copy me when responding.

--------------20DB2AD484DAC2E64D2A2877
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Greetings,
<br>I run a perl script after I login to a linux box. The script
<br>connects to an ftp site, then downloads files to my local account.
<br>The problem I'm having is: the script creates a local dir reflecting
the remote one.
<br>Then copies all files on the remote dir to the local, newly created
dir. The copy (or get)
<br>is unsucessful, telling me 'permission denied', despite the process
running under my uid.
<br>Also, the new dir created by the script has the wrong attribs. even
though it's told to create it
<br>as 755, it creates the dir as <tt>dr----x--t</tt><tt></tt>
<p><tt>Any help greatly appreciate it.</tt>
<br><tt>Regards</tt><tt></tt>
<p><tt>Kal</tt><tt></tt>
<p><tt>PS. please copy me when responding.</tt></html>

--------------20DB2AD484DAC2E64D2A2877--



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

Date: Thu, 20 May 1999 05:33:53 GMT
From: tgy@chocobo.org (Fuzzy Warm Moogles)
Subject: Re: Tie Fighter
Message-Id: <37438267.185122451@news.oz.net>

On Wed, 19 May 1999 12:02:15 GMT, pudge@pobox.com (Chris Nandor) wrote:

>In article <37435353.107522791@news.oz.net>, tgy@chocobo.org wrote:
>
># On Wed, 19 May 1999 02:45:33 GMT, pudge@pobox.com (Chris Nandor) wrote:
># 
># >In article <3744083a.88294931@news.oz.net>, tgy@chocobo.org wrote:
># >
># ># Instead of returning the tied scalar, return a reference to it.  Then
>assign
># ># the reference to a typeglob.
># >
># >A solution requiring the use of global variables is no solution at all.
># 
># I disagree.  And I didn't use any. :)
>
>Well, it is no use for a general-purpose solution, certainly, because many
>of us want to use globals only when globals are specifically called for,

And when are the use of globals (actually package variables) called for?
Perhaps when they are the only solution.  No other solution has been given,
general-purpose or otherwise.

>not as hacks to get around the fact that you can't pass a tied scalar
>around.
       ^
       directly

>And yes, you did use a global variable.  All package variables are global
>variables.  Any time you manipulate the symbol table, you are using a
>global / package variable.

I used a package variable.  I used a localized variable.  I did not use a
global variable.

># for (qw/chocobo moogle/) {

See?  $_ has been implicitly localized.  But you knew that...

>#     *_ = new Shout "I want a $_ stuffy\n";
>#     s/$/!!!!/;
>#     print;
># }
>
>*_ is a typeglob representing, in this case, the global variable $_.  You
>could local()ize it, diminishing the negative impact:
>
>  $_ = 2;

This is a package variable.  It is also a global variable.

>  {
>      local $_;

This is a package variable.  It is also a local variable.  It is not a global
variable.

>      my $x = 1;
>      *_ = \$x;
>      print;  # 1
>  }
>  print;      # 2

Back to the global variable.

>But it is still a global variable.  And using any other symbol in that
>case would also be a global, by virtue of the fact that you are using
>typeglobs.

We seem to be using different terminologies.  What I call a package variable,
you call a global variable.  I localize it to a block, you still call it a
global.  Care to explain why?

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


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

Date: Thu, 20 May 1999 04:52:19 GMT
From: "Hawkwynd" <hawkwynd@adelphia.net>
Subject: Using perl to port a telnet session to HTML
Message-Id: <7yM03.342$zB1.3988@server1.news.adelphia.net>

I'm working on a script that (so far) can telnet to a SMAUG mud server, and
perform commands on the server as if it were a human working on the server.

Using the following commands, I can get the script to write commands, and do
waitfor's but I need to be able to access the outout and retreive the
information from the server when it is displayed to the script.

Here's a snippet:


$t=new Net::Telnet (Host =>"$site", Timeout =>90, Prompt =>'/new:/');

#Wait for login prompt :

$t->waitfor('/new:/');
$t->print("username\n");

#Wait for password
$t->waitfor('/Password:/');
$t->print("pasword\n");

# wait for and repsond to announcement pages and press enter to continue...

$t->waitfor('/=---/');
$t->print("\n");
$t->waitfor('/ENTER]/');
$t->print("\n");

# wait for ready prompt, and perform USERS to list users currently online
$t->waitfor('/]/');
$t->print("users\n");


# Do same, except perform WHO
$t->waitfor('/]/');
$t->print("who\n");


    It is here that I need to capture the output of the server's response
and save it to file, or update the HTML page to reflect the users online.

Any help with this is GREATLY APPRECIATED!

Scott





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

Date: Thu, 20 May 1999 05:58:59 GMT
From: Mitch <portboy@home.com>
Subject: Validating a subnet mask...
Message-Id: <3743A51D.A67E1758@home.com>

I need to validate the subnet mask inputed by the user based on some ip
address.  So if you user typed in IP 205.217.218.67, and then typed in
255.55.255.0, the ip address should obviously be wrong, and the error
returned to the user.

Solutions I've tried.  I started out with making sure everything was a
digit.  Then obviously that failed cuz 255.55.255.0 will work.

Seeing that I'm bad with regular expressions and matching, could someone
help me with figuring this one out?

Thanks, Mitch



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

Date: Thu, 20 May 1999 05:01:28 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: XML::XQL
Message-Id: <ebohlmanFC0LyG.436@netcom.com>

Steve Farris <nlymbo@mindspring.com> wrote:
: I looked at it, and got it to work up to a point, but the real problem
: is that I don't know which method allows access to the *data* inside
: the tags returned by the query. For instance,

[snip]

: OK, at this point, @result will contain hash references, one for each
: author tag found. the problem i am having is getting at the actual
: data contained in the author tag. It's a serious OO deficiency on my
: part, but one i am trying to overcome. Gracias para todo ayuda!

Those hash references are references to DOM nodes, so you use the DOM 
methods to get at the data.  Therefore, you need to read the docs for 
XML::DOM.



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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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