[9397] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2992 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 26 10:27:19 1998

Date: Fri, 26 Jun 98 07:01:26 -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           Fri, 26 Jun 1998     Volume: 8 Number: 2992

Today's topics:
    Re: ?$basurl $basedirectory ?? (Gary M. Greenberg)
    Re: About usage of recursive algoritm in Perl. <quednauf@nortel.co.uk>
    Re: Calling perl from NT magweb@my-dejanews.com
    Re: Checking if a file does NOT exist chrishabs@my-dejanews.com
    Re: Checking if a file does NOT exist <sloh@palisade.com>
    Re: Date calculation formula needed <sb@sdm.de>
    Re: Executing Perl Script From Command Line <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: first language - last language <jdporter@min.net>
    Re: Flames.... (I R A Aggie)
        Forum Scripts Anyone? johnny99@sydney.dialix.oz.au
    Re: Forum Scripts Anyone? <quednauf@nortel.co.uk>
        giving a 45-minute talk on perl... pointers? (John Klassa)
        Global variables? <Robert.Rehammar@emw.ericsson.se>
    Re: Global variables? <quednauf@nortel.co.uk>
    Re: Hiding the Perl Souce (Re:Visited) <matt@pcr7.pcr.com>
    Re: Hiding the Perl Souce (Re:Visited) <matt@pcr7.pcr.com>
    Re: Hiding the Perl Souce (Re:Visited) <ebohlman@netcom.com>
    Re: Hiding the Perl Souce (Re:Visited) <matt@pcr7.pcr.com>
    Re: how do I parse a certain structured text? <jdf@pobox.com>
        How to check variables exists in a string <edwarton@ml.com>
    Re: How to check variables exists in a string <aidan@crux.blackstar.co.uk>
        Is anyone working on a VxWorks port of Perl? (Brand and Karina Hilton)
    Re: iterating through files and subdirectories (Garp)
    Re: Perl and Delphi ("Mark Morgan Lloyd ")
    Re: Perl and Delphi <todd@aristesoftware.com>
    Re: PerlIS and IIS.40 Setup.. Please help! (Joost Kraaijeveld)
        QUE: Oraperl and &ora_open <mike@tech.eurodyn.com.gr>
    Re: reading post data <Tony.Curtis+usenet@vcpc.univie.ac.at>
        SOCKS and LIBWWW <robertcr@us.ibm.com>
        Wait Command in Perl <hostmaster@hosttech.com>
    Re: Wait Command in Perl <quentin@shaddam.amd.com>
    Re: What a Crappy World (oh, yes!) (Clinton Pierce)
    Re: What a Crappy World <ngouah@erols.com>
    Re: Which is the best Perl book for beginners? (Mike Stok)
    Re: Which is the best Perl book for beginners? birgitt@my-dejanews.com
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 26 Jun 1998 09:42:17 GMT
From: garyg@gator.net (Gary M. Greenberg)
Subject: Re: ?$basurl $basedirectory ??
Message-Id: <MPG.ffd361cda6b3348989685@news.gator.net>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <6mfd5q$pgi$2@f02s02.tac.net>, maclell@col.ca says...
> I had this same script set-up on a very similar host, but it wasn't with a
> domain name, so perhaps this is confusing me some.
> 
 ...
> I am uploading the script in ascii mode and right now I have been chmoding
> it to 777 until I can get it working.
worldwide read/write/execute!!! tre cool ;p
> Any help would be appreciated.
chmod 755 at most.

gary         -=-  The C Programmers' Reference  -=-
              http://www.gator.net/~garyg/C/c.html
        -=-  Avenue Programmers' Classes' Requests  -=-
             http://www.gator.net/~garyg/class.htm


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

Date: Fri, 26 Jun 1998 10:21:13 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: About usage of recursive algoritm in Perl.
Message-Id: <35936809.4EA43B31@nortel.co.uk>

Administrator wrote:
> 
> Hi!
> How can I create a perl-program with recursive function in RedHut Linux
                                                             ^^^^^^
                                                            EXCELLENT!

-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Fri, 26 Jun 1998 09:28:15 GMT
From: magweb@my-dejanews.com
Subject: Re: Calling perl from NT
Message-Id: <6mvpje$8vt$1@nnrp1.dejanews.com>

In article <6m8clp$34p$5@mainsrv.main.nc.us>,
  scott@softbase.com wrote:
>
> > Does anyone know how to call a perl or CGI from a HTML file on an NT
> > server. The following command works on Unix, but not on NT. Have a
> > solution?
> > <#!-- exec cgi="/cgi-bin/perl_script.pl">

Exactly my question (c:

> If you mean when you say "NT server" that you're running Internet
> Information Server, it does not support server-side includes (SSI).
> To use them, you'll have to find another web server like Apache
> that does.
>
> Scott

So, is there no way of executing a Perl script form inside a static HTML page
(without the users help, ie forms) from an Windows NT server with IIS running
on it?

/Magnus
---------------------------
e-mail: nr42@hotmail.com
home:   http://i.am/on-line
---------------------------

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Fri, 26 Jun 1998 11:44:14 GMT
From: chrishabs@my-dejanews.com
Subject: Re: Checking if a file does NOT exist
Message-Id: <6n01ie$ilm$1@nnrp1.dejanews.com>

In article <359316C4.1912397F@steelplan.com.au>,
  ryan@steelplan.com.au wrote:
>
>

>
> I want the following to happen:
>
> if ($file exits || has a 0 byte size) {
>     print <<HTML;
>  # insert JavaScript alert("$file doesnt exist or has 0 byte size!
> doh!");
> HTML
> }
> if ... # continue on with program
>
> Perl allows you to check if a file DOES exist & has a 0 byte size like:
>
> if (-e $file || -z $file) {
>     # stuff
> }
>

if (!-e $file or -z $file) {
   ^
You have some man page reading to do.

Chris H.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Fri, 26 Jun 1998 09:57:29 -0500
From: Stanton Loh <sloh@palisade.com>
Subject: Re: Checking if a file does NOT exist
Message-Id: <3593B6D9.B8611142@palisade.com>

Ryan Snowden wrote:
> 
> 
> This isn't what I'm after though.  I want to check if the file DOESN'T
> exist.

unless (-s $filename) {
   #blah
}

-stanton


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

Date: 26 Jun 1998 10:14:52 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: Re: Date calculation formula needed
Message-Id: <6mvsas$glr$1@bsdti6.sdm.de>

In article <6muen0$hfn$5@info.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:

> In article <3592822A.B806DC0D@mc0115.mcclellan.af.mil>,
> 	Derek Romeyn <romeyde@mc0115.mcclellan.af.mil> writes:
> : I have this set of data which I am extracting dates from.  The dates are
> : in a annoying format like so:	8013
> : 
> : That stands for the 13th day of 1998.  So the largest number would be
> : 8365 and then it would roll to 9001.

> I'd use something like this:

>     use Date::Calc 'Add_Delta_Days';

>     my $annoying = 8013;

>     ## I'm assuming the last three numbers are the day of the year and
>     ## everything else is to be added to 1990, so Jan 1, 2000 would be
>     ## 10001
>     my($year,$day) = $annoying =~ /^(\d+)(\d\d\d)$/;
>     $year += 1990;

>     my $nice = sprintf "%04d-%02d-%02d",
>                        Add_Delta_Days($year, 1, 1, $day - 1);

The initial poster wanted to do some comparisons based on ranges of dates,
not necessarily involving the "nice" date format.

You could go about this as follows:

use Date::Calc qw(:all);

my $annoying = 8013;

my ($year,$day) = $annoying =~ /^(\d+)(\d{3})$/;

$year += 1990;

$min = Date_to_Days(1998,6,20);
$max = Date_to_Days(1999,1,1);   #  or whatever you need...

$test = Date_to_Days($year,1,1) + $day - 1;

if (($test >= $min) && ($test <= $max))
{
    #  date is within range
}

Since this module is internally written in C, this should be fast enough
for the initial poster's application.

The function "Date_to_Days()" also uses only a few multiplications and
divisions internally and should therefore be quite fast.

> This is with version 4.2 of Date::Calc from CPAN--the interface changed

The latest version is actually 4.1.

> dramatically since the last time I used this module, and the old code is
> no longer on CPAN. :-(

It is still available from my web site as

http://www.engelschall.com/u/sb/download/pkg/DateCalc-3.2.tar.gz

Moreover, the new distribution contains a utility which allows you to
automatically upgrade any existing, older applications.

> : What I need to be able to do is calculate if the extracted date is
> : within a certain range.  IE: 30,90,180 days of the current date.

> The Date::Calc manpage gives an example of this:

>     2)  How do I check wether a given date lies within a
>         certain range of dates?

>           use Date::Calc qw( Date_to_Days );

>           $lower = Date_to_Days($year1,$month1,$day1);
>           $upper = Date_to_Days($year2,$month2,$day2);

>           $date = Date_to_Days($year,$month,$day);

>           if (($date >= $lower) && ($date <= $upper))
>           {
>               # ok
>           }
>           else
>           {
>               # not ok
>           }

> Of course, you'd have to get year, month, and day as above.

No, you don't - see above! :-)

> : The only methods I can think of involve some pretty simple but time
> : consuming processes.  IE: convert every date back to readable format
> : (1998, 01, 13) then use date_difference (part of Date::Datecalc) to get
> : the result.  But seems pretty durn inefficient and I will be dealing
> : with a 500k+ file.

> Hmm.. the problem would come on year boundaries.  You could use the
> Days_in_Year sub to calculate how far into the next year you can go.

That'd be a detour. For a more straightforward solution, see above!

Yours,
-- 
    Steffen Beyer <sb@engelschall.com>
    Free Perl and C Software for Download: www.engelschall.com/u/sb/download/


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

Date: 26 Jun 1998 11:22:30 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Executing Perl Script From Command Line
Message-Id: <7x3ecs7c15.fsf@beavis.vcpc.univie.ac.at>

Re: Executing Perl Script From Command Line, Elliott
<mcgucken@caligula.physics.unc.edu> said:

Elliott> Hello there.  I'm using a bash shell, and when I
Elliott> try to execute a perl script from the command line,
Elliott> I get "file not found".

checklist:

1. is the file containing the script executable?
2. is the directory containing the file on your PATH?
3. is `.' on the end of your PATH?

Elliott> The path to perl is correct in all the programs.

I'd put my money(1) on #3 :-)

tony

(1) but only 10 groschen

-- 
Tony Curtis, Systems Manager, VCPC,      | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/

"You see? You see? Your stupid minds! Stupid! Stupid!" ~ Eros, Plan9 fOS.


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

Date: Fri, 26 Jun 1998 13:41:57 GMT
From: John Porter <jdporter@min.net>
Subject: Re: first language - last language
Message-Id: <3593A6B6.6D9@min.net>

Daniel Grisinger wrote:
> 
> I had never heard of Intercal but found an implementation.  I've been
> playing with it for a couple of hours and all I can say is, `Wow, and
> people think perl looks line noise' :-).  Not to mention the amusing,
> but somewhat obscure error messages.

That reminds me of another language which is probably worse...
no, I take that back.  But pretty bad, and more resembling
line noise: Teco.

-- 
John Porter


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

Date: Fri, 26 Jun 1998 09:29:00 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Flames....
Message-Id: <fl_aggie-2606980929000001@aggie.coaps.fsu.edu>

In article <6mv4td$opn$1@Venus.mcs.net>, les@MCS.COM (Leslie Mikesell) wrote:

+ In article <6muett$evq$1@cyprus.atlantic.net>,
+ Chip Salzenberg <chip@mail.atlantic.net> wrote:
+ 
+ >>>O'Reilly isn't a bunch of volunteers discussing their work/play amongst
+ >>>themselves.  They're a profit-making entity, albeit one with a slightly
+ >>>broader mind and longer view than most.  So there is no real comparison.
+ >>
+ >>It's odd that there is such a remarkable similarity in the names
+ >>of these O'Reilly shills and the regular people on c.l.p.m. then.
+ >
+ >Leaving aside the term "shill", which is pejorative and false:
+ >
+ >Why do you think it odd?  Tim O. recruits the real experts.
+ 
+ In my earlier post I questioned why CGI related topics were often
+ roasted as inappropriate for c.l.p.m, yet they are clearly going
+ to be a large part of the perl conference.

Ummm...because the "perl conference" != "clpm"? because there is a
seperate newsgroup devoted to all things CGI, and that CGI questions
stand a much better chance of being answered there where there are
occasional CGI experts, than here where there are occasional perl
experts who may or may not understand CGI?

If you want to mix-n-match, why not just have _one_ newsgroup.

James - for all of UseNet, that is...


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

Date: Fri, 26 Jun 1998 09:44:38 GMT
From: johnny99@sydney.dialix.oz.au
Subject: Forum Scripts Anyone?
Message-Id: <6mvqi6$a80$1@nnrp1.dejanews.com>

Does anyone know where I can get a PERL/CGI script which lets you run a forum
-- that is, a localised HTML "newsgroup" where people can post, and reply to
each other's posts?

I'm thinking of something like the setup they have at Mister Cranky's movie
review forums:

     http://www.mrcranky.com

A fabulous site for anyone who likes the movies by the way.

When I say "where can I get it", that means I'm prepared to pay, by the way...

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Fri, 26 Jun 1998 11:12:29 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Forum Scripts Anyone?
Message-Id: <3593740D.8E9000D7@nortel.co.uk>

johnny99@sydney.dialix.oz.au wrote:
> 
> Does anyone know where I can get a PERL/CGI script which lets you run a forum
> -- that is, a localised HTML "newsgroup" where people can post, and reply to
> each other's posts?

This is not really the right place for program requests. You might want to try
www.cgiresources.com . Very straightforward title.

> When I say "where can I get it", that means I'm prepared to pay, by the way...

How much? I might make you one :) Seriously, there's enough stuff around so that
you don't have to pay...

-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: 26 Jun 1998 13:39:19 GMT
From: klassa@aursgh.aur.alcatel.com (John Klassa)
Subject: giving a 45-minute talk on perl... pointers?
Message-Id: <6n08a7$8sk$1@aurwww.aur.alcatel.com>

I'm considering giving a 45-minute talk on the basics of perl...  The talk
will be part of a program of lunchtime talks we have, wherein people get
up and talk for 45 minutes or so on a topic that interests them.  My goal
will be to present the basics -- to get across enough information to enable
the audience (who are all technical folks) to go off and pursue perl for
themselves should they have an interest.

I'm looking for tips/advice from those of you who've done something like
this in the past...  Ideas for an outline, topics to stress, topics to
avoid -- whatever might be helpful -- would be appreciated.

Thanks,
John

-- 
John Klassa / Alcatel Telecom / Raleigh, NC, USA <><


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

Date: Fri, 26 Jun 1998 13:37:54 +0100
From: Robert Rehammar <Robert.Rehammar@emw.ericsson.se>
Subject: Global variables?
Message-Id: <35939622.B5A7A04C@emw.ericsson.se>

Do the variable keep it's value if you exit the funktion in which you
gave the variable it's value?

\\Robert


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

Date: Fri, 26 Jun 1998 12:54:59 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Global variables?
Message-Id: <35938C12.8D0C9281@nortel.co.uk>

Robert Rehammar wrote:
> 
> Do the variable keep it's value if you exit the funktion in which you
> gave the variable it's value?
> 
> \\Robert

Variable definitions are generally global. Check 'my', and 'local' in the
perlfunc page for different variable scoping behaviour.


-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: 26 Jun 1998 11:35:50 GMT
From: "Matt Heusser" <matt@pcr7.pcr.com>
Subject: Re: Hiding the Perl Souce (Re:Visited)
Message-Id: <01bda0ee$553c07a0$47eb1bcc@XSTA71.pcr.com>

Regarding Hiding Perl Souce, Mdkersey@hal-pc.org asked:

> So what has your company chosen to do?

--- After a long series of conversations, we've slowed down
development in Perl for mission-critical apps, while 
continuing it's use for Extracting, Reporting, In-Line
Text editing, and regular expression stuff.

Each Perl script now looks like this:

#!/bin/env/perl
#Copyright 1998 PCR, Inc.
#sample.pl, 6/26/1998
#This program is intellectual property of PCR, Inc.
#Unauthorized modification of this code will violate
#contract agreements.

-The customer has one operations guy who has to 
change some of the shell arguments sometimes.  He 
gets really scared whenever he changes my scripts.  
It's pretty funny.   ;-)

Matt H.
PS - here's the leadup -
> Matt Heusser wrote:
> 
> > >I'm finding the way to hide the source code of my
> > >perl scripts. I have downloaded some software and
> > >tested them on my machine. Could anybody share with
> > >me your experience on this issue....
> >
> >   -- It sounds like you've done some research.  But, after
> > much fear the customers would run off with our source
> > and develop it themselves, and many conversations and
> > attempts to turn Perl into C and compile it, our conclusion
> > was the same as the FAQ:
> >
> > "If you're concerned about people profiting from your code, then
> > the bottom line is that nothing but a restrictive license will give
> > you legal security.  License your software and pepper it with
> > threatening statements like "This is unpublished proprietary
> > software of XYZ corp.  Your access to it does not give you
> > permission to use it blah blah blah."  We are not lawyers, of
> > course, so you should see a lawyer if you want to be sure your
> > license's wording will stand up in court."
> >         - "How can I hide the source for my Perl Program?"
> >         - From PerFAQ(3)
> >
> >  Now all you need to do is convince your manager, and you're
> > Golden  ...
> >
> > Matt H.
> 
> 



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

Date: 26 Jun 1998 11:47:01 GMT
From: "Matt Heusser" <matt@pcr7.pcr.com>
Subject: Re: Hiding the Perl Souce (Re:Visited)
Message-Id: <01bda0ef$e53ab620$47eb1bcc@XSTA71.pcr.com>

Regarding Hiding the Perl Source:
>Abigail
>The Internet Revolution was founded on open systems: an open system is one
>whose software you can look at, a box you can unwrap and play with.  It's
>not about secret binaries or crippleware or brother-can-you-spare-a-dime
>shareware.  If everyone always had hidden software, you wouldn't have
>1/100th the useful software you have right now.


  -- About the internet, I have to 100% agree with you.  However, problems
do arise:  
  My sample:
  You are working as a consultant, using PERL for development of, say, and
EDI solution.  The customer is paying a rather large hourly sum for your 
services.  What's to stop them from, say, hiring a guy to do it in-house
for
considerably less money, firing you, and doing development themselves?

   OR Same customer, only they keep their word ("We promise to let you 
see the project to completion.")  When they are done, they take _your_
source code, change the comments, burn it onto a CD, and call it 
"A complete EDI solution by XYZ co." and start selling it.
  
    In those situation, IMHO, "open source" quickly becomes "intellectual
theft."

    But, then again, that's "Just my worldview." ;-)

regards,

Matt H.



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

Date: Fri, 26 Jun 1998 12:30:55 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Hiding the Perl Souce (Re:Visited)
Message-Id: <ebohlmanEv5s3J.2DJ@netcom.com>

Matt Heusser <matt@pcr7.pcr.com> wrote:
:   You are working as a consultant, using PERL for development of, say, and
: EDI solution.  The customer is paying a rather large hourly sum for your 
: services.  What's to stop them from, say, hiring a guy to do it in-house
: for
: considerably less money, firing you, and doing development themselves?

A contract between the two of you, assuming your client will agree to 
it.  But stop and think: if you were doing this in a compiled language, 
wouldn't the client insist on a contract that allows them access to your 
source?

:    OR Same customer, only they keep their word ("We promise to let you 
: see the project to completion.")  When they are done, they take _your_
: source code, change the comments, burn it onto a CD, and call it 
: "A complete EDI solution by XYZ co." and start selling it.

A license agreement.


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

Date: 26 Jun 1998 13:16:04 GMT
From: "Matt Heusser" <matt@pcr7.pcr.com>
Subject: Re: Hiding the Perl Souce (Re:Visited)
Message-Id: <01bda0fc$56c81d80$47eb1bcc@XSTA71.pcr.com>

>But stop and think: if you were doing this in a compiled language, 
>wouldn't the client insist on a contract that allows them access to your 
>source?

  -- Not if it's part of a product -you- own and license to the customer,
then modify at the customer's request.   The model I set up above
works -great- for C/C++, but Perl throws some things into the mix.
   
  Again, the moral:    A strick enough license and strong wording in
the source and you're Golden ...

Matt H.


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

Date: 26 Jun 1998 08:31:28 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Warwick Foster <warwickf@geocities.com>
Subject: Re: how do I parse a certain structured text?
Message-Id: <3ecsuw5r.fsf@mailhost.panix.com>

Warwick Foster <warwickf@geocities.com> writes:

> How would you the say:
>     Find SID_NAME when inside SID_DESC if this is not always the case.
> 
> I have this need what I want to ask is
>     Find this token and tell me what tokens are already open.
>     from a structureal point of view.

You really need to write a parser.  Mark-Jason Dominus and others have
posted some very lucid code along those lines in this newsgroup.  You
might get good results from a DejaNews search.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf/


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

Date: Fri, 26 Jun 1998 11:56:13 +0100
From: Tony Edwardson <edwarton@ml.com>
Subject: How to check variables exists in a string
Message-Id: <35937E4D.C90FB15B@ml.com>

Anyone got any ideas how to check that perl variables embeded in a
string are defined?

e.g.

A scalar contains

$scalar="/home/user/$group/$book/$yy$mmm$yy";

I want to expand the embeded perl veriables with their values in some
way such that I
can check that each variable is defined

using eval
i.e.
eval "$result = \"$scalar\"";

it expands everthing it can but provides no way of checking that all
variables are defined.
Currently I am checking the result for adjoining slashes indicating that
one of the variables
isn't defined or contains an empty string, but I don't know which one.

I am planing to write a module to perform the expansion with error
checking.

Tony Edwardson
Merrill Lynch Europe PLC
0171-906 7587
edwarton@ml.com




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

Date: Fri, 26 Jun 1998 12:21:02 GMT
From: Aidan Rogers <aidan@crux.blackstar.co.uk>
Subject: Re: How to check variables exists in a string
Message-Id: <898867256.803038@sparc.tibus.net>

Tony Edwardson <edwarton@ml.com> wrote:
: Anyone got any ideas how to check that perl variables embeded in a
: string are defined?

: e.g.

: A scalar contains

: $scalar="/home/user/$group/$book/$yy$mmm$yy";

: I want to expand the embeded perl veriables with their values in some
: way such that I
: can check that each variable is defined

I'm not sure if I have the exact gist of what you are saying. What do you want
to happen if the variable is not defined?

I do something similar when constructing sql queries, but it basically boils 
down to this.


my $scalar = "the root of the statement";
$scalar .= "$the_next_bit" if defined($the_next_bit);

and so on. I don't know if that will be useful to you, unless you set a 
default for $group and $book etc in case they aren't defined.

Try doing something like

$book ||= $default_for_book;
$group ||= $default_for_group;

that way if $book is defined it will keep its value, else it will take a 
default value.

Hope this helps.

Aidan


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

Date: Fri, 26 Jun 1998 13:25:39 GMT
From: bkhilton@netcom.com (Brand and Karina Hilton)
Subject: Is anyone working on a VxWorks port of Perl?
Message-Id: <bkhiltonEv5uMr.2Fo@netcom.com>

It has occurred to me that, if 5.005 is thread-safe, porting to
VxWorks would be much simpler than previously.  Is anyone working
on such a thing?


	Brand


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

Date: Fri, 26 Jun 1998 13:23:48 GMT
From: garp@callscan.com.nospam (Garp)
Subject: Re: iterating through files and subdirectories
Message-Id: <35939fba.9921836@news.demon.co.uk>

On 26 Jun 1998 00:22:22 GMT, mikep@rt66.com (mikep) wrote:

>In article <6mudm5$9nm@cocoa.brown.edu>
>aks@cs.brown.edu (Amanda Silver) writes:
>
>> there has got to be a command that iterates through all the files in a
>> directory and then all the files in all subdirectories...what would this
>> command be though?

I use the following script for this sort of thing (this is a primitive
C++ source auditor, but the iteration is the bit you want). Apologies
for word-wrapping, but that's Usenet, folks. Fun-poking prohibited.


# Garp's wonderful C/C++ file auditor
# Goes through a directory tree, finds all the *.c, *.cpp and *.h
files,
# and examines each one in turn counting lines, characters etc

@valid_files=(".c",".cpp",".h");

%storage=(	"files" => 0,
		"lines" => 0,
		"chars" => 0,
		"classes" => 0 );

#------------------------------------------------------------
# parameter 1 is a valid sourcefile name
sub process_sourcefile
{
	++$storage{"files"};

	my $sfile=shift;
	my $cfg="";
	my $found_bad=FALSE;

	open(F,$sfile) or return (print "Failed to open sourcefile
$sfile\n");

	while(<F>)
	{
		my $line=$_;
		++$storage{"lines"};
		$storage{"chars"}+=length($line);
# dodgy rules for class declaration checking, but we only want a rough
count
		if ($sfile =~ /.h$/ && $line =~ /^class / && !($line
=~ /;$/)) { ++$storage{"classes"}; }
	}

	close(F);
}

#------------------------------------------------------------
# parameter 1 is a filename from process_dir (according to
@valid_files)
sub check_filename
{
	my $filename=shift;

# don't accept '.' or '..'
	return if ($filename =~ /\\(\.|\.\.)$/);
# directories get their own (indirect) recursion
	return (print "Failed to stat($filename)\n")
if(stat($filename) == {});
	process_dir($filename), return if(-d $filename);

	DONEVF: foreach $vf (@valid_files)
	{
		process_sourcefile($filename),last DONEVF if($filename
=~ /$vf$/);
	}
}

#------------------------------------------------------------
# parameter 1 is a directory that needs opening and checking
sub process_dir
{
	my $direntry=shift;

	print "Processing $direntry\n";

# get all the filenames in this directory
	opendir(H,$direntry) or return (print "Failed to opendir on
\"$direntry\"\n");
	my @filelist = readdir(H);
	closedir(H);

# send each filename to check_filename() for testing
	foreach (@filelist) { check_filename($direntry . "\\" . $_); }
}

#------------------------------------------------------------
# "main" bit

if(scalar(@ARGV) == 0) { process_dir("."); }
else { foreach (@ARGV) { process_dir($_); } }

print "\nResult of search for all ";
for(@valid_files) { print $_ . ", "; } print "\b\b files\n";
printf("%d files checked, %u lines, %u characters, %u C++ classes.\n",

		$storage{"files"}, 
		$storage{"lines"}, 
		$storage{"chars"}, 
		$storage{"classes"});


HTH,
Garp



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

Date: 26 Jun 1998 11:32:29 +0100
From: mark_tbu@cix.co.uk ("Mark Morgan Lloyd ")
Subject: Re: Perl and Delphi
Message-Id: <6mvtbt$4f3$1@plutonium.compulink.co.uk>

In article <m367hphuy8.fsf@windlord.Stanford.EDU>, rra@stanford.edu (Russ 
Allbery) wrote:

> Todd Cary <todd@aristesoftware.com> writes:
> 
> > Is the a library for Perl that can be run under Delphi?
> 
> Not that I'm aware of, and I believe I looked into this a while back 
> for a
> friend.  Delphi is, as I recall, a Pascal varient, and most of the Perl
> embedding work has been done in C.

I continued lurking to see the answer to this query, despite the best 
efforts of Olga et al :-)

Would the answer be the same if the question was "has anybody compiled 
Perl under Windows NT or Windows '95 so that it is encapsulated inside a 
DLL or an (ActiveX) control?

Failing that, what's wrong with running Perl from inside a Delphi program 
to process a dynamically-built script?

Mark Morgan Lloyd
mark_tbu@cix.co.uk

[Opinions above are the author's, not those of his employers or 
colleagues]

** Internet feed may be unreliable- please cc anything important by email 
**


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

Date: Fri, 26 Jun 1998 06:27:30 -0700
From: Todd Cary <todd@aristesoftware.com>
To: Mark Morgan Lloyd <mark_tbu@cix.co.uk>
Subject: Re: Perl and Delphi
Message-Id: <3593A1C2.3AF3594A@aristesoftware.com>

Why didn't I think of that<g>!  When I was working for a client who used
the Unix platform, I got spoiled with the ease of using Perl and text
files to process data.  I'll shake the dust off of the WIN95 Perl.

Thanks......

Todd


--
Todd Cary
Ariste Software
todd@aristesoftware.com




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

Date: Fri, 26 Jun 1998 10:23:03 GMT
From: JKraaijeveld@askesis.nl (Joost Kraaijeveld)
Subject: Re: PerlIS and IIS.40 Setup.. Please help!
Message-Id: <35937284.49496781@news.telebyte.nl>

Hi Brian,

My script worked on Windows NT but failed on UNIX servers, your
problem in reverse.... It had to do with the cr/lf problem conversion
between UNIX and Windows NT. Maybe this is the answer for your
problem.

Joost


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

Date: Fri, 26 Jun 1998 14:00:35 +0300
From: Tsoukalos Mihalis <mike@tech.eurodyn.com.gr>
Subject: QUE: Oraperl and &ora_open
Message-Id: <35937F52.6BFE91A4@tech.eurodyn.com.gr>

Hello to everyone.
I read the man pages of oraperl and I wrote a small perl program.
The problem is that it gives me errors. :-)

Here is the program:
--------------------------------

$table = "mikex";

eval 'use Oraperl; 1' || die $@ if $] >= 5;

$lda = &ora_login('dev1','login','password') || die $ora_errstr;
print $lda."\n";

$SELECT = "select * from :1";
print $SELECT."\n";

$csr=&ora_open($lda, $SELECT) || die $ora_errstr." **ora_open** ";   #
here is the error.
&ora_bind($csr, $table) || die $ora_errstr." **ora_bind** ";
print $csr."\n";

$nfields = &ora_fetch($csr) || die $ora_errstr." **ora_fetch** ";
print $nfields." "."\n";

while ( ($var1,$var2) = &ora_fetch($csr) )
{
        print $var1." ".$var2." \n";
}

&ora_close($csr) || die $ora_errstr." **ora_close** ";
&ora_logoff($lda)|| die $ora_errstr." **ora_logoff** ";

exit 1;
----------------------------
When I try to run it, it gives me the following error message:

@mafalda ~/oracle ex2.pl
Changing ORACLE_HOME for dev1 to /opt/oracle/app/oracle/product/7.3.2 at
/home/s
alusa/mike/lib/perl5/DBD/Oracle.pm line 163.
DBI::db=HASH(0x1c8db8)
select * from :1
ORA-00903: invalid table name (DBD: error possibly near <*> indicator at
char 16
 in 'select * from :<*>p1') **ora_open**  at ex2.pl line 19.
@mafalda ~/oracle

If I change the program a little in order not to use the :1 substitution
method it works fine.

If any one can help me please do so.
thanks in advance,
mihalis.

PS. Please if you can email the answer as well as sending it to the
newsgroup.

--
--------------------------------------
Name: Mihalis Tsoukalos
Software Engineer
mailto:mike@tech.eurodyn.com.gr
Home Email: mailto:diogenes@hol.gr




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

Date: 26 Jun 1998 12:46:10 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: reading post data
Message-Id: <7xd8bwbfv1.fsf@beavis.vcpc.univie.ac.at>

Re: reading post data, special <presence@outlook.net> said:

special> what is another way to read the value of a variable
special> from a post in perl other than $in{variable}

eeeyew!

    use CGI;

    my $value = param('the_field_in_the_form');


You know it makes sense :-)

tony
-- 
Tony Curtis, Systems Manager, VCPC,      | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/

"You see? You see? Your stupid minds! Stupid! Stupid!" ~ Eros, Plan9 fOS.


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

Date: Fri, 26 Jun 1998 11:50:47 +0100
From: "Robert C. Rekas" <robertcr@us.ibm.com>
Subject: SOCKS and LIBWWW
Message-Id: <35937D07.89997277@us.ibm.com>

I'm trying to pool html pages over proxy, noproxy and socks.
Proxy/noproxy scenarios are working but I do not know how to do socks.
Any comments/help?
I'm using following code:

$ua=new LWP::UserAgent;
$ua->agent("www_mon");
if($proxies eq "none"){#NOPROXY
 #simply do nothing here
}elsif($proxies eq "socks"){#SOCKS

 ################implement socks here#####################

}else{#PROXY
 $ua->proxy([http],"http://$hostname:$port/");
}
$timeout?$ua->timeout($timeout):$ua->timeout(15);
$req = new HTTP::Request 'GET' => "$url";
$req->header('Accept' => 'text/html');
$res = $ua->request($req);

--
robertcr@us.ibm.com
rekasr@uk.ibm.com





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

Date: Fri, 26 Jun 1998 09:14:33 -0400
From: "Michael Harrison" <hostmaster@hosttech.com>
Subject: Wait Command in Perl
Message-Id: <6n06pt$7vn$1@decius.ultra.net>

I need to get a script to wait about 10-12 seconds while a file is produced.
The script writes a request file for ICVerify and the needs to stall for
10-12 secs while the answer file is produced. My questions is, is there any
easy way to do this.

Second after I read in the .answer file I need to read only the first char
of the file to see if it is an "A" or "N" and the give the result back to
the client. What is and easy way to strip all char from a Filehandler but
the first. chop() gets the last char, is there away to reverse that.

Thanks.

send answers to admin@hosttech.com





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

Date: 26 Jun 1998 08:35:24 -0500
From: Quentin  Fennessy <quentin@shaddam.amd.com>
Subject: Re: Wait Command in Perl
Message-Id: <ximwwa4476r.fsf@shaddam.amd.com>

>>>>> "MH" == Michael Harrison <hostmaster@hosttech.com> writes:

    MH> I need to get a script to wait about 10-12 seconds while a
    MH> file is produced.  The script writes a request file for
    MH> ICVerify and the needs to stall for 10-12 secs while the
    MH> answer file is produced. My questions is, is there any easy
    MH> way to do this.

Try 

	perldoc -f sleep

    MH> Second after I read in the .answer file I need to read only
    MH> the first char of the file to see if it is an "A" or "N" and
    MH> the give the result back to the client. What is and easy way
    MH> to strip all char from a Filehandler but the first. chop()
    MH> gets the last char, is there away to reverse that.

Open the file (perldoc -f open), read the first line ($l = <FH>),
and use substr (perldoc -f substr).

-- 
Quentin Fennessy			AMD, Austin Texas
Secret hacker rule #11 - hackers read manuals


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

Date: 26 Jun 1998 13:09:26 GMT
From: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
Subject: Re: What a Crappy World (oh, yes!)
Message-Id: <6n06i6$kjl2@eccws1.dearborn.ford.com>

In article <6msvsu$ja$4@client3.news.psi.net>,
	abigail@fnx.com (Abigail) writes:
>Tom Christiansen (tchrist@mox.perl.com) wrote on MDCCLVIII September
>MCMXCIII in <URL: news:6mrc82$li4$1@csnews.cs.colorado.edu>:
>++  [courtesy cc of this posting sent to cited author via email]
>++ 
>++ In comp.lang.perl.misc, 
>++     Olga <katzman@students.uiuc.edu> writes:
>++ :And more then half of Mr. Christiansen's posts
>++ :were offensive
>++ 
>++ I call.  Go to Deja News.  Ask for my user profile.
>++ 
>
>
>Isn't it time for a RFD about comp.lang.perl.tom.christiansen?
>
>
>People, if you can't deal with Tom's postings, get the manual
>of your newsreader, and find out how to killfile him.

Nah, people flaming about Tom need to be in alt.*.

alt.fan.tom.christiansen?

Or we could RFD for comp.lang.perl.tom.christiansen.moderated, go into
useless flamewars in news.newgroups for half a year...
-- 
+------------------------------------------------------------------------+
|  Clinton A. Pierce    |   "If you rush a Miracle Man,   | http://www.  |
|  cpierce1@ford.com    |     you get rotten miracles"    | dcicorp.com/ |
| fubar@ameritech.net   |--Miracle Max, The Princess Bride| ~clintp      |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*



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

Date: Fri, 26 Jun 1998 10:06:39 -0400
From: Ngouah A Nguiamba <ngouah@erols.com>
Subject: Re: What a Crappy World
Message-Id: <3593AAEF.7851@erols.com>

Bart Lateur wrote:
> 
> I R A Aggie wrote:
> 
> >Olga comes flying out of the blue -- I'd never seen
> >her about here before
> 
> I think it's typical that only newbies on this group really feel this
> attitude on clpm ought to change. People that have hung around longer
> have simply given up. I have.
> 

I don't, I read an and changed my mind. :-)

Ngouah Nguiamba


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

Date: 26 Jun 1998 12:26:44 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Which is the best Perl book for beginners?
Message-Id: <6n0424$29p@news-central.tiac.net>

In article <TBOXrFAUthk1Ew+x@bradleycvs.demon.co.uk>,
Paul Bradley  <paul@bradleycvs.demon.co.uk> wrote:
>I am new to Perl and would welcome suggestions on an appropriate
>beginners book (preferably one that is available in the UK).

You might consider Learning Perl published by O'Reilly (check out
http://perl.oreilly.com for details on the books they publish)

Tom Christiansen's site has a good selection of books & reviews under
http://reference.perl.com/query.cgi?books

Hope this helps,

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: Fri, 26 Jun 1998 13:36:42 GMT
From: birgitt@my-dejanews.com
Subject: Re: Which is the best Perl book for beginners?
Message-Id: <6n085a$r4o$1@nnrp1.dejanews.com>

In article <Pine.GSO.3.96.980626002811.5566i-100000@user2.teleport.com>,
  Tom Phoenix <rootbeer@teleport.com> wrote:
>
> On Thu, 25 Jun 1998, Paul Bradley wrote:
>
> > I am new to Perl and would welcome suggestions on an appropriate
> > beginners book (preferably one that is available in the UK).
>
> This is covered in section two of the FAQ. Hope this helps!
>

I was waiting when someone would finally answer this questions
in this manner. :-)

Not to say that noone who posts this question (even when answered
already twice to other posters the same day) has gotten ever the
other style of answer, you know what I mean ? :-)

No complaints whatsoever !!  It's just cute to see that even the tough
guys have a human side. :-)

Birgitt Funk

P.S. I realize that the poster asks specifically for one which
is available in the U.K. But I think the ones which are mentioned
in the FAQs are available there.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

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

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