[17617] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5037 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 5 14:10:51 2000

Date: Tue, 5 Dec 2000 11:10:20 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <976043420-v9-i5037@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 5 Dec 2000     Volume: 9 Number: 5037

Today's topics:
        How to jump out from a subroutine? <lukus@hongkong.com>
    Re: How to jump out from a subroutine? (Flint Slacker)
    Re: How to jump out from a subroutine? (Abigail)
        Howto create setuid/setgid files and directories? kmyer@hotmail.com
    Re: kill and security (suid) (Anno Siegel)
    Re: learning perl, this does not work ... why? <jboes@eoexchange.com>
    Re: Looking for utility to show execution path (Abigail)
    Re: Lost in a sea of obfuscation... (Abigail)
        modify perl modules <dsdf@sdfd.com>
    Re: modify perl modules nobull@mail.com
        MUMPS module alichambers@madasafish.com
    Re: MUMPS module nobull@mail.com
    Re: Netscape, Apache, Perl and Oracle <bkennedy99@home.com>
    Re: No such file or directory <jochen@c-lab.de>
    Re: No such file or directory (Rafael Garcia-Suarez)
    Re: No such file or directory (Flint Slacker)
        Perl and Mysql <vivekvp@spliced.com>
        print, CGI and socket! <artax@shineline.it>
    Re: print, CGI and socket! nobull@mail.com
        Problem creating DBM database <b.englefield@uel.ac.ku>
    Re: Random password generator (Tad McClellan)
    Re: Random password generator <schneider@xtewa.de>
    Re: Random password generator (Tad McClellan)
    Re: Random password generator <schneider@xtewa.de>
    Re: references, hashes & arrays (Tad McClellan)
    Re: Serial module <bowman@montana.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 6 Dec 2000 01:29:19 +0800
From: "Luc" <lukus@hongkong.com>
Subject: How to jump out from a subroutine?
Message-Id: <90j8kh$4mh1@imsp212.netvigator.com>

are there something like:

sub function{
    jump if $something;
}


thanks!!!!




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

Date: Tue, 05 Dec 2000 17:55:25 GMT
From: flint@flintslacker.com (Flint Slacker)
Subject: Re: How to jump out from a subroutine?
Message-Id: <3a342bdd.97128472@news.tcn.net>


sub jumpout {
	if($true) {
		return;
	} else {
		# do this
	}
	return $true;
}

Flint

On Wed, 6 Dec 2000 01:29:19 +0800, "Luc" <lukus@hongkong.com> wrote:

>are there something like:
>
>sub function{
>    jump if $something;
>}
>
>
>thanks!!!!
>



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

Date: 5 Dec 2000 18:17:23 GMT
From: abigail@foad.org (Abigail)
Subject: Re: How to jump out from a subroutine?
Message-Id: <slrn92qc9j.80s.abigail@tsathoggua.rlyeh.net>

On Wed, 6 Dec 2000 01:29:19 +0800, Luc (lukus@hongkong.com) wrote in comp.lang.perl.misc <URL: news:<90j8kh$4mh1@imsp212.netvigator.com>>:
++ are there something like:
++ 
++ sub function{
++     jump if $something;
++ }


Perl has many "jump" statements, most of which are flavours of 'goto':
plain goto, computed goto, magic goto, next, last, redo, return, die and exit.

Take your pick.


Abigail


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

Date: Tue, 05 Dec 2000 17:31:30 GMT
From: kmyer@hotmail.com
Subject: Howto create setuid/setgid files and directories?
Message-Id: <90j8pj$crl$1@nnrp1.deja.com>

Hi,

I have a small perl program that I developed to help migrate accounts to
a Linux file server, running netatalk and Samba.  It queries an LDAP
server to find valid accounts, then tests to see if those accounts have
home directories.  If it doesn't, it then creates a home directory, as
well as a few directories under them.  However, when I try to change
file modes on a directory to 2707, chmod complains that the first bit
isn't a zero.

Why I need to do this is thus:

We want users to create and keep documents in three folders:  Public,
MyDocuments, and Departments.  Public and Departments are shared.  So as
to not allow them to inadvertantly erase the top directory structure or
to create files in the top level of their home directory,
I'm creating their home directories with mode 500.  Because of that, I
need to create a few supporting netatalk directories, that would
normally be created the first time a user logs in, namely ".AppleDouble:
and "Network Trash Folder".  For whatever reasons, the "Network Trash
Folder" needs created with a mode of 2707 to function properly but
perl's chmod doesn't like that.

My work around has been to include a system call to chmod for that
particular directory but that adds a line of code :)  I'm also curious
as to why all the bits in the first bit of file permissions haven't been
implimented and if they have, what commands you use to set sticky
bits, and create setuid or setgid files/directories?

Thanks,

Kevin


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


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

Date: 5 Dec 2000 14:05:25 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: kill and security (suid)
Message-Id: <90isn5$1sg$1@lublin.zrz.tu-berlin.de>

Chris Fedde <cfedde@fedde.littleton.co.us> wrote in comp.lang.perl.misc:
>In article <87k89ftryb.fsf@nujoma.perrins>,
>Andrew J. Perrin <aperrin@demog.berkeley.edu> wrote:
>>
>>kill('TERM',$_) foreach (split(/\s+/,$pppds));
>>
>>or:
>>
>>system("/bin/kill $_") foreach (split(/\s+/,$pppds));
>>
>>where $pppds contains a chomp()ed, space-separated list of pppd
>>processes (of course, usually just one).
>>
>>No errors are returned, the system just exits quietly.  One minor clue
>>is that kill() does NOT succeed; if I use:
>> kill 'TERM', $_ and print "Killed $_\n";
>>
>>I get no output.  However, if I just print it:
>>
>>print "Killing $_\n";
>>kill 'TERM', $_;
>>
>>it does print, and I manually issue a /bin/kill -TERM <pid>
>>immediately thereafter it works fine.
>>
>
>Use one of the following:
>
>    kill TERM, $_;    # no quotes

Apparently you're assuming a constant TERM.  Where would that come
from?  (You aren't suggesting a bareword, are you? :)

>    kill 15, $_;      # numeric argument
>

Actually, "kill 'TERM', $_" is fine, and even "kill 'TERM',
split /\s+/, $pppds" would be fine, since Perl's kill() accepts
a list of PIDs.

I'd rather suggest he print out the system error after a failed kill:

  kill 'TERM', $_ or warn "Can't kill pid $_: $!\n";

This should show why the kill failed.

>
>    system('/bin/kill', '-TERM', $_);  # called with proper switch

Indeed.  The system() variant couldn't work the way the OP wrote it.

Anno


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

Date: Mon, 04 Dec 2000 16:28:16 -0500
From: "Jeff Boes" <jboes@eoexchange.com>
Subject: Re: learning perl, this does not work ... why?
Message-Id: <3a2d1a61$0$35015$44a10c7e@news.net-link.net>

Unless my newsreader has been taken over by the Illuminati, I think "Jerry
F. Davis" <jfdecd@execpc.com> babbled:


> I put in the following script (from Beginning perl by Simon Cozens)
> expecting the $1 .. $5 variables to print something. I get the first
> print line, "The text matches ...", but do not get anything for $1 as I
> expected.

Unless I'm very confused, you've asked for debugging help on a pattern,
but you didn't give us the pattern you fed into the program! The code is
helpful, but in this case the data read by the code is all-important.

> #!/usr/bin/perl
> 
> use warnings; use strict;
> 
> $_ = '1: A silly sentence (495,a) *BUT* one which will be useful. (3)';
> 
> print "enter a regular expression: "; my $pattern = <STDIN>; chomp
> $pattern;
> 
> if (/$pattern/) {
>   print "The text matches the pattern '$pattern'.\n"; print "\$1 is
>   '$1'\n" if defined $1; print "\$2 is '$2'\n" if defined $2; print "\$3
>   is '$3'\n" if defined $3; print "\$4 is '$4'\n" if defined $4; print
>   "\$5 is '$5'\n" if defined $5;
> }
> else {
>   print "'$pattern' was not found.\n";
> }



-- 
Jeff Boes <jboes@eoexchange.com>          Tel:  (616) 381-9889 x.18
Sr. Software Engineer, EoExchange, Inc.   http://www.eoexchange.com/
Search, Monitor, Notify.                  http://www.eomonitor.com/


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

Date: 5 Dec 2000 18:20:02 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Looking for utility to show execution path
Message-Id: <slrn92qcei.80s.abigail@tsathoggua.rlyeh.net>

On Mon, 4 Dec 2000 21:24:01 +0000 (UTC), Csaba Raduly (real.email@signature.this.is.invalid) wrote in comp.lang.perl.misc <URL: news:<Xns9000D546Equuxi@194.203.134.135>>:
++ 
++ I'm less ambitious. Is there a Perl module to print out a static caller 
++ tree (short of running one of the many programs floating around, e.g. 
++ flower) ?


Carp::cluck().



Abigail


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

Date: 5 Dec 2000 18:21:12 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Lost in a sea of obfuscation...
Message-Id: <slrn92qcgo.80s.abigail@tsathoggua.rlyeh.net>

On Mon, 4 Dec 2000 16:00:29 -0800, Ryan Joseph (perl_man@ryanjoseph.com) wrote in comp.lang.perl.misc <URL: news:<90hb9i$20tm$1@newssvr06-en0.news.prodigy.com>>:
++ 
++ Here is my dillema - I really want to write a JAPH, yet I have no clue how
++ to go about this. Is there any stratigies, tips, techniques, or magic tricks
++ I should know about before I delve into the confusing world of obfuscation,
++ or should I just pound on my keyboard, save and run it and see what happens?


As I said in my talk about JAPHs at YAPC: all you need is an idea and
then work out the details.



Abigail


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

Date: Tue, 5 Dec 2000 17:40:22 +0100
From: "matteo" <dsdf@sdfd.com>
Subject: modify perl modules
Message-Id: <3a2d143b@post.usenet.com>

**** Post for FREE via your newsreader at post.usenet.com ****

modify perl modules

I had to modify some modules (http user agent and parser plus some others),
but now my script works only on my pc, but I would like to make it work on a
remote pc that I can telnet.
Is there a way to ''put perl modules'' inside my script?

thanks





-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 *** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
                      http://www.usenet.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


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

Date: 05 Dec 2000 18:44:05 +0000
From: nobull@mail.com
Subject: Re: modify perl modules
Message-Id: <u9sno27loq.fsf@wcl-l.bham.ac.uk>

"matteo" <dsdf@sdfd.com> writes:

> modify perl modules
> 
> I had to modify some modules (http user agent and parser plus some others),
> but now my script works only on my pc, but I would like to make it work on a
> remote pc that I can telnet.
> Is there a way to ''put perl modules'' inside my script?

I think a better question would be "How do I keep my own
module/library directory?".

For answer, see FAQ.

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


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

Date: Tue, 05 Dec 2000 14:08:02 GMT
From: alichambers@madasafish.com
Subject: MUMPS module
Message-Id: <90isru$223$1@nnrp1.deja.com>

Hi there

I'm looking for a module for PERL that will allow me to connect to a
MUMPS system. Does anyone have any leads?

Many regards

Dr Alex Chambers


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


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

Date: 05 Dec 2000 18:22:58 +0000
From: nobull@mail.com
Subject: Re: MUMPS module
Message-Id: <u9y9xu7mnx.fsf@wcl-l.bham.ac.uk>

alichambers@madasafish.com writes:

> I'm looking for a module for PERL that will allow me to connect to a
> MUMPS system. Does anyone have any leads?

Connect using what protocol? OMI? MUMPS/188? MSM-NET? DSM-DDP? Some
other proprietory protocol?  CORBA?  HTTP?...

Several HTTP servers in MUMPS are avialable and you could talk to a
MUMPS system using LWP.

Do you happen to have a copy of ANSI/MDC X11.2-1995? If so it wouldn't
be too hard to knock together a module that implements an OMI client
as a tied hash.

BTW: Not directly relevant but Have you seen

http://freem.vmth.ucdavis.edu/saintly/MontyPERL/

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


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

Date: Tue, 05 Dec 2000 15:01:36 GMT
From: "Ben Kennedy" <bkennedy99@home.com>
Subject: Re: Netscape, Apache, Perl and Oracle
Message-Id: <kr7X5.172201$td5.24794356@news1.rdc2.pa.home.com>


"R.C. van der Zant" <rvdzant@planet.nl> wrote in message
news:3A2C23ED.EE43FB8@planet.nl...

> 1) Edit the HTTP start shell script and add : ORACLE_HOME,
> LD_LIBRARY_PATH and extend PATH with : ${ORACLE_HOME}/bin.
>    Restart the HTTP processes.
>    The situation remains unaltered.

Are you sure this environmental variables are getting passed to the CGI
script?  Make sure that in your startup script you are exporting the
variables into the environment, and confirm that they are there by dumping
%ENV.  Another thing you can try is running the "ldconfig" command as root
to rebuild your shared library cache.  Probably both longshots, but you
never know.  Good luck!

--Ben Kennedy




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

Date: Tue, 05 Dec 2000 16:10:50 +0100
From: Jochen Luig <jochen@c-lab.de>
Subject: Re: No such file or directory
Message-Id: <3A2D057A.FF9C874D@c-lab.de>

Hi!

Mark Kidd wrote:
> 
> I'm trying to add a perl script to my website, and when I execute it in
> my HTML, it comes up with "Internal Server Error."
> Checking the error logs, I see "No such file or directory"

This doesn't necessarily refer to the script itself. If your script
processes files, check the paths.

Jochen


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

Date: Tue, 05 Dec 2000 15:34:29 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: No such file or directory
Message-Id: <slrn92q2pq.uvu.rgarciasuarez@rafael.kazibao.net>

Jochen Luig wrote in comp.lang.perl.misc:
> 
> Mark Kidd wrote:
> > 
> > I'm trying to add a perl script to my website, and when I execute it in
> > my HTML, it comes up with "Internal Server Error."
> > Checking the error logs, I see "No such file or directory"
> 
> This doesn't necessarily refer to the script itself. If your script
> processes files, check the paths.

Or, the first line (#!) of the script may have a wrong location for the
perl interpreter.

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Tue, 05 Dec 2000 15:42:26 GMT
From: flint@flintslacker.com (Flint Slacker)
Subject: Re: No such file or directory
Message-Id: <3a2e0ac7.88656946@news.tcn.net>


I would say the webserver is telling the truth, they are pretty good
that way.  :)  The path that you access the website through might be a
symlink and the server might not be configured to follow them.....


# You
/home/mark/website

# Webserver
/some/other/path/to/website/mark

open(IN, "< /home/mark/website/data.txt").... Fails

Flint

On Tue, 05 Dec 2000 00:57:07 GMT, Mark Kidd <lexkidd@gte.net> wrote:

>I'm trying to add a perl script to my website, and when I execute it in
>my HTML, it comes up with "Internal Server Error."
>Checking the error logs, I see "No such file or directory"
>The filename is correct, and the permissions are correct. I don't have a
>lot of experience with Perl, but I can't figure out what isn't working.
>I'm thinking it's a server configuration issue.
>
>
>mark



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

Date: Tue, 05 Dec 2000 14:11:58 GMT
From: vivekvp <vivekvp@spliced.com>
Subject: Perl and Mysql
Message-Id: <90it39$26d$1@nnrp1.deja.com>



Hello,

I need to take data from the form I have below and send it to a perl
script that would write it to a mysql database.

I am not sure how to separate the data sent in the form - and send it to
each table.  Basically I just want the data in the form to send the data
to the database.  Each field is a table.

So how do I separate them?  I think I can handle writing and retrieving
the data.  I mean I hope I can!

Thanks!

V

Data:

http://www.xxx.com/database/test/?=555&=444&=4444&=222&=555&=5555&first_
name=test%40test.com&first_name=x&last_name=x&street_1=x&city=x&select_s
tate=Louisiana&state=x&zip=12345&country=United+States&flags1=1&birth_da
te_mon=12&birth_date_day=19&birth_date_year=1981&Sex=0&Marital=S&Continu
e=Sign+Me+Up%21


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


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

Date: Tue, 5 Dec 2000 13:49:58 +0100
From: "Federico" <artax@shineline.it>
Subject: print, CGI and socket!
Message-Id: <3a2d2fdb_1@news.telnetwork.it>

Hi all,

    I need to know ('cause i have to do a statistics report) if the print in
CGI environment of a HTML page, ie to a browser, has been well finished or
in
other words if the final user has receive all the page or went away before
cause for example a long delay. Somebody know how to do?

    i have thought to write in a file at the end of the print as follow:

----------------
print << "EOF1";

[PAGINA HTML]


EOF


$t=gmtime();
($disc1,$disc2,$disc3,$ora,$disc4)=split(/[\s]+/,$t);


open(fd,">>../statistics/movies_statistics/prima_concluso_movies_$giorno-$nu
mero_giorno-$mese-$anno.inf");
flock(fd,2);
seek(fd,0,2);
print fd $ultimo_numero.":::no $rapporto:::"."$ora\n";
flock(fd,8);
close(fd);
-----------------

thinking that if the final user change url before the EOF was reached the
program exits before the file writting, before the open(...). On the
countrary the open(...) instruction is always reached and the file writing
could not be used as detection of the sending page status. Any other idea???

    Thank you, fom italy

        Federico






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

Date: 05 Dec 2000 18:37:51 +0000
From: nobull@mail.com
Subject: Re: print, CGI and socket!
Message-Id: <u9u28i7lz4.fsf@wcl-l.bham.ac.uk>

"Federico" <artax@shineline.it> writes:

>     I need to know ('cause i have to do a statistics report) if the
> print in CGI environment of a HTML page, ie to a browser, has been
> well finished or in other words if the final user has receive all
> the page or went away before cause for example a long
> delay. Somebody know how to do?

I would suggest employing a private detective to stand behind the user
and look over this shoulder.

Actaully, a small <IMG> at the bottom of the page is probably the
simplest solution.  If the image gets loaded then you know the page
got though to a user-agent.  You'll also need a <IMG> at the top of
the page as a control so that you can exclude users with image loading
disabled from your stats.

>     i have thought to write in a file at the end of the print as follow:

No that's useless.  All that proves is that the data was printed by
the CGI script.  

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


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

Date: Tue, 05 Dec 2000 15:40:31 +0000
From: Bernard Englefield <b.englefield@uel.ac.ku>
Subject: Problem creating DBM database
Message-Id: <3A2D0C6E.E86070AC@uel.ac.ku>

I am having trouble running a very simply perl program to create a DBM
database.
I am using perl 5.005_03 under solaris 2.7

The program is only a few lines long

/usr/local/bin/perl
dbmopen(%WORDS,"words",0644);
$WORDS{"bernie1"}="test";
dbmclose(%WORDS);

This program works OK on all my system apart from the one I need to run
it on.
On the good systems it creates two files
    size
    0        words.dir
    1024  words.pag

On the bad system I get two files
    size
    24587    words.dir
    24587    words.pag

The two files seem to be identical and contain the text from the perl
script.

If I try to open the database I get  Segmentation Fault - core dumped

I have rebuilt my version of perl but this has made no differrence. I
can use other program
like makedbm to read and write DBM file on the system. Has anyone got
any ideas what my problem could be.



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

Date: Tue, 5 Dec 2000 09:09:03 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Random password generator
Message-Id: <slrn92ptnv.ni3.tadmc@magna.metronet.com>

SimBean <schneider@xtewa.de> wrote:
>
>> >> You do read the descriptions for the functions that you use, don't
>> >you?

>> >I have to admit that I don't!

>> Don't say that where people can hear you, or they may do
>> something about it (like ignore all of your posts).


>When I am facing a problem, the first the first thing I do is search
>the documentation. For I am not a native english-speaker, some of the
>explanations are a little hard to understand (not many, but some). So
>the next step is to search the internet for related topics. Most hits
>are links to the documentation. :/
>So that is when I start posting to a newsgroup. Actually this is when I
>start looking into former messages in a newsgroup (or forum), because
>this forum is the first perl-forum I ever joined and I did so only a
>few days ago!!


That is fine. But that is not what you said. Sounded to me
like you were saying that you don't read the descriptions
for the functions that you use.

Review the quoted text once again. How could I infer what you
just told me from what was available to me at the time?


Your list of steps is nearly exactly the same as the one that
I give when teaching Perl. In priority order:

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

----------------------------------
Perl problem resolution checklist:
----------------------------------

1) check the Perl FAQs 

   (word search with "perldoc -q". Or better, find where the 
    *.pod's are on your system, and word search (grep) the 
    entire contents of the files)

2) expand the above to _all_ of the standard *.pod files.

3) check a Usenet archive such as www.deja.com (use "Power Search").

4) check books and websites (this step is optional)

5) write a Usenet article, but don't post it yet!

   5a) make a small and complete program that people can execute
       that shows your problem.

   5b) state how the program's output is not what you want. Describe
       what you want.

   5c) repeat steps 1-4 using search terms taken from your description
       of the problem or your Subject header (try some synonyms for
       the terms also)

6) Give up on a quick answer. Post to Usenet for a slow answer.

7) wait hours/days/forever for followups with answers rather than
   than the 5 or 10 minutes it would have taken if steps 1-3
   had worked.

8) Wonder at the quality of the answers given, rather than know
   it is a peer-reviewed, validated answer if steps 1-2 had worked.

9) Repeat steps 1-3 many times for many problems. You will seldom
   get past step 3, and even less often get past step 5a.

10) Now that you know so much, go *answer* some questions on Usenet  :-)


-----

To help with 1 and 2 above, I make "headlines" files to grep in,
because sometimes there is Too Much Information when grepping
the entire bodies:

   cd /an/INC/dir/pod/

   grep '^=' perlfaq[1-9].pod >faq.heads

   grep '^=' *.pod >all.heads


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


>So what I don't do is:
>read the whole documentation whenever I have a problem.


Don't be going silly on us now. 

Where did you get the idea that anyone expects that?

Nobody expects you to have done that.

Only that you have _tried_ to find it there before posting.

You are not required to have _succeeded_ in finding it.

Even Larry doesn't have the whole of Perl's docs in his head.


Your problem with my() would not have been a problem if you
had read "perldoc -f my", so I concluded that you did not
even attempt a rudimentary search.


>What I do is:
>try to find a solution on my own.


The most effective of all possible techniques :-)


>And even if I find a solution, I think it still is useful to post to a
>forum, because you find people who know the language way better than I
>do (like you e.g.) who can help you to create "better" code!


Right. But besides followups from "people who know the language 
way better" you will also get followups from "people who know 
the "answer" because they just learned this part last month".

Deciding which is which is left as an exercise for the reader.


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


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

Date: Tue, 05 Dec 2000 16:40:28 GMT
From: SimBean <schneider@xtewa.de>
Subject: Re: Random password generator
Message-Id: <90j5ps$a0a$1@nnrp1.deja.com>


> That is fine. But that is not what you said. Sounded to me
> like you were saying that you don't read the descriptions
> for the functions that you use.
> Review the quoted text once again. How could I infer what you
> just told me from what was available to me at the time?
Yes, you're right. I tried to keep it short and that was wrong in
this case.
Sorry for that.


> [LIST]
I'll keep that in mind ... uh ... inbox!  ;)



>    cd /an/INC/dir/pod/
>    grep '^=' perlfaq[1-9].pod >faq.heads
>    grep '^=' *.pod >all.heads
I am using WinNT!!!

> Don't be going silly on us now.
> Where did you get the idea that anyone expects that?
> Nobody expects you to have done that.
Why just why do you take everything so _serious_?? :)
I was just a little bit exaggerating to make myself clear.


> Your problem with my() would not have been a problem if you
> had read "perldoc -f my", so I concluded that you did not
> even attempt a rudimentary search.
It wasn't really a problem until you told me it was. The code was ok
for me, it worked well.
btw: it was old code. very old.


> >And even if I find a solution, I think it still is useful to post to
a
> >forum, because you find people who know the language way better than
I
> >do (like you e.g.) who can help you to create "better" code!
>
> Right. But besides followups from "people who know the language
> way better" you will also get followups from "people who know
> the "answer" because they just learned this part last month".
> Deciding which is which is left as an exercise for the reader.
And deciding which is more usefull for me as well!


--
Ciao,
SimBean.


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


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

Date: Tue, 5 Dec 2000 11:20:58 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Random password generator
Message-Id: <slrn92q5fa.nrg.tadmc@magna.metronet.com>

SimBean <schneider@xtewa.de> wrote:

>>    cd /an/INC/dir/pod/
>>    grep '^=' perlfaq[1-9].pod >faq.heads
>>    grep '^=' *.pod >all.heads
>I am using WinNT!!!


Sorry to hear that.

But you have perl, don't you?  :-)

Write 'grep' in Perl:

   perl -ne "print if /^=/" perlfaq[1-9].pod >faq.heads

or

   perl -ne "print qq/$ARGV: $_/ if /^=/" perlfaq[1-9].pod >faq.heads

I can't help with Windows, I do not use it. So you may need
to adjust that a bit.


>> Your problem with my() would not have been a problem if you
>> had read "perldoc -f my", so I concluded that you did not
>> even attempt a rudimentary search.
>It wasn't really a problem until you told me it was. 


You were using global variables when you didn't think you
had any global variables.

(you should have warnings enabled, it warns about the very
 mistake that you made!
)


>The code was ok
>for me, it worked well.


You were simply lucky that you didn't stomp on the globals.

You dodged a bullet.


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


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

Date: Tue, 05 Dec 2000 17:53:20 GMT
From: SimBean <schneider@xtewa.de>
Subject: Re: Random password generator
Message-Id: <90ja2b$dvh$1@nnrp1.deja.com>


> >>    cd /an/INC/dir/pod/
> >>    grep '^=' perlfaq[1-9].pod >faq.heads
> >>    grep '^=' *.pod >all.heads
> >I am using WinNT!!!
> Sorry to hear that.
> But you have perl, don't you?  :-)
I even compiled it myself!!! *proud*
It just took me 4 hours to do so ... :)

> Write 'grep' in Perl:
Cool, I'll try that ...


> (you should have warnings enabled, it warns about the very
>  mistake that you made!)
As I said, it was old code. I am using the -w trigger and use strict
for a while.
And even if i wasn't - after reading a few postings I defenitely
would!!! ;)


> You were simply lucky that you didn't stomp on the globals.
Yes. That is why I didn't know that something was wrong when I wrote
that program ... I worked!



> You dodged a bullet.
"
- Does that mean I can dodge bullets?
- What I am trying to tell you is that when you are ready ... you won't
have to!
"
;)



Ciao,
René.


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


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

Date: Tue, 5 Dec 2000 09:38:52 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: references, hashes & arrays
Message-Id: <slrn92pvfs.ni3.tadmc@magna.metronet.com>

Jody Fedor <Jodyman@usa.net> wrote:

>PS - Still don't understand why you use the ' marks when accessing a hash
>but
>not if you are using a hash of a hash i.e.


It is not the HoH-ness that makes the quotes optional, it
is the "fat comma" (ie "=>") operator.

Use a normal comma, and you get a warning and a violation
of "strict subs". (you should always have warnings and
strictures turned on)


>%in = (
>unit => "akrn",

   unit, 'akrn',     # get warning and strict error

   'unit', 'akrn',   # hunky dokey


>you would use:  print $unit{'akrn'}  to get: Akron Ward

You can also use:

   print $unit{akrn} 

to get the same thing.


In review, there are (at least) 2 ways to get auto-quoting of strings:

   1) "fat comma" auto-quotes its left operand (maybe)

from perlop.pod:

-----------------------------
The => digraph is mostly just a synonym for the comma operator.  It's useful for
documenting arguments that come in pairs.  As of release 5.001, it also forces
any word to the left of it to be interpreted as a string.
-----------------------------


   2) hash keys are auto-quoted (maybe)

from perldata.pod:

-----------------------------
In fact, an identifier within such curlies is forced to be a string,
as is any simple identifier within a hash subscript.  Neither need
quoting.  Our earlier example, C<$days{'Feb'}> can be written as
C<$days{Feb}> and the quotes will be assumed automatically.  But
anything more complicated in the subscript will be interpreted as
an expression.
-----------------------------



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


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

Date: Tue, 5 Dec 2000 07:29:32 -0700
From: "bowman" <bowman@montana.com>
Subject: Re: Serial module
Message-Id: <u17X5.305$7M1.4195@newsfeed.slurp.net>


TomC <livia74@ctimail3.com> wrote
> Can anyone know the function of the module Device::Serial and how to
> use?


Do you mean Device::SerialPort? This is a *nix version of the
Win32::SerialPort module.  Conceptually, they are are wrapper on Termios and
add quite a bit of convenience. The stty calls are supported,  as well as
setting baud rates, handshakes, and so forth.

For a straight *nix implementation, using Termios is probably just as easy
and more familiar.
However, I have to support Windows, AIX, and Linux, so using the two
packages allows all
of the code after the instantiation of the SerialPort object. There is an
accompanying html
file and examples for each.









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

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


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