[8526] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2143 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 20 10:07:39 1998

Date: Fri, 20 Mar 98 07:00:42 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 20 Mar 1998     Volume: 8 Number: 2143

Today's topics:
    Re: arp (M.J.T. Guy)
    Re: Arrays & hashes <ckc@dmi.dk>
    Re: Authorization of porxy <chasecreek.systemhouse@usa.net>
        Compiling perl5.004_04 for SunOS ()
    Re: dis gotta be a easy one?!?!?! <chasecreek.systemhouse@usa.net>
    Re: dis gotta be a easy one?!?!?! <tony@cyberscape.net>
    Re: Dynamically checking for existing functions <tchrist@mox.perl.com>
        HELP ! Customized advertising in web pages <omr@club-internet.fr>
    Re: How do you capture command line arguments? <qdtcall@esb.ericsson.se>
    Re: How to create an environmental variable <jdf@pobox.com>
    Re: I'm new and need help <tony@cyberscape.net>
    Re: Insensetive EQ (brian d foy)
    Re: Installing on Solaris <qdtcall@esb.ericsson.se>
        Need Webmaster's input <persoft@concentric.net>
        Newbie - parsing text files <sfinnie@sqf.hp.com>
    Re: Opening dirs in Win32 <chasecreek.systemhouse@usa.net>
    Re: Perl Daemons <tchrist@mox.perl.com>
    Re: Perl5 equivalent to freopen (Jason Gloudon)
        please explain (perl code and debugger output included) <woodard@kodak.com>
    Re: redirect stderr and stdout to same file (M.J.T. Guy)
    Re: Sorting data by a numberical key (Mike Stok)
    Re: Sorting data by a numberical key (Andrew M. Langmead)
        Strange: die $object un-blesses the object?? <jll@skynet.be>
    Re: Tied and blessed? (M.J.T. Guy)
    Re: Troubles "perl"ifying a shellscript that uses pipes (Sitaram Chamarty)
    Re: Uploading files gt 16mb bombs... (R.P. Wambach)
    Re: Using perl code as a config file syntax? (Or, can r (Mike Stok)
    Re: Wanted: Perl for Windows 3.x <chasecreek.systemhouse@usa.net>
    Re: Wanted: Perl for Windows 3.x <sbekman@iil.intel.com>
    Re: Wanted: Perl for Windows 3.x <sbekman@iil.intel.com>
    Re: Wanted: Perl for Windows 3.x <chasecreek.systemhouse@usa.net>
    Re: what is wrong with being a novice ?? <tony@cyberscape.net>
    Re: what is wrong with being a novice ?? <chasecreek.systemhouse@usa.net>
        where is PerlCOM and PerlCtrl? (John Nielsen)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 20 Mar 1998 12:51:39 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: arp
Message-Id: <6etoor$139$1@lyra.csx.cam.ac.uk>

I R A Aggie <fl_aggie@thepentagon.com> wrote:
>In article <350AE568.72E62484@nih.gov>, rifkinj@pop.nci.nih.gov wrote:
>
>+ Anybody have any examples of how to do an arp in perl?
>
>@results=`arp -a`; # :)
>
>+ Pointers to ICMP ping would also be a help.
>
>Get the netlib modules from CPAN:
>
>use Net::Ping;

Actually, Net::Ping is included in the standard distribution.
No need to go to CPAN.


Mike Guy


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

Date: 20 Mar 1998 15:39:26 +0100
From: Casper Kvan Clausen <ckc@dmi.dk>
Subject: Re: Arrays & hashes
Message-Id: <wvpg1kd1l5t.fsf@pratt.ejoper.dmi.min.dk>

Jonathan Feinberg <jdf@pobox.com> writes:

> Matt Burgoon <infinity@gamersinn.com> writes:
> 
> > *thishash=\%{ $accounts[$_] };
> 
> Close: 
>  
>    %current_account = %{ $accounts[$_] };
> 
> A thorough read of perldata and perlref will get you there.

While perldata and perlref are good, I found the equivalent parts of
the Panther book (Advanced Perl Programming, from O'Reilly) to be
better at explaining the concept. Since it's also a great book to have
about Perl anyway, I thought I'd recommend it.

Just my $.02

Kvan.
-- 
-------Casper Kvan Clausen------ | 'Ah, Warmark, everything that passes
----------<ckc@dmi.dk>---------- |  unattempted is impossible.'
           Lokal  544            |   
I do not speak for DMI, just me. |        - Lord Mhoram, Son of Variol.      


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

Date: Fri, 20 Mar 1998 12:20:22 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Re: Authorization of porxy
Message-Id: <35125DAA.A23C3C4A@usa.net>

If I understand your question - firewalls don't work like that, at least
mine don't :-)

Firewalls will not accept authentication from 'outside' - in my network I
control via ACL who gets to which server via what port (protocol, if you
will).

A Proxy simply caches information - WWW pages or not - and re-serves them to
a particular group.  For example, I have set up proxies where the internal
clients could only see the proxy and nothing else - that way management
could control which adult 'waste' sites their employees surfed to :-)

So, to answer your question - if you are the sysadmin, then lookup
authorization in the proxy manual which came with your system, if you are
'trapped' by a reversed firewall then you have to 'authorize' yourself, if
you are not the sysadmin you should really talk to your network sysadmin or
manager :-)


HTH,
Sneex :-)

Sleep wrote:

> Hello ,
> Can anyone tell me how to authorize a proxy server (etc give user name &
> password ) ?
> I am blocked by the firewall ...
>
> Thank you for your attention!
>
> regards,
> Chau





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

Date: 20 Mar 1998 14:25:46 GMT
From: LOGIN@teleda ()
Subject: Compiling perl5.004_04 for SunOS
Message-Id: <6etu9a$t6g@news01.aud.alcatel.com>
Keywords: compile SunOS

When I run the makefile for perl5.004_04 on a Sun 4.1.3 machine
using gcc 2.7.2 I get the following error message for hv.c:
hv.c: In function `Perl_hv_fetch_ent':
hv.c:179: parse error before `HEK'
hv.c:179: parse error before `)'
hv.c: In function `Perl_hv_iternext':
hv.c:919: parse error before `HEK'
hv.c:919: parse error before `)'
*** Error code 1

If anyone has had this same problem and has found a solution, I would appreciate
hearing from you.




-- 

  Al Alder
  Alcatel Telecom
  972/996-5519




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

Date: Fri, 20 Mar 1998 12:02:23 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Re: dis gotta be a easy one?!?!?!
Message-Id: <35125973.1CFCB09E@usa.net>

First you, need  to create better Subject Lines...
(I almost  passed this up...)

I am curious, you have access to the cgi-bin on a server via
FTP ONLY?   Is it in your personal directory?

Anyways, CGI can be tested successfully by using a web
browser to browse your CGI on the WWW server - IF you
take some precautions first.

They are 1)  use the -w switch,  2) use diagnostics (if on Unix), and
3) use the CGI.pm module and print out lots of 'status' info while
you are testing it...  I say the above steps because -
A) You may be a cracker and only have access to a broken server and
you should always test out your code thourougly to make sure
the code isn't buggy.  This will insure that the sysadmin there will
never detect you :-)  And B) You can't read the error logs...  (You
know,
because of A, above :-)

HTH,
Sneex :-)


hld wrote:

> hi,
> How do you excute a ./filename.cgi to test for syntax errors
>  if you don't have a shell account or telenet access.
>    Have cgi bin thru FTP only.
>    Got cute ftp pro
>    Got wsftp
>
> theres gotta be another way...is there?????
>
> thanks
> hector





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

Date: Fri, 20 Mar 1998 13:10:32 -0000
From: "Tony Kenny" <tony@cyberscape.net>
Subject: Re: dis gotta be a easy one?!?!?!
Message-Id: <6etqjl$1mg$1@svr-c-02.core.theplanet.net>

I suppose one way would be to install perl on your machine and run "perl -c
filename.cgi" from the command line.

Otherwise you could just read through it very carefully. :)

~TK



hld wrote in message <3511FD11.34B1@ix.netcom.com>...
>hi,
>How do you excute a ./filename.cgi to test for syntax errors
> if you don't have a shell account or telenet access.
>   Have cgi bin thru FTP only.
>   Got cute ftp pro
>   Got wsftp
>
>theres gotta be another way...is there?????
>
>thanks
>hector




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

Date: 20 Mar 1998 12:44:25 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Dynamically checking for existing functions
Message-Id: <6etob9$6jt$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, bart.mediamind@tornado.be (Bart Lateur) writes:
:I'll take a stab. One of the Perl porter guru's might comment about how
:good a stab it is. My guess is that whenever Perl thinks of something in
:code as a sub, it is initialized to default code that dies with a
:message like "Attempt to invoke sub %s without definition" (replacing %s
:with the sub's name). So, it's the location of this error trapping code
:you see here.

The symbol compiles into a particular place at compile time.  Perl
preallocates a place to fill in the function if and when it sees it.
Notice:

    BEGIN { $a = \&x }
    sub x { print "hi\n" } 
    print "a is $a\n";
    print "x is ", \&x, "\n";

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    X-Windows: The Cutting Edge of Obsolescence.
	--Jamie Zawinski


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

Date: Fri, 20 Mar 1998 12:18:59 +0100
From: "Olivier ROSENTHAL" <omr@club-internet.fr>
Subject: HELP ! Customized advertising in web pages
Message-Id: <6etivs$fq7$1@front2.grolier.fr>

I have a web site to build and I would need explanations on how to include a
customized advertising banner on the top of the page. I would like this
banner to depend on the client carateristics (computer, country, search in a
search engine, etc.).
Can you help ?

Olivier




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

Date: 20 Mar 1998 11:28:02 +0100
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: How do you capture command line arguments?
Message-Id: <isd8fhveq5.fsf@godzilla.kiere.ericsson.se>

"rickryan@ Mindspring" <rickryan@mindspring.com> writes:

> I'm trying to run a perl script directly from the browser's address line as
> follows:
> 
> anyscript.pl?arg1
> 
> I've tried reading stdin, getopt, and $_[0] with no success.....How do I
> capture the command line argument "arg1" into a program variable?

arg1 in your example is not a command line argument. Go read the
perlrun manpage, and have a look at a FAQ about CGI.
-- 
		    Calle Dybedahl, UNIX Sysadmin
       qdtcall@esavionics.se  http://www.lysator.liu.se/~calle/


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

Date: 20 Mar 1998 09:46:33 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: How to create an environmental variable
Message-Id: <vht9to6u.fsf@news.concentric.net>

Dennis Kowalski <dennis.kowalski@daytonoh.ncr.com> writes:

> I need to set up some environmental variables and I want to automate
> it with a script.

    #!/usr/bin/perl -w
    open(TREES, '/forest/trees') or die "Gasping for breath: $!";
    while (<TREES>) {
       chop;
       push @trees, mulch($_);
    }
    close TREES;
    fry('New Zealand') until diameter($ozone_hole) < $EUROPE;

Sorry.  Use the following at your own risk.  Also see this excellent
site:

	http://www.inforoute.cgs.fr/leberre1/main.htm

    #!/usr/bin/perl -w
    # create the environment variable "kramden" with value "ralph"
    use Win32::Registry;
    my $REG_SZ = 1;
    $HKEY_CURRENT_USER->Open("ENVIRONMENT", $env) or die "$!";
    $env->SetValueEx("kramden", undef, $REG_SZ, "ralph");
  
-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: Fri, 20 Mar 1998 13:13:45 -0000
From: "Tony Kenny" <tony@cyberscape.net>
Subject: Re: I'm new and need help
Message-Id: <6etqpq$1ue$1@svr-c-02.core.theplanet.net>

Go to http://www.perl.com and spend a little time reading.



Andrew wrote in message <01bd53ac$8280c780$11149a8e@psmith1.ican.net>...
>Dear everyone,
>
>   Hey I;m Andrew.  I'm new at PERL and I need help.  Ok, is there a PERL
>compiler for Windows 95 I can get that I don't have to run through dos?
>Could someone e-mail me a list of necessary programs to program PERL?
>
>Thanks a bunch,
>
>   Andrew




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

Date: Fri, 20 Mar 1998 08:15:00 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Insensetive EQ
Message-Id: <comdog-2003980815000001@news.panix.com>
Keywords: just another new york perl hacker

In article <6ergr2$kis$1@nnrp1.dejanews.com>, wsayegh@lynx.neu.edu posted:

> How could I come up with an insesetive EQ in perl. 

why does it have to be EQ?  i think most people's problem in here is
putting the solution before the problem.  define the problem that you
need to solve, then look for a solution.  don't try to force a solution
using the (apparently few) skills that you have.  be open to possible
new techniques and skills.

> What I am trying to accomplish is to have a function that will
> store the files wich have "_sim" in array1, and the files that don't have
> "_sim" in array2.

what about opendir, readdir, and grep?  there's even an example of such
a thing in the docs for these functions.

> Please note.. Don't give me the nonesense you give to everyone else, "Go read
> the perl manual", "did you check out perl.com before you asking this dumb
> question". Well I didn't.. 

that's why you have the question, but i have the answer.  

interesting side bar:  my boss and i were discussing why the Info 
Revolution isn't going to be like the Industrial Revolution.  the
major point was that the Info Rev. won't be able to turn everyone
into worker bees like the Industrial Rev.  there's always going to
be a large class of Have Nots, and they'll have to live off the change
we give them in the subway.  someday we'll see some homeless guy with
a sign that says "Homeless AIDS stricken Gulf Vet don't know where
the docs are", sorta like that New Yorker cover (Sept 25, 1995) that 
has the punk guy on the corner with the "Will Hack For Food" sign.

the more depressing thought though, is that the question came from a
person with a .edu email address.  i guess that's the last place
i should expect to find literate persons able to do research,
but then, i'm an optimist.

[flame on, lazy-boy.]

-- 
brian d foy                                 <http://computerdog.com>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: 20 Mar 1998 11:31:44 +0100
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: Installing on Solaris
Message-Id: <isbtv1vejz.fsf@godzilla.kiere.ericsson.se>

Damien Conroy <con2royd@pie2rcom.ie> writes:

> However, when I try to install on a solaris 2 machine the
> lib/perl5/sun4-solaris/5.00404 directory doesn't seem to be created,
> nor does the lib/perl5/site_perl/sun4-solaris directory.
[snip]
> Any comments appreciated.

I guess you did something wrong.

Unless you give more details about your problem (did you get any error 
messages while installing? are you low on disk space?), that's all the 
help you can expect.
-- 
		    Calle Dybedahl, UNIX Sysadmin
       qdtcall@esavionics.se  http://www.lysator.liu.se/~calle/


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

Date: Fri, 20 Mar 1998 07:37:35 -0600
From: "Sam Irion" <persoft@concentric.net>
Subject: Need Webmaster's input
Message-Id: <6ets4l$9qo@examiner.concentric.net>

I have been working with a company (Bricktown Banking Association) to set up
a service to accept credit cards for webmaster's customers.  After getting
into this, I find that I need a lot more advice and opinions.

BTW, this isn't a spam or any sort of sales message... I am a computer
programmer working here in Oklahoma City and have to explain the concept
since it is sort of unique.

To gather this information, I set up a webpage that I feel will give me
valuable feedback.  If you fill out my form, we will give you a $50.00
commission on the first approved customer you send us when we open.

The survey form is at: http://www.bricktown.net/accepts/

The idea behind this service is that you, the webmaster, can design a site
for your customers where they can sell products over the Internet without
being required to have a credit card merchant account or a secure server
site.  We take a percentage of each transaction and pay the rest to your
customer.

This idea focuses on the webmaster and not the customer. We provide software
that you download and create an "order page" for your customer's site.  The
software creates an HTML file that you can modify any way you like such as
graphics, background, etc.  If you don't like to fiddle on the HTML level,
information is provided to allow you to easily publish the page with your
current publishing software.

When the user clicks to order, they are taken to our secure site to enter
their credit card information.  Once done they are returned back to the page
you specify.  This method allows the webmaster to use his favorite server
and just needs to point the user over to our secure site.

I am having to answer some questions that I can only get from you guys.  My
customer wants to know more and more about the needs a webmaster has when it
comes to selling things over the Internet.  Specifically, is there a need
for this type of service?

We won't give your email address to anyone nor will we be spamming you with
a bunch of sales stuff.  We are just looking for information and advice on
the needs you have and what we can do to make a service that you will want
to use.

If you don't want to give your two cents by the form, please reply to my
email or post a message here.

Thanks for your time and ANY feedback will be much appreciated!

-Sam Irion- sam@psz.com
Performance Software Zone





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

Date: Fri, 20 Mar 1998 10:49:22 +0000
From: Scott Finnie <sfinnie@sqf.hp.com>
Subject: Newbie - parsing text files
Message-Id: <351249B1.A1728D22@sqf.hp.com>

This is a multi-part message in MIME format.
--------------0E3E296366FF45CC519F8269
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

First apologies if this is covered somewhere: however I haven't found it
on CPAN or by a quick search on dejanews...

I need to parse some related text files  to run syntax checks within the
file and referential checks between them.  The files formats are all
variations of the microsoft '.ini' flavour  (see end of msg).

I'd like to create a set of data structures (e.g. Abstract Syntax tree)
which will be easy to apply rules against; this will involve iterating
over tree nodes and the attributes stored at each node.

I have 3 basic problems:

1.    How to elegantly code the parsers;
2.    How to produce the resultant tree in a way that's easy to apply
the rules against;
3.    This is my first foray into perl.

My thoughts so far run along the lines of:

1.    Abstract out common parsing routines to a base module
('iniParser');
2.    Add file specific parsers which derive from this;
3.    Each parser builds a syntax tree.  Syntax tree provides methods
for iterating over it, etc.

Any help (suggestions, pointers to existing modules, etc.) much
appreciated.  Plese copy me by email on replies since our mail service
is a bit klunky.

Scoot.

---------------------
File formats are e.g.

[Header1]

name1 = param1
name2 = list 1, lst2, list3

[Header2]

name1 name2 name3
name4 name5 name6

{etc}.

The files differ in that some use an [end header] delimiter, some use
repeated instances ([File1]..[Filen])


--
Scott Finnie   Tel. (+44) 131 331 7756
Telecoms Systems Division
Hewlett Packard Ltd.  mailto:sfinnie@sqf.hp.com


--------------0E3E296366FF45CC519F8269
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Scott Finnie
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Scott Finnie
n:              ;Scott Finnie
email;internet: sfinnie@sqf.hp.com
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard


--------------0E3E296366FF45CC519F8269--



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

Date: Fri, 20 Mar 1998 12:13:00 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Re: Opening dirs in Win32
Message-Id: <35125BF0.C84EB147@usa.net>

Allow me to suggest you use the  /  instead of  \   ?

HTH,
Sneex :-)

Beau Giles wrote:

> I've massaged it with the following lines:
>
> $PWD =~ s/%3A/:/g;
> $PWD =~ s/%5C/\\/g;
>
> $foo = ($PWD eq "C:\\tmp") ? "yes" : "no";
>
> the answer will be no.  And if I try to
>
> opendir (DIR, $PWD) or die  "Can't open $PWD: $!";
>
> The script will always die here, whereas
>
> opendir (DIR, "C:\\temp") or die  "Can't open $PWD: $!";
>
> works. This method of passing directories worked on Unix (with different
> file separator substitution), does anyone know what I'm missing?





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

Date: 20 Mar 1998 12:46:26 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Daemons
Message-Id: <6etof2$6jt$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Benjamin Holzman <bholzman@mail.earthlink.net> writes:
:> #!/usr/local/bin/perl
:> if (fork()) { # Invoke a child
:This is unlikely be very helpful in win32, I believe...

Turnabout's fair play: win32 is unlikely to be very
helpful to a programmer, either.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    Because . doesn't match \n.  [\0-\377] is the most efficient way to match
    everything currently.  Maybe \e should match everything.  And \E would
    of course match nothing.   :-) --Larry Wall in <9847@jpl-devvax.JPL.NASA.GOV>


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

Date: Fri, 20 Mar 1998 14:46:05 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Perl5 equivalent to freopen
Message-Id: <slrn6h506s.qdv.jgloudon@manitoba.bbn.com>

In article <35120ECB.2B44@asptech.com>, Phil Hutchinson wrote:
>I'd like to redirect STDOUT and STDERR to a disk file and the following
>successfully doesn't work.
>
>Several books at Barnes and Nobles did not address this topic.

You might have avoided the (highly educational) field trip by reading the 
perlfunc manpage (available in searchable PDF).

					 buffers.)  Here is a script that saves, redirects,
               and restores STDOUT and STDERR:

                   #!/usr/bin/perl
                   open(SAVEOUT, ">&STDOUT");
                   open(SAVEERR, ">&STDERR");

                   open(STDOUT, ">foo.out") || die "Can't redirect stdout";
                   open(STDERR, ">&STDOUT") || die "Can't dup stdout";

                   select(STDERR); $| = 1;     # make unbuffered
                   select(STDOUT); $| = 1;     # make unbuffered

                   print STDOUT "stdout 1\n";  # this works for
                   print STDERR "stderr 1\n";  # subprocesses too


-- 
Jason Gloudon


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

Date: Fri, 20 Mar 1998 09:45:16 -0500
From: Steve Woodard <woodard@kodak.com>
Subject: please explain (perl code and debugger output included)
Message-Id: <351280FC.18B2@kodak.com>

I have included some debugger output and the associated sub-routine of a
perl script below.  Can someone explain to me why the debugger skips
from line 181 to line 187, and then comes back to line 184??

  DB<3> s
main::writeFile(ilFileCreate.pl:180):
180:            $file = "$baseDir/$diskId.$umx";
  DB<3> s
main::writeFile(ilFileCreate.pl:181):
181:            open(UMXFILE, "> $file") || die "can't open $file for
writing. Stopped";
  DB<3> p $file
/2100/drive/ades/test/media/XX00001234/XX00001234.UMA
  DB<4> s
main::writeFile(ilFileCreate.pl:187):
187:                    }
  DB<4> s
main::writeFile(ilFileCreate.pl:184):
184:            for( $i = 1; $i <= $desiredInterleaves; $i++)
185:                    {
  DB<4> 

########################################################################
sub writeFile
{
  my($database,$umx) = @_;
  my($baseDir);

  # only members of the adesdev group can cd into $ADES_HOME
  # adesdev group members can only write in the test directory and
below.
  # only the ades user can cd and write in the other directories

  if( !(-x $ADES_HOME) )  # can we cd into the directory
    {
    die "You can't change directory into $ADES_HOME\n";
    }

  # set up the path where the files will be created
  $baseDir = "$ADES_HOME/$database/media/$diskId";

  if( -e $baseDir ) # does directory exist?
    {
        # do we have write permission in it?
    if(!( -w $baseDir)) # can we write to it?
      {
          die "You don't have write permission in $baseDir.\n";
      }
    }
  else
    {
    #try and create it
    if(! mkdir($baseDir,00770))
      {
      die "Can't create $baseDir directory\n";
      }
    }
  $file = "$baseDir/$diskId.$umx";
  open(UMXFILE, "> $file") || die "can't open $file for writing.
Stopped";

  # write the file
  for( $i = 1; $i <= $desiredInterleaves; $i++)
    {
    print UMXFILE "$i\tN\tC\t$pattern\t000000\n";
    }
  close(UMXFILE);
} # end sub writeFile
#######################################################################

-- 

Steve Woodard  (716)-588-2069
      Pager    (716)-975-3984
Optical Storage Products 1/800/KP
Internet: woodard@kodak.com


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

Date: 20 Mar 1998 13:31:28 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: redirect stderr and stdout to same file
Message-Id: <6etr3g$2ht$1@lyra.csx.cam.ac.uk>

In article <6ej7a0$nug$1@news.utdallas.edu>,  <ruth@utdallas.edu> wrote:
>I want to redirect all STDOUT and STDERR to the same log file, to appear in the "right" 
>order.
>I've tried
>
>#! .../perl
>
>$| = 1 ; # for flushing the buffers
>open (STDOUT , ">> $filename");
>open (STDERR, ">> $filename");

a)  $| works on an open filehandle.   So you need to set it _after_
    the opens.

b)  You need to set it for each filehandle.

So put this after the opens:

   select STDERR; $| = 1; select STDOUT; $| = 1;

And _always_ check the return from open.


Mike Guy


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

Date: 20 Mar 1998 14:19:49 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Sorting data by a numberical key
Message-Id: <6ettu5$806@news-central.tiac.net>

In article <3511C257.558543B9@ozy.dec.com>,
David Reilly  <reilly@ozy.dec.com> wrote:
>I want to store information (a line of text), using as my key
>a numberical number (hh:mm:ss), and then sort them.
>I was going to use an associative array, but often the
>data will have the same key, so I'd be overwriting anything
>that has a duplicate.
>
>Sample data
>00:00:00 line of text
>00:05:01 another line
>00:00:00 second line of text

You could do something like

while (<LINES>) {
  next unless ($key, $rest) = /^(\d\d:\d\d:\d\d)(.*)/s;
  push @{$line{$key}}, $rest;
}

foreach $key (sort keys %line) {
  for (@{$line{$key}}) {
    print $key, $_;
  }
}

which maintains the order of lines for a given timestamp.  The timestamps
sort well as strings.

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, 20 Mar 1998 14:51:13 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Sorting data by a numberical key
Message-Id: <Eq4H9D.7z3@world.std.com>

David Reilly <reilly@ozy.dec.com> writes:

>I want to store information (a line of text), using as my key
>a numberical number (hh:mm:ss), and then sort them.

You mean like the FAQ shows in <URL:http://www.perl.com/CPAN/doc/
manual/html/pod/perlfaq4/How_do_I_sort_an_aray_by_anyth.html>

while(<FILE>) {
  ($hour, $min, $sec) = /^(\d+):(\d+):(\d+)/;
  $time = $sec + $min * 60 + $hour * 3600;
  push @data, $_;
  push @time, $time;
}

for $line( @data[ sort { $time[$a] <=> $time[$b] } 0 .. $#data ] ) {
  print $line;
}

Or with the Sort::Fields module <URL:http://www.perl.com/cgi-bin/
cpan_mod?module=Sort::Fields>

>I was going to use an associative array, but often the
>data will have the same key, so I'd be overwriting anything
>that has a duplicate.


You don't need a hash in this case. If you ever run into the situation
where you need a hash, but will have several items that will have the
same key, one possible solution is to make a hash of arrays, and push
each record onto the array.

($key) = /^(\d+:\d+:\d+)/;
push @{ $data{$key} }, $_;

See the perllol and peldsc man pages for details.
-- 
Andrew Langmead


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

Date: Fri, 20 Mar 1998 14:56:37 +0100
From: Jean-Louis Leroy <jll@skynet.be>
Subject: Strange: die $object un-blesses the object??
Message-Id: <VA.0000007f.04542ced@jll>

I thought it would be smart to pass an object to die(); I could use 
isa() to filter exceptions like I do in C++ with catch() handlers. But 
strangely it doesn't seem to work:

Package exception;

package runtime_error;
@ISA = 'exception';

sub new { return bless {} }

package main;

eval
{
   die (new runtime_error);
};

$e = new runtime_error;
print "$e\n"; # runtime_error=HASH(0x7c5568)
print $e->isa('runtime_error'), "\n"; # 1

print "$@\n"; # runtime_error=HASH(0x7c5568)
print $@->isa('runtime_error'); # nothing!

What's going on??

Jean-Louis Leroy
http://ourworld.compuserve.com/homepages/jl_leroy



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

Date: 20 Mar 1998 13:09:29 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Tied and blessed?
Message-Id: <6etpq9$1pm$1@lyra.csx.cam.ac.uk>

Jean-Louis Leroy  <jll@skynet.be> wrote:
>   [snip]
>   sub new
>   {
>      return bless {}, shift;
              ^^^^^^^^^^^^^^^  this creates an object in class Test.
>   }
>   [snip]
>   sub TIEHASH
>   {
>      print "tied to $_[0]\n";
>      return bless {}, $_[0];
              ^^^^^^^^^^^^^^^  this creates another object in class Test.
>   }
>   [snip]
>   package main;
>
>   $t = new Test;
>   tie %$t, Test;
>   print "$t->{x}\n";
>   $t->test;
>
>Perl said:
>
>    tied to Test
>    33
>    ok
>    destroyed
>    destroyed
>
>As you see, DESTROY is called twice; I speculate that one accounts for untying 
>and the other for the object going out of scope.

You have two different objects  -  one created by Test::new and one
created by Test::TIEHASH.

Since these are logically quite different beasts, it's slightly
eccentric (tho' entirely valid) to put them in the same class.


Mike Guy


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

Date: 20 Mar 1998 14:41:48 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Troubles "perl"ifying a shellscript that uses pipes
Message-Id: <slrn6h2t0r.1i8.sitaram@ltusitaram.diac.com>

On Thu, 19 Mar 1998 11:40:52 -0600, schwern@starmedia.net
<schwern@starmedia.net> wrote:
>Perl can't interpolate a mathematical function in a string, so...
>
>system("echo This line has ".($n+1)." words | cat");

I know its convoluted, but this works:
    $ perl -e '$n=5;print "hi ${\($n+1)} there\n";'
    hi 6 there 


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

Date: 20 Mar 1998 13:15:35 GMT
From: r.p.wambach@larc.nasa.gov (R.P. Wambach)
Subject: Re: Uploading files gt 16mb bombs...
Message-Id: <6etq5n$hs1$1@reznor.larc.nasa.gov>

Check the size of your temporary disk space.  I had a similar problem with 
upload.  We were filling up /tmp.  We found a directory with more space and
everything worked fine.
In article <1998Mar10.190536.3994@relay.nswc.navy.mil>, dwillis@nswc.navy.mil 
says...
>
>I have a program that accepts any file of your choice and will upload
>it to a designated directory on a server.  Everything works fine until
>the file gets to a certain size, like around 16 MB.  Then it bombs.
>But smaller files work fine.  Anybody have any ideas?  I'm new
>to Perl and thought that variables adjusted automatically.
>
>Any help would be greatly appreciated!
>
>Regards,
>Diane Willis



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

Date: 20 Mar 1998 13:55:10 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Using perl code as a config file syntax? (Or, can require return more then one value?)
Message-Id: <6etsfu$806@news-central.tiac.net>

In article <3511f250.18130083@news.isoc.net>, dave <meet@the.zoo> wrote:

>>Have you looked into (and rejected) Data::Dumper?
>
>Hmmm .. I was also thinking how difficult it would be to save configs
>as perl source.  Does Dumper do it?

Data::Dumper writes stuff out in a form which is an eval-able assignment.
You might want to look at

 .../CPAN/modules/by-category/12_Opt_Arg_Param_Proc/ConfigReader/

and see if you canuse it.

Just a thought,

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, 20 Mar 1998 12:24:06 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Re: Wanted: Perl for Windows 3.x
Message-Id: <35125E8A.F5E8F049@usa.net>

As a former student, the best I can say is research - AskJeeves &
DejaNews :-)
(They are a student's BEST first line of information...)

To answer your query - see www.activestate.com

HTH,
Sneex :-)

PS - As the saying goes:  Knowing stuff is Kool!
Knowing how to find 'stuff' is power!



Suranga Manage wrote:

> Dear Friends,
>
> I am a computer eng student, I want to learn some perl. However
> I don't have access to a UNIX box. Is there a perl version that
> can be  run on  MS-Windows 3.1 or MS-Dos  ?.  I know that there
> is a perl flavour for  MS-Windows NT but I am not in a position
> to have access to a NT machine.
>
> Thanks
> Suranga





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

Date: Fri, 20 Mar 1998 15:15:52 +0300
From: Bekman Stanislav <sbekman@iil.intel.com>
Subject: Re: Wanted: Perl for Windows 3.x
Message-Id: <35125DF8.1F03@iil.intel.com>

> I am a computer eng student, I want to learn some perl. However
> I don't have access to a UNIX box. Is there a perl version that
> can be  run on  MS-Windows 3.1 or MS-Dos  ?.  I know that there
> is a perl flavour for  MS-Windows NT but I am not in a position
> to have access to a NT machine.

See www.perl.com (search for win version (activestate) )

and set a normal from or reply-to header if you want to be ever replied
to

______________________________________________________________________
Stas Bekman     mailto:sbekman@iil.intel.com [just another webmaster]
Home Page:      http://www.eprotect.com/stas
A must visit: 	http://www.eprotect.com/stas/TULARC (Java,CGI,PC,Linux)
Linux-il Home:  http://www.linux.org.il/		    
    
Linux receives a 'Product of the Year Award' for Best Technical Support
http://www.infoworld.com/cgi-bin/displayTC.pl?97poy.supp.htm


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

Date: Fri, 20 Mar 1998 15:14:28 +0300
From: Bekman Stanislav <sbekman@iil.intel.com>
To: Suranga Manage <"Use-Author-Address-Header"@[127.1]>
Subject: Re: Wanted: Perl for Windows 3.x
Message-Id: <35125DA4.72E0@iil.intel.com>

> I am a computer eng student, I want to learn some perl. However
> I don't have access to a UNIX box. Is there a perl version that
> can be  run on  MS-Windows 3.1 or MS-Dos  ?.  I know that there
> is a perl flavour for  MS-Windows NT but I am not in a position
> to have access to a NT machine.

See www.perl.com (search for win version (activestate) )


______________________________________________________________________
Stas Bekman     mailto:sbekman@iil.intel.com [just another webmaster]
Home Page:      http://www.eprotect.com/stas
A must visit: 	http://www.eprotect.com/stas/TULARC (Java,CGI,PC,Linux)
Linux-il Home:  http://www.linux.org.il/		    
    
Linux receives a 'Product of the Year Award' for Best Technical Support
http://www.infoworld.com/cgi-bin/displayTC.pl?97poy.supp.htm


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

Date: Fri, 20 Mar 1998 12:37:42 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Re: Wanted: Perl for Windows 3.x
Message-Id: <351261BA.F5087665@usa.net>

Oops, I should get WinNT Perl out of my mind...

 :-)

Try here - http://www.winternet.com/~plp/cgi-dos.html
(Off the www.perl.com site :-)

Sorry,
Sneex :-)

Stupid Sneex wrote:

> As a former student, the best I can say is research - AskJeeves &
> DejaNews :-)
> (They are a student's BEST first line of information...)
>
> To answer your query - see www.activestate.com
>
> HTH,
> Sneex :-)
>
> PS - As the saying goes:  Knowing stuff is Kool!
> Knowing how to find 'stuff' is power!
>

^
+-------------- Sure doesn't know anything!
(Should practice what I preach...  D'oh!)



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

Date: Fri, 20 Mar 1998 13:22:20 -0000
From: "Tony Kenny" <tony@cyberscape.net>
Subject: Re: what is wrong with being a novice ??
Message-Id: <6etr9q$210$1@svr-c-02.core.theplanet.net>


As another 'inexperienced' perl programmer I agree entirely with your
posting.  I sometime get flamed on the IRC for asking questions that are
really in the FAQ and quite rightly because I should really spend more time
reading (if I had the luxury of time).

Maybe there could be another newgroups of comp.lang.perl.newbies or llama or
something?

The only problem I find with the faq is that it is so damn long, maybe there
could be a searchable knowledge base instead.  I would be happy to program
it if it would be used (know that I am learning a bit more, thanks Randal!
:))

~TK

*Perl training in the UK summer '98, email tony@furness.co.uk for more
details.




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

Date: Fri, 20 Mar 1998 13:59:03 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Re: what is wrong with being a novice ??
Message-Id: <351274CB.A2CFDDC0@usa.net>

One was started here -
http://www.boutell.com/openfaq/cgi/

Enjoy!,
Sneex :-)

Tony Kenny wrote:

> As another 'inexperienced' perl programmer I agree entirely with your
> posting.  I sometime get flamed on the IRC for asking questions that are
> really in the FAQ and quite rightly because I should really spend more time
> reading (if I had the luxury of time).
>
> Maybe there could be another newgroups of comp.lang.perl.newbies or llama or
> something?
>
> The only problem I find with the faq is that it is so damn long, maybe there
> could be a searchable knowledge base instead.  I would be happy to program
> it if it would be used (know that I am learning a bit more, thanks Randal!
> :))
>
> ~TK
>
> *Perl training in the UK summer '98, email tony@furness.co.uk for more
> details.





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

Date: 20 Mar 1998 09:38:17 -0500
From: jnielsen@chemistry.mps.ohio-state.edu (John Nielsen)
Subject: where is PerlCOM and PerlCtrl?
Message-Id: <6etv0p$93i@chemistry.ohio-state.edu>


I've seen PerlCOM and PerlCtrl mentioned. Is it downloaded from anywhere?
I looked on CPAN but I didn't see it.

john


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

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

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