[16069] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3481 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 26 11:10:40 2000

Date: Mon, 26 Jun 2000 08:10:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <962032218-v9-i3481@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 26 Jun 2000     Volume: 9 Number: 3481

Today's topics:
    Re: More error checking with Getopt undergronk@my-deja.com
    Re: Newbie qn: scope of Dir (file?) handles. <gellyfish@gellyfish.com>
    Re: Newsgroup question (Jon Bell)
    Re: Online En-/Decryption Module <rootbeer@redcat.com>
    Re: Online En-/Decryption Module nobull@mail.com
    Re: perl + dll <gellyfish@gellyfish.com>
    Re: Sendmail alternative for win32 <hal9000@zonnet.nl>
        Server push problem <sami.maki@nokia.com>
        She's a rambler (Was: matching question (http related)) (Michael Budash)
        Teen Volenteers WANTED <danjones@crosswinds.net>
    Re: Testing exit status <gellyfish@gellyfish.com>
    Re: Unable to access an array from within a class <abe@ztreet.demon.nl>
        Uninterpolated quoting and \ <phrxy@csv.warwick.ac.uk>
    Re: Uninterpolated quoting and \ (Andrew Johnson)
    Re: Uninterpolated quoting and \ (Colin Watson)
    Re: Uninterpolated quoting and \ (Tad McClellan)
    Re: visit new FORUM all u queastion will be answered (a <gellyfish@gellyfish.com>
        Win32 and Printer eyalb@aks.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 26 Jun 2000 10:42:36 GMT
From: undergronk@my-deja.com
Subject: Re: More error checking with Getopt
Message-Id: <8j7c2q$2q0$1@nnrp1.deja.com>


>> In article <8ivcc9$mn3$1@nnrp1.deja.com>,  <undergronk@yahoo.com>
asked:
>>Is there was an easier way to provide a default for $opt_f.

In article <8j05ri$mdc$1@pegasus.csx.cam.ac.uk>,
  mjtg@cus.cam.ac.uk (M.J.T. Guy) wrote:
> Does this do what you want?
>
>   our $opt_f = './hosts.out';
>   getopt('f:');

Yes, it does.  Thank You.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 25 Jun 2000 14:58:40 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Newbie qn: scope of Dir (file?) handles.
Message-Id: <8j536g$n6t$1@orpheus.gellyfish.com>

On Sat, 24 Jun 2000 20:55:08 -0600 Sriram Karra wrote:
> hi,
> 
> if I cant my() or local() them, how can I get teh following code to
> work: (apart from explicitly maintaining a "stack" of dirhandles
> (dirnames)).
> 
> sub recurse  # lists all files in the dir recursively.
> {
>     my($ar) = $_[0];
>     my($a);
> 
>     print $ar, "\n";
>     
>     if (-d $ar) {
> 	opendir(THISDIR, $ar);
> 	chdir $ar;
> 	while  (defined ($a = readdir(THISDIR))) {
> 	    if ($a ne "." && $a ne "..") {
> 		recurse($a);
> 	    }
> 	}
> 	chdir "../";
>     }
> }
> 
> and, why dont we want to allow my() of such?

Its nothing to do with 'my' it is to do with the global nature of the
dirhandle.  As suggested you *should* use File::Find - if you insist
on doing this the hard (and possibly error-prone) way then you will
either need to read the whole directory into a lexical ('my') array
and close the dirhandle before you recurse or read about localizing
filehandles (same goes for dirhandles) in the FAQ.  You could look
at the IO::Dir module which might help.  Working code that exemplifies
what you are trying to do has been posted here before (by myself and
others) you can find it via Deja News (http://www.deja.com/home_ps.shtml).
However I really would exhort you to use File::Find unless you have
an extremely compelling reason not to do so.

/J\
-- 
** This space reserved for venue sponsor for yapc::Europe **
              <http://www.yapc.org/Europe/> 


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

Date: Mon, 26 Jun 2000 13:07:45 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: Newsgroup question
Message-Id: <FwrJ4x.Gu8@presby.edu>

[posted and e-mailed, as per request of questioner]

In article <20000625123151.10222.00000371@ng-ct1.aol.com>,
Ghengis 76 <ghengis76@aol.com> wrote:
>I'm interested in finding out which newsgroups people use and are the most
>helpful in the following area's:

[snip list of topics]

Try the search engines referenced on the news.newusers.questions Web site:

   http://www.geocities.com/nnqweb/ngroups.html

-- 
Jon Bell <jtbell@presby.edu>                        Presbyterian College
Dept. of Physics and Computer Science        Clinton, South Carolina USA
[ Questions about newsgroups?  Visit http://www.geocities.com/nnqweb/  ]
[                or ask in news:news.newusers.questions                ]


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

Date: Mon, 26 Jun 2000 07:12:41 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Online En-/Decryption Module
Message-Id: <Pine.GSO.4.10.10006260709350.23149-100000@user2.teleport.com>

On Mon, 26 Jun 2000, Wolfgang Engels wrote:

> I'm looking for a way encrypt my perlsource and decrypt it on runtime.

    http://search.cpan.org/search?dist=Filter

> or is there any other suggestion how to secure a perlscript on the web

If your system, webserver and program are properly set up, encrypting the
Perl source won't make it any more secure. If they aren't, encrypting will
merely make it harder to fix the problems. 

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 26 Jun 2000 15:42:33 +0100
From: nobull@mail.com
Subject: Re: Online En-/Decryption Module
Message-Id: <u9wvjcy04m.fsf@wcl-l.bham.ac.uk>

wolfgang.engels@arxes.de (Wolfgang Engels) writes:

> I'm looking for a way encrypt my perlsource and decrypt it on runtime.

I do not think that I believe you.  If you'd looked in the FAQ I
expect you'd tell us why the answer in the FAQ doesn't help you.  If
you haven't even looked in the FAQ then you are not "looking for" -
you are "asking for".
 
> Intershop 4 uses such an encryption which is called NetCrypt.
> Is there anything out there which can do it. or is there any other
> suggestion how to secure a perlscript on the web that contains
> information about accessing databases?

You should never rely on hiding the source of your programs
("security through obscurity") to protect your data.

Any such mechanism is dependant on somehow storing the decryption key
for the scripts.  It is probably simpler to use whatever method you
use to secure this decryption key to secure the database connection.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 25 Jun 2000 14:59:28 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: perl + dll
Message-Id: <8j5380$n70$1@orpheus.gellyfish.com>

On Sun, 25 Jun 2000 11:04:11 +0200 elixir wrote:
> Hi !
> 
> Is there anyone enable to tell me if it's possible to run a dll (visual C)
> from a perl script  with an exchange of parameters ?
> 

Possibly - look at the documentation for the Win32::API module.

/J\
-- 
** This space reserved for venue sponsor for yapc::Europe **
              <http://www.yapc.org/Europe/> 


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

Date: Mon, 26 Jun 2000 16:22:14 +0100
From: "hal9000" <hal9000@zonnet.nl>
Subject: Re: Sendmail alternative for win32
Message-Id: <395767a0_2@excalibur.gbmtech.net>

http://www.dynamicstate.com/ has some command line version you might be able
to use. You might also benefit from using SMTP servers (Net-SMTP), that's
what I use for sending mail

hal9000

localhost2000 wrote in message <3951b280@news.server.worldonline.co.uk>...
>Could someone please take some time to recomend an alternative mail
program.





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

Date: Mon, 26 Jun 2000 14:31:27 GMT
From: "Sami Maki" <sami.maki@nokia.com>
Subject: Server push problem
Message-Id: <3PJ55.5447$oL4.109990@news2.nokia.com>

Hi,

I have this "push" related problem that server will execute entire Perl
script before printing anything to web browser. Are there some
configurations what need to be set on server side before it works? Here is
the script what I'm using (it works on Apache at least but not on
iPlanet-WebServer-Enterprise/4.1). Thanks.

$| = 1;
print "$ENV{'SERVER_PROTOCOL'} 200 OK\n";
print "Server: $ENV{'SERVER_SOFTWARE'}\n";
print "Content-type: multipart/x-mixed-replace;boundary=ARandomString\n\n";

# Begin sending characters
print "--ARandomString\n";
for ($loop = 1; $loop <= 5; $loop++)
{
    print "Content-type: text/plain\n\n";
    print "$loop\n";
    sleep (1);
    print "\n--ARandomString\n";
}
exit (0);

BR, Sami





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

Date: Mon, 26 Jun 2000 07:17:59 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: She's a rambler (Was: matching question (http related))
Message-Id: <mbudash-2606000717590001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>

In article <3956EE27.20764800@stomp.stomp.tokyo>, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:

> Rob wrote:
>  
> > If you were able to write such a short and direct coding answer,
> > why had you not done this previously ... your ability to confuse,
> > cloud and otherwise misdirect is astounding ...
> 
> 
> I am not impressed by personal insults within rhetoric.
> This is an earmark of less intelligent people. I am even
> less impressed, actually annoyed, by those who elect to
> include lies within rhetoric. This is an earmark of
> people with diminished self-confidence and an earmark
> of people lacking in a sound code of ethics.
> 
> It's mule manure.
> 
> It appears you might be lacking in reading comprehension
> skills. This is evidenced by my frequent preample for my
> articles, in so many words,
> 
> "An alternative method than the usual."
> 
> Your response suggests to me you do not comprehend
> what an "alternative method" constitutes, thus, it
> is easy to surmise, you are facing, to a measured
> degree, challenges in reading comprehension.
> 
> As alternative methods, I offer different ways of
> accomplishing a task. This is done because I know
> a hundred and one spotted obsessive technogeeks will
> post an equal number of the usual copy and paste code,
> over and over and over, again and again.
> 
> My thinking is not like yours and others here. I think
> sidewards, in tangents, backwards and upside down. This
> is why my code is unique, different and affords many
> different exercises in learning. My type of thinking
> is quite challenging, quite imaginative.
> 
> You, others, are stuck with use strict thinking and
> strapped with warnings training wheels. You are clones
> of each other; Borgs. Disconnect yourself sometime and
> try a bit of imaginative thinking. You will find this
> type of thinking to be most challenging, a type of
> challenge of which I am obsessive. 
> 
> Imaginative and creative thinking is what sorts
> programmers from copy and paste technicians.
> 
> Godzilla!

there you go again, rambling on and on, complete with blanket
accusations... don't you have any idea how that makes you look? why not
just contribute to the group in brief terms, then get the hell out of the
way and let someone else contribute?

you're only a target because you paint a bright red bull's eye on yourself
with [nearly] each post...
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: Mon, 26 Jun 2000 20:59:33 +1000
From: Daniel Jones <danjones@crosswinds.net>
Subject: Teen Volenteers WANTED
Message-Id: <39573795.45CAA5A8@crosswinds.net>

Do you know c-c++, HTML, JAVA, JAVASCRIPT, xml or any other computer
languages?
Are you a teenager?
Are you a web guru?
Wanna get recognition?

I am looking for any teens who want to volenteer in a web project
completely run by teens for teens and a general audience. Even our CEO
is a teenager.
If you are interested, but dont think you have much time to volenteer,
no worries, email me.

Basicly the whole thing is a search engine/online empire for teenagers
where teenagers profit and teenagers benifit!

Any one interested email me.

Thanx
Dan Jones
danjones@crosswinds.net



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

Date: 25 Jun 2000 13:31:08 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Testing exit status
Message-Id: <8j4u2c$mmj$1@orpheus.gellyfish.com>

On Sun, 25 Jun 2000 00:14:03 GMT David McMullen wrote:
> I'm trying to test the exit status of a ping command.  what is the best
> way to do see if a host exists on the network through this method?
> 

You might be better off using Net::Ping as has been suggested.

If you must use '/bin/ping' to do this then you might want to do
something like :


#!/usr/bin/perl -w

use strict;


my $host = shift || die "$0: No host specified\n";

my $ping = '/bin/ping';
my $countflag = '-c'; # does every ping have this ?
my $count = 1;

open(OLDOUT,'>&STDOUT')   || die "$0: Ooer, cant dup STDOUT - $!\n";
open(STDOUT,'>/dev/null') || die "$0: Ooer, cant reopen STDOUT - $!\n";
open(OLDERR,'>&STDERR')   || die "$0: Ooer, cant dup STDERR - $!\n";
open(STDERR,'>/dev/null') || die "$0: Ooer, cant reopen STDERR - $!\n";

my $rc = system($ping,$countflag,$count,$host);

if ($rc == -1 )
{
  print OLDERR "$0: Could'nt run $ping - $!\n";
  exit 255;
}
else
{
  my $status = $rc ? 'Down' : 'Alive' ;
  print OLDOUT "$host is $status\n";
  exit $rc >> 8;
}


This makes no attempt to determine whether 'ping' cant reach the host
or the name is unresolvable as the exit value of 'ping' here doesnt -
I guess if you wanted to find that out you go reopen STDERR to STDOUT
and use the backticks and parse the output if $? was > 0 or you could
try and resolve the name first ....

You are probably better off using Net::Ping.

/J\
-- 
** This space reserved for venue sponsor for yapc::Europe **
              <http://www.yapc.org/Europe/> 


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

Date: Mon, 26 Jun 2000 13:20:38 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Unable to access an array from within a class
Message-Id: <gaeelsc6312ffgsp4jqe3jipehv9a5ubun@4ax.com>

On 23 Jun 2000 19:29:18 GMT, ebohlman@netcom.com (Eric Bohlman) wrote:

> Scott Christensen (scott.christensen@dot.state.wi.us) wrote:
 ...
> : sub new {
> :     ... some code ...
> : 
> :     bless {
> :         "arrayRef" => @array
> 
> You want a reference to the array there (or a reference to an anonymous
> copy of it).  Instead, you're flattening the array out into a list,
> effectively making your object a reference to a hash where the first key
> is "arrayRef" with a value of the first element of the array, the second
> key is the second element of the array with value the third element of 
> the array, etc.

Nope, an array in scalar context will return it's length. So
$obj->{arrayRef} will only hold the length of the array it was supposed
to be a reference to.

If you want a reference, use the \@array construct or create a ref to an
anonymous array: [ @array ]. The choice depends on the scope and use of
@array.
 
	return bless {
		arrayRef => \@array,
		# ...
		}, $class;



-- 
Good luck,
Abe


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

Date: Mon, 26 Jun 2000 13:46:24 +0100
From: "John J. Lee" <phrxy@csv.warwick.ac.uk>
Subject: Uninterpolated quoting and \
Message-Id: <Pine.SOL.4.21.0006261340310.9193-100000@mimosa.csv.warwick.ac.uk>


I don't understand why this doesn't work (note the single quotes):

#!/usr/bin/perl -w

use diagnostics

$blah = 'e:\directory\';
print $blah;



but this does:


#!/usr/bin/perl -w

use diagnostics

$blah = 'e:\directory\\';
print $blah;


I understand (after reading the FAQ) that you can use '/' instead of '\'
in DOS, but I don't see why the first script shouldn't work either.


John



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

Date: Mon, 26 Jun 2000 13:40:33 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Uninterpolated quoting and \
Message-Id: <l3J55.1732$k5.28350@news1.rdc1.mb.home.com>

In article <Pine.SOL.4.21.0006261340310.9193-100000@mimosa.csv.warwick.ac.uk>,
 John J. Lee <phrxy@csv.warwick.ac.uk> wrote:
> 
> I don't understand why this doesn't work (note the single quotes):
 
> $blah = 'e:\directory\';

> but this does:
 
> $blah = 'e:\directory\\';


The backslash still retains its escape meaning for two cases
in single quoted strings: the first case is to allow you to
embed a single quote within a single-quote delimited string:
    
    $blah = 'blah\'blah';
    print $blah;

But that means that if you put a backslash at the end of the 
string:

    $blah = 'blah\';

you've just escaped the final quote, so now you need to escape the
backslash to avoid this (as you noticed) -- this is the second case
and follows as a consequence of the first case.

Hope it helps.

andrew

-- 
Andrew L. Johnson   http://members.home.net/perl-epwp/
      Some people, when confronted with a problem, think 'I know,
      I'll use regular expressions.'  Now they have two problems.
          -- Jamie Zawinski, on comp.lang.emacs


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

Date: 26 Jun 2000 13:30:58 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: Uninterpolated quoting and \
Message-Id: <8j7lui$qpk$1@riva.ucam.org>

John J. Lee <phrxy@csv.warwick.ac.uk> wrote:
>I don't understand why this doesn't work (note the single quotes):
>
>#!/usr/bin/perl -w
>
>use diagnostics

I assume you mean 'use diagnostics;' here :)

>$blah = 'e:\directory\';

Have a look at the section entitled "Gory details of parsing quoted
constructs" in the perlop man page. In particular:

       Finding the end
[...]
            When searching for one-char non-matching delimiter,
            such as /, combinations \\ and \/ are skipped.
[...]
       Removal of backslashes before delimiters
            During the second pass the text between the starting
            delimiter and the ending delimiter is copied to a
            safe location, and the \ is removed from combinations
            consisting of \ and delimiter(s) (both starting and
            ending delimiter if they differ).

-- 
Colin Watson                                     [cjw44@flatline.org.uk]
"F(x) = d(y)/d(x)"  "This isn't the equation we're looking
 for.  Move along." - keithm@polarnet.ca, rec.arts.sf.written


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

Date: Mon, 26 Jun 2000 09:29:27 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Uninterpolated quoting and \
Message-Id: <slrn8lemln.7fu.tadmc@magna.metronet.com>

On Mon, 26 Jun 2000 13:46:24 +0100, John J. Lee <phrxy@csv.warwick.ac.uk> wrote:
>
>I don't understand why this doesn't work (note the single quotes):
>
>#!/usr/bin/perl -w
>
>use diagnostics
>
>$blah = 'e:\directory\';
>print $blah;

>I understand (after reading the FAQ)


Good job!

Thanks for checking before asking.

But don't forget the "other" files that came with your perl distribution
(i.e. the non-FAQ *.pod files).

Since      $blah = 'e:\directory\';
is constructing a scalar value, we should have a look at the
"Scalar value constructors" section in perldata.pod:

-----------------------------
String literals are usually delimited by either single or double
quotes.  They work much like quotes in the standard Unix shells:
double-quoted string literals are subject to backslash and variable
substitution; single-quoted strings are not (except for C<\'> and
C<\\>).
-----------------------------

Note that last bit. In single quoted strings, there are _still_
two meta-sequences (to allow you to include a single quote inside
of a single-quoted string). You have used one of them.

So you need to "escape the escape" as you did in your second
(snipped) example.


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


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

Date: Mon, 26 Jun 2000 10:06:07 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: visit new FORUM all u queastion will be answered (atleast we will do our best)
Message-Id: <jWF55.227$iP2.30374@news.dircon.co.uk>

On Sat, 24 Jun 2000 16:30:07 GMT, http404040404@my-deja.com Wrote:
> visit new FORUM all u queastion will be answered (atleast we will do
> our best)
> 
> 
> i've just finished working at setting it up, and now ppl come and
> see/ask/find
> 
> ok it's here:
> 

Apparently it isnt anymore - shame that ....


/J\


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

Date: 26 Jun 2000 15:26:42 +0200
From: eyalb@aks.com
Subject: Win32 and Printer
Message-Id: <usnu0zi7h.fsf@mailhost.aladdin.co.il>


Hello,

How can I set the default Windows printer from a program?
Is there a module that supports this?

Thanks.
Eyal.


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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


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


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