[13610] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1020 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 8 10:05:34 1999

Date: Fri, 8 Oct 1999 07:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <939391513-v9-i1020@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 8 Oct 1999     Volume: 9 Number: 1020

Today's topics:
    Re: Backtick programs oliver.cookUYNQFM@ukonline.co.uk
    Re: Converting from Decimal to Binary <ykhu@mtk.com.tw>
    Re: Converting from Decimal to Binary <sb@sdm.de>
    Re: Date variable (I.J. Garlick)
    Re: Date variable <hauk@forumnett.no>
    Re: Date variable <ak@dasburo.de>
    Re: exec() argument problem with ActiveState 520 (Scott Vance)
        HELP: find the best REGEX... <cyshieh@sis.com.tw>
    Re: How to write an EOF in to a file? <ak@dasburo.de>
    Re: inserting new character <rhomberg@ife.ee.ethz.ch>
        Is $$variable allowed like in PHP ? <krajzewicz@inx.de>
    Re: Is $$variable allowed like in PHP ? (Clinton Pierce)
        Is there a good perl friendly text editor for WinNT? <hauk@forumnett.no>
    Re: Is there a good perl friendly text editor for WinNT <dan@tuatha.sidhe.org>
    Re: Memory leak in assignment <dan@tuatha.sidhe.org>
    Re: mkdir... and then!? (Anno Siegel)
    Re: mkdir... and then!? (Clinton Pierce)
        Oh Yeah!. How to compile Perl to .EXE? <pdobbs@home.com>
        parenthesizing arguments to grep - BLOCK form jrw32982@my-deja.com
    Re: Passwords <namecity@my-deja.com>
    Re: reading binary data files fheitka@attglobal.net 
        Receiving e-Mail Messages via Mail::POP3Client, with Ma (Samuel)
    Re: scanning websites (Randal L. Schwartz)
        UNLINK not working as I'd expect? Clarify Please? <pdobbs@home.com>
    Re: UNLINK not working as I'd expect? Clarify Please? <rhomberg@ife.ee.ethz.ch>
    Re: UNLINK not working as I'd expect? Clarify Please? (Clinton Pierce)
    Re: Use of unitialized value (Randal L. Schwartz)
    Re: Using a regexp in an index function, can it be done <ltl@rgsun5.viasystems.com>
    Re: We do complex Perl Programming (Scott McMahan)
    Re: We do complex Perl Programming <jeffp@crusoe.net>
    Re: What is THE book for PERL? <mike@crusaders.no>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 8 Oct 1999 13:10:29 GMT
From: oliver.cookUYNQFM@ukonline.co.uk
Subject: Re: Backtick programs
Message-Id: <7tkqg5$4di$1@apple.news.easynet.net>


Thanks for all the suggestions. I solved it like this:

#!/usr/bin/perl
open (DB, "/etc/data");
@data = <DB>;
close(DB);
$ref = "0";
foreach $line (@data) {
 $ref++;
 ($user[$ref],$domain[$ref],$logfile[$ref],$location[$ref]) = split
(/:/, $line);
 $location[$ref] =~ s/\n//;
}

for $c (1..$ref) {
$webmaster = "webmaster\@".$domain[$c];
$baseurl = "http://www.".$domain[$c];
#write out analog.cfg
system("cp -f analog.txt /usr/local/apache/analog/analog.cfg");
system("echo LOGFILE $logfile[$c]
>>/usr/local/apache/analog/analog.cfg");
print "-----------ANALOG DONE----------\n";
#write out rmagic.ini
system("cp -f rmagic.ini /root/statsrun/temp.ini");
system("echo Frame_File_Out = $location[$c]/index.html
>>/root/statsrun/temp.ini");
system("cat rmagic.ini.2 >>/root/statsrun/temp.ini");
system("echo File_Out = $location[$c] >>/root/statsrun/temp.ini");
system("cat rmagic.ini.3 >>/root/statsrun/temp.ini");
system("echo File_Out = $locationpc]/navfile.html
>>/root/statsrun/temp.ini");
system("cat rmagic.ini.4 >>/root/statsrun/temp.ini");
system("echo webmaster = $webmaster >>/root/statsrun/temp.ini");
system("echo Base_URL = $baseurl >>/root/statsrun/temp.ini");
system("rm -f /usr/local/apache/rmagic/report.dat");
print "-----------RMAGIC DONE-----------\n";

#run analog
system("/usr/local/apache/analog/analog");
print "---------RUN ANALOG--------\n";
#run rmagic
system("rm -rf $location");
system("cd /usr/local/apache/rmagic");
system("/usr/local/apache/rmagic/rmagic.pl /root/statsrun/temp.ini");
print "---------RUN RMAGIC-------\n";
}
exit;

Regards,
Ollie

>
>I'm writing a program which needs to call several shell programs. To
>run them I use the following format:
>
>`command1`;
>`command2`;
>
>however, command2 is started as soon as command1 is. How can I make
is
>to that command2 isn't started until command1 is finished?
>
>REgards,
>Ollie
>
>Please remove the IYAPCR before replying by email.
>
>***** Posted via the UK Online online newsreader *****
>
> Go to http://www.ukonline.co.uk to find out
> about other online services we offer our subscribers.
>
>


Please remove the UYNQFM before replying by email.

***** Posted via the UK Online online newsreader *****

 Go to http://www.ukonline.co.uk to find out
 about other online services we offer our subscribers.




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

Date: Fri, 08 Oct 1999 19:42:24 +0800
From: Steve Hu <ykhu@mtk.com.tw>
Subject: Re: Converting from Decimal to Binary
Message-Id: <37FDD8A0.4DA1357C@mtk.com.tw>



Kenneth Rose wrote:

> Hi all,
>
> Have the following question.  Suppose I have a number in decimal (let's
> say I have 112).  How, in Perl, can I quickly change this to its binary
> notation (in this case, 1110000)?
>
> I read the FAQs and saw the code for:
>
> $binary_string = join('', unpack('B*', "\x29"));
>
> in perlfaq4.  But \x29 is a hex value.  I want to convert from decimal.
> Any help is appreciated.
>
> /<en



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

Date: 8 Oct 1999 13:17:05 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: Re: Converting from Decimal to Binary
Message-Id: <7tkqsh$ac7$1@solti3.sdm.de>

In article <37FD687A.446CD000@julian.uwo.ca>, Kenneth Rose <klrose@julian.uwo.ca> wrote:

> Have the following question.  Suppose I have a number in decimal (let's
> say I have 112).  How, in Perl, can I quickly change this to its binary
> notation (in this case, 1110000)?

> I read the FAQs and saw the code for:

> $binary_string = join('', unpack('B*', "\x29"));

> in perlfaq4.  But \x29 is a hex value.  I want to convert from decimal. 
> Any help is appreciated.


Suggestion for the perlfaq4 manpage:
------------------------------------

How do I convert from hexadecimal to decimal:

1) $dec = 0xDEADBEEF;
2) $dec = hex("DEADBEEF");
3) $dec = unpack("N", pack("H8", substr("0" x 8 . "DEADBEEF", -8)));
4) use Bit::Vector;
   $vec = Bit::Vector->new_Hex(32, "DEADBEEF");
   $dec = $vec->to_Dec();

How do I convert from decimal to hexadecimal:

1) $hex = sprintf("%X", 3735928559);
2) $hex = unpack("H*", pack("N", 3735928559));
3) use Bit::Vector;
   $vec = Bit::Vector->new_Dec(32, -559038737);
   $hex = $vec->to_Hex();

How do I convert from octal to decimal:

1) $dec = 033653337357; # note the leading '0'
2) $dec = oct("33653337357");
3) use Bit::Vector;
   $vec = Bit::Vector->new(32);
   $vec->Chunk_List_Store(3, split(//, reverse "33653337357"));
   $dec = $vec->to_Dec();

How do I convert from decimal to octal:

1) $oct = sprintf("%o", 3735928559);
2) use Bit::Vector;
   $vec = Bit::Vector->new_Dec(32, -559038737);
   $oct = reverse join('', $vec->Chunk_List_Read(3));

How do I convert from binary to decimal:

1) $dec = unpack("N", pack("B32",
      substr("0" x 32 . "11011110101011011011111011101111", -32)));
2) use Bit::Vector;
   $vec = Bit::Vector->new_Bin(32, "11011110101011011011111011101111");
   $dec = $vec->to_Dec();

How do I convert from decimal to binary:

1) $bin = unpack("B*", pack("N", 3735928559));
2) use Bit::Vector;
   $vec = Bit::Vector->new_Dec(32, -559038737);
   $bin = $vec->to_Bin();

The remaining transformations (e.g. hex -> oct, bin -> hex, etc.)
are left as an exercise to the inclined reader. :-)

(Note: The advantage of the Bit::Vector module is that it works with
numbers of ANY size.)

HTH :-)

-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/
    http://www.engelschall.com/u/sb/gallery/ (Fotos Brasil, USA, ...)
    http://www.engelschall.com/u/sb/download/ (Free Perl and C Software)


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

Date: Fri, 8 Oct 1999 12:59:31 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: Date variable
Message-Id: <FJAC37.5ts@csc.liv.ac.uk>

In article <7tkctv$8js$1@nnrp1.deja.com>,
hakanogren@my-deja.com writes:
> Is there a Date variable in Perl and how do I use
> it?

$Date;

Any way you want to.

However you will probably have more luck with perldoc -f localtime.


-- 
Ian J. Garlick
ijg@csc.liv.ac.uk

You probably wouldn't worry about what people think of you if you could
know how seldom they do.
                -- Olin Miller.



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

Date: Fri, 08 Oct 1999 15:26:58 +0200
From: Hauk Langlo <hauk@forumnett.no>
Subject: Re: Date variable
Message-Id: <37FDF122.D5E9400B@forumnett.no>

Try thisone:

($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
localtime(time());	
$mon ++;

time() is the number of seconds since 1970. Localtime "convert" this
number into the more practical values you see above.

Hauk

hakanogren@my-deja.com wrote:
> 
> Is there a Date variable in Perl and how do I use
> it?
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.

-- 
__________________________________________________________

Hauk Langlo			EXTEND AS
ForumNett Online AS endret 18/5-99 navn til extend as
PHONE +47 73546100 - CELL +47 93438940 - FAX +47 73546105
MAIL: hauk@extend.no - INFO: http://www.extend.no


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

Date: Fri, 08 Oct 1999 15:15:23 +0200
From: Alexander Knack <ak@dasburo.de>
To: hakanogren@my-deja.com
Subject: Re: Date variable
Message-Id: <37FDEE6B.5BBE1538@dasburo.de>

hakanogren@my-deja.com wrote:
> 
> Is there a Date variable in Perl and how do I use
> it?
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.
perldoc -f localtime!
-- 
+--------------------------------------------------------------------+
| Alexander Knack  ........Entropie erfordert keine Wartung .........|
|  dasburo.de      ..................................................| 
+--------------------------------------------------------------------+


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

Date: Fri, 8 Oct 1999 12:18:57 GMT
From: sasdsv@wnt.sas.com (Scott Vance)
Subject: Re: exec() argument problem with ActiveState 520
Message-Id: <37fedd39.136915203@newshost.unx.sas.com>

Thanks to repondents pointing me down the right path, I've made
the test program work.  The trick is (apparently) three-fold;
add double quotes to the editor's path, and put the args in a list, 
and use the qq string quoting syntax on the list.  Leave off any
of the three and it doesn't work.

I confess I'm a perl-plodder and not an efficianado, so I don't 
yet *fully* understand why this works or is required.

PS. I had to use backslashes in the paths because using forward 
slashes causes the editor being loaded to print the file rather 
than load it.  Probably a 'feature' of the editor but I'm not 
really sure yet.

-----------
# Simple perl Program to load a file into an editor.

$Prog = "C:\\Program Files\\UltraEdit\\UEdit32.exe";
$FileLocation = "C:\\My Documents\\Perl";
$File = "junk.pl";

@args = ("\"$Prog\"", "$FileLocation\\$File");
exec ( qq{@args} );
-----------



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

Date: 8 Oct 1999 13:21:41 GMT
From: "cyshieh" <cyshieh@sis.com.tw>
Subject: HELP: find the best REGEX...
Message-Id: <7tkr55$ac7$1@news.seed.net.tw>

$_="01010LLHHLLHHLXHH010LXH11LLH001";
                  |^^^^^^^^^^^^^^^^^^||^^^^^^^^^^^^^^^^^^^|
                       string A                      string B = 14 (length)

I want to find out if there has any 'X' character in string A, but
I dont care the 'X' character in string B.
If the length of $_ is about 500 and the length of string A is 60, the
following is my solution (for this example).
If there has any other faster expression?
Thanks!

/^.{5}.*?X+?/ and $' =~ /.{14}$/




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

Date: Fri, 08 Oct 1999 15:14:42 +0200
From: Alexander Knack <ak@dasburo.de>
To: "Daniel Y.L." <linyong2000@990.net>
Subject: Re: How to write an EOF in to a file?
Message-Id: <37FDEE42.DF013A62@dasburo.de>


> # undef $/;
> # $contents = <FILEHANDLE>;        # it only read one line, it is correct;
> while (<FILEHANDLE>) {
>     $contents .= <FILEHANDLE>;      # hang up, seems no EOF;
> }
this can't work. why? figure it out.

what you want is:
my $line;
my $content;
while ($line = <FILEHANDLE>) {
 $content .= $line;
}

-- 
+--------------------------------------------------------------------+
| Alexander Knack  ........Entropie erfordert keine Wartung .........|
|  dasburo.de      ..................................................| 
+--------------------------------------------------------------------+


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

Date: Fri, 08 Oct 1999 12:25:04 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
To: N.Hadi@motorola.com
Subject: Re: inserting new character
Message-Id: <37FDC680.2F6C6B56@ife.ee.ethz.ch>

Noira Hadi wrote:
> 
> Martien,
> 
> Thanks for the help. I modified your script to be something like below as
> your script failed to open data file in my machine:
> 
> #!/usr/bin/perl -w
> 
> open(INF,"data") ;

don't forget to check the return value of that:
open(INF,"data") or die "because of $!";

> I understand that you are assuming the first set of B is the longest
> length for the entire data, such as below:

No, just set $length to the desired loop before length.

Anyway, here is my script (which is perlier IMHO :-):

- Alex

=cut perl script follows

#!/usr/bin/perl -wl

my $length = 10; #enter your own value, total minimum length of buffer

my $filename = "data"; #set this to read from file

$filename and open(DATA, "$filename") || die "because of $!";
my @buf;

while(<DATA>) {
  chomp;
  push @buf, $_;
  if (/D/) {
    #add C's before the D until scalar(@buf) >= $length
    splice @buf, -1, 0, map {"C"} (@buf..$length-1);

    print join ",", @buf; #This prints at least 10 fields

    @buf = (); #reset
  }
}

__DATA__
A
B
B
B
B
B
B
B
B
B
B
D
A
B
B
B
B
D
A
B
B
D


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

Date: Fri, 08 Oct 1999 13:52:31 +0200
From: Daniel Krajzewicz <krajzewicz@inx.de>
Subject: Is $$variable allowed like in PHP ?
Message-Id: <37FDDAFF.3DC700A6@inx.de>

Hello there !!!

Recently I noticed, reading the PHP3-manual that this script-language
supports
the use of construcs like "$$name = value".
Hereby the variable with the name "$name" receives the value "value".
Is this also possible to construct such operations in Perl ??

thanks,
Daniel Krajzewicz


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

Date: Fri, 08 Oct 1999 13:21:39 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Is $$variable allowed like in PHP ?
Message-Id: <3804ef5f.247014768@news.ford.com>

[poster cc'd in e-mail]

On Fri, 08 Oct 1999 13:52:31 +0200, Daniel Krajzewicz <krajzewicz@inx.de>
wrote:
>Recently I noticed, reading the PHP3-manual that this script-language
>supports
>the use of construcs like "$$name = value".
>Hereby the variable with the name "$name" receives the value "value".
>Is this also possible to construct such operations in Perl ??

Yes, they're called soft references (or symbolic references).

Using them is generally considered a Bad Idea, which is one reason why
"use strict" won't put up with them.  Other syntax like hashes of hashes,
or hard references should be used instead.


-- 
Clinton A. Pierce       "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org        Miracles."  -- Miracle Max, The Princess Bride
http://www.geeksalad.org


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

Date: Fri, 08 Oct 1999 15:14:50 +0200
From: Hauk Langlo <hauk@forumnett.no>
Subject: Is there a good perl friendly text editor for WinNT?
Message-Id: <37FDEE4A.B6CA7149@forumnett.no>

Hi there. I'm sure many of you will suggest I should install Linux and
use eMacs as I hear this all day long at work. I do not however think
I'm ripe for Linux just yet, but I do miss a lot of the fancy functions
in editors like eMacs. I'm currently using Ultra Edit 6.00a wich is good
in many ways. I do however miss important things like function block
deflating or function jumping along with a more effective auto indenting
function. Colour coding for Perl is also a must. I would be very happy
if anyone know about an editor that will let me do that and even more
happy if you would reply by mail : )

Regards Hauk Langlo

-- 
__________________________________________________________

Hauk Langlo			EXTEND AS
ForumNett Online AS endret 18/5-99 navn til extend as
PHONE +47 73546100 - CELL +47 93438940 - FAX +47 73546105
MAIL: hauk@extend.no - INFO: http://www.extend.no


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

Date: Fri, 08 Oct 1999 13:45:33 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Is there a good perl friendly text editor for WinNT?
Message-Id: <1AmL3.15$IZ5.616@news.rdc1.ct.home.com>

Hauk Langlo <hauk@forumnett.no> wrote:
> I'm ripe for Linux just yet, but I do miss a lot of the fancy functions
> in editors like eMacs.

So, use Emacs. There are perfectly fine[0] versions for Windows--it's what
I use when I'm stuck editing text on the winboxen at work. I think the
GNU website (www.gnu.org) has a pointer to some place or other that has
win binaries if you don't have a C compiler handy.

					Dan

[0] where 'perfectly fine' means 'works just like emacs everwhere else'.
We'll skip any sort of editor war here, thanks.


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

Date: Fri, 08 Oct 1999 13:11:11 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Memory leak in assignment
Message-Id: <P3mL3.13$IZ5.616@news.rdc1.ct.home.com>

Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> [A complimentary Cc of this posting was sent to Dan Sugalski 
> <dan@tuatha.sidhe.org>],
> who wrote in article <8_1L3.80$ck6.12727@news.rdc1.ct.home.com>:
>> > I think there is some discussion of overhead of Perl storage in
>> 
>> >    perldoc perddebug
>> 
>> I'll go you one better. Let's take a look at sv.h:

> Do not if you do not know how .c files threat sv.h.  Your calculations
> are wrong.  Mine are correct.  ;-)

Um, Ilya? I'm well aware of how sv.h gets treated. 

> xiv is a cheating: no storage for xiv_pv and xiv_cur (sp?) is actually
> allocated.  Similarly for xnv.

Now I'm confused. A base sv struct is 12 bytes (assuming 32-bit integers
and 32-bit pointers). An xvpviv struct is 16 bytes making the same
assumptions. An SV holding just an integer has both, for a total of 28 bytes.

Are you saying that somewhere in the source perl cheats and encodes an
integer with just the base sv structure? I can see how this could be done,
by treating the sv_any pointer as an integer, but I can't see *where*
this is done. And I just went prowling through sv.c and most of the
pp*.c code.

If I'm missing something then, by all means, point me to where in the source
this is done. (None of the SV macros that extract the integer bit
of a scalar make any allowances for this, so you'll have to pardon me
if I'm a touch sceptical)

				Dan


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

Date: 8 Oct 1999 11:57:02 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: mkdir... and then!?
Message-Id: <7tkm6e$2ep$1@lublin.zrz.tu-berlin.de>

 <emlyn_a@my-deja.com> wrote in comp.lang.perl.misc:
>I had already done exactly that (with quotes):
>
>open(DATAFILE, ">/users/$NewUser/
>thefile.dat") or die "Cannot create thefile.dat:
>$!";
>
>But it thinks the /users/$NewUser/thefile.dat is
>the name that I want for the file itself, which is
>not the case - It's taking it literally.
>
>I'm using MacPerl, but I KNOW there's no

Oh, here comes the operative word.  The directory separator is
":" on the Mac, not "/", so of course it's taking slashes in the
filename literally.  You should use File::Spec to specify path
names in a portable way.

Anno


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

Date: Fri, 08 Oct 1999 13:11:37 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: mkdir... and then!?
Message-Id: <3802ed24.246443737@news.ford.com>

[poster cc'd in e-mail]

On Thu, 07 Oct 1999 20:35:00 GMT, emlyn_a@my-deja.com wrote:
>I'm using MacPerl, but I KNOW there's no
>difference here

Ding!

As Anno pointed out, the key word here is MacPerl.  Perl doesn't magically
translate pathname separators for you.  For Macs you need a ':' not a '/'.




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

Date: Fri, 08 Oct 1999 10:47:28 GMT
From: Paul D <pdobbs@home.com>
Subject: Oh Yeah!. How to compile Perl to .EXE?
Message-Id: <37FDCC6D.B1264F56@home.com>

The title says it all.
How do I go about compiling from the plain text script to
an EXE that could run on its own, or at least still from the
cgi-bin but with it having "absorbed" all the stuff it needs into
one file (ie: the includes, uses etc).


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

Date: Fri, 08 Oct 1999 13:41:40 GMT
From: jrw32982@my-deja.com
Subject: parenthesizing arguments to grep - BLOCK form
Message-Id: <7tksai$ivj$1@nnrp1.deja.com>

How can I parenthesize the arguments to grep when I'm using the BLOCK
form?

grep BLOCK LIST    works fine
grep(BLOCK LIST)   gives a syntax error

The manual seems to indicate that the arguments to all functions can be
parenthesized.  I believe that the perl parser is interpreting the BLOCK
as an anonymous hash.  How can I force it to recognize a BLOCK?

--
John Wiersba


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


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

Date: Fri, 08 Oct 1999 12:39:09 GMT
From: q2020262 <namecity@my-deja.com>
Subject: Re: Passwords
Message-Id: <7tkolb$g9c$1@nnrp1.deja.com>

Thanks for the help, but will this actually se-up the passwords in
both /etc/passwd and /etc/shadow, as the passwd command does, as I
would prefer to keep my program out of thoe files.  If it does not how
do I encrypt the passwd for /etc/shadow (or was that what you just
explained to me).

Thank you again in advance for any help you may provide

SC


In article <MPG.12668210c41a837f98a055@nntp.hpl.hp.com>,
  lr@hpl.hp.com (Larry Rosler) wrote:
> In article <37FCCBD1.2A346C@dasburo.de> on Thu, 07 Oct 1999 18:35:29
> +0200, Alexander Knack <ak@dasburo.de> says...
> > perldoc -f crypt!
> >
> > my $plain = 'har har 99';
> >
> > my $crypted = crypt ($plain , time());
> > print "$crypted\n";
>
> time() is an extraordinaily poor choice for a 'salt'.  The integral
> value is converted to a string, and the two high-order digits are
used
> to salt the encryption.  These digits are very predictable and change
> rather slowly.  So you are increasing the likelihood of cracking the
> encryption by 4096.
>
> This is from the crypt doc you referred to:
>
> join '', ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64]
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
>


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


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

Date: 8 Oct 1999 10:47:31 GMT
From: fheitka@attglobal.net 
Subject: Re: reading binary data files
Message-Id: <37fdcbc3_3@news1.prserv.net>

Sorry about the duplicate post.  This is my first time
posting to this news group.  I got the newbie message
back that told me to read faqs manpages etc. and thought
that my message was not posted.  I also in the meantime
changed my email address to comply with my "new" ISP.
AT&T Worldnet merged with IBM global network.  If you
find yet another duplicate please forgive that too.  I
may have posted a third time because my address changed
assuming the program that caught my first message was
keying on the email address.

Again sorry.

Fred

Martien Verbruggen <mgjv@comdyn.com.au> wrote:
>On 8 Oct 1999 00:31:20 GMT,
>	fheitka@attglobal.net <fheitka@attglobal.net> wrote:

>> Suppose I have a C program that writes out a
>> binary file using fwrite.  In the files is 

[deleted]


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

Date: Fri, 8 Oct 1999 08:23:45 -0400
From: sleidy_keinSpam_@_bitte_voicencet.com (Samuel)
Subject: Receiving e-Mail Messages via Mail::POP3Client, with MacPerl.
Message-Id: <1dzch5f.1yzenb928za4iN@dialup0225-pri.voicenet.com>

I have written the followoing:

----- Code starts here -----

#!perl #-w              # the Hash is purposely added before '-w'

# First Time attemp to use Mail::POP3 Object Methods.
# 08.10.1999 Samuel J. W. Leidy

use strict;
use Mail::POP3Client;

my ($myUserID) = "USER"; # Enter a valid User ID in place of USER.
my ($myPassword) = "PASS"; #Enter a valid Users Password in place of
PASS.
my ($myPopMail) = "POP"; # Enter a valid POP Mail Account in place of
POP.

my ($pop, $num_Of_Messages, $i, $port, $socket, $state, $user, $pass,
$last, $size, @list);

print ("\nAttempting Connection....");
$pop = Mail::POP3Client->new($myUserID, $myPassword);

    $state = $pop->State;                   # State of Connection.
    print ("\nState of Connection: " . $state . "\n");

$port = $pop->Port;     # Port

$pop->Connect($myPopMail, $port);

    $state = $pop->State;                   # State of Connection.
    print ("\nState of Connection: " . $state . "\n");

#$pop->Login();
#$pop->User($myUserID);
#$pop->Pass($myPassword);

if ($pop->Alive()){

    print ("\nConnection is 'alive'!\n");

    $state = $pop->State;                   # State of Connection.
    print ("State of Connection: " . $state . "\n");

    $num_Of_Messages = $pop->Count; # Number of Messages
    print ("\nNumber of Messages: " . $num_Of_Messages . "\n");

    print ("Port: " . $port . "\n");

    $socket = $pop->Socket;                 # Socket.
    print ("Socket: " . $socket . "\n");

    $user = $pop->User;                 # User.
    print ("User: " . $user . "\n");

    $pass = $pop->Pass;                 # Password.
    print ("Password: " . $pass . "\n");

    $last = $pop->Last;                 # Last Number of Messages.
    print ("Last Number of Messages: " . $last . "\n");

    $size = $pop->Size;                 # Mailbox Size.
    print ("Mailbox Size: " . $size . "\n");

    @list = $pop->List;                 # List Size.
    #print ("List Size: " . $list . " Bytes.\n");

    for ($i = 1; $i <= $num_Of_Messages; $i++){
        foreach ($pop->Head($i)) {
    #       print $_ ."  " if /^(From|Subject)/;
            print $pop->HeadAndBody($i);
        }
        print "\n";
    }
}
else{
    print ("\nConnection was not 'alive'!\n");
    print ("\a");           # Sound the Beep to get Users attention.
}

print ("Finished.\n");

----- Code ends here -----

Results of running the above Code:

----- Results starts here -----

Attempting Connection....
State of Connection: DEAD

Connection is 'alive'!
State of Connection: AUTHORIZATION

Number of Messages: -1
Port: 110
Socket: Mail::POP3Client::SOCK0
User: ----- My User ID is printed correctly here -----
Password: ----- My Password is printed correctly here -----
Last Number of Messages: 
Mailbox Size: -1
Finished.

----- Results ends here -----

As one can see from the 'Source Code' I even tried, and 'commented out':
#$pop->Login();
#$pop->User($myUserID);
#$pop->Pass($myPassword);

Using these Object Methods made not difference.

Question(s):
I have many e-Mail Messages sitting on the Server - so why am I
receiving a 'Number of Messages: -1 Reply?

Am I actually conversing with the Server at all?

What am I obviously missing from the above 'Source Code' to make it
actually work?


Please do not just Reply - try 'MacPerl ListServers'...

-----

System:
Macintosh IIci,
MacOS 7.6.1,
98+ MB RAM,
3 GB+ Storage,

MacPerl:
MacPerl [cfm68k] Version 5.20r4.

Perl Sources:
'Perl 5 for Dummies',
'CGI Programming with Perl 5',
'The PERL CD Bookshelf' - ['Perl in a Nutshell', 'Programming Perl',
'Perl Cookbook', 'Advanced Perl Programming', 'Learning Perl', 'Learning
Perl on Win32 Systems (gag, gag, cough cough - only kidding!)]

-----
 
Any guidance is appreciated, 

Samuel


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

Date: 08 Oct 1999 04:56:01 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: scanning websites
Message-Id: <m1g0zmawxa.fsf@halfdome.holdit.com>

>>>>> "Rolf" == Rolf  <rolftegen@yahoo.com> writes:

Rolf> I have at the moment the following problem:
Rolf> 1. I want to scan all URLs from a website (that is a site with many
Rolf> links)
Rolf> and then
Rolf> 2. to open these scanned pages, to scan the source code to be able to
Rolf> download all GIF-files from there.
Rolf> A friend told me that this isn't possible with a perl script. But I
Rolf> still hope.

Many of my columns at

	http://www.stonehenge.com/merlyn/WebTechniques/

act as "spiders" if you coax them correctly.  Also see WWW::Robot
in the CPAN.

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Fri, 08 Oct 1999 10:25:20 GMT
From: Paul D <pdobbs@home.com>
Subject: UNLINK not working as I'd expect? Clarify Please?
Message-Id: <37FDC73D.67C5F96D@home.com>

Hello fellow insomniacs.

I'm trying to use the unlink function to get rid of all files in
a directory. They all have the extension of .html

Yet NONE of the following ways I have tried deletes the files!
(They are always 8.4 in name size)

unlink ("$ThePath[$counter]" . "*.html");
unlink ("$ThePath[$counter]" . '*.html');
unlink ("$ThePath[$counter]" . "????????.html");
unlink ("$ThePath[$counter]" . '????????.html');

What am I misunderstanding here? So far as I've read (in Perl Annotated
Archives), the * and ? should work just as the would for DOS.. ? is one
charactor, * is any charactor. Help?

Paul


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

Date: Fri, 08 Oct 1999 15:30:23 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
To: Paul D <pdobbs@home.com>
Subject: Re: UNLINK not working as I'd expect? Clarify Please?
Message-Id: <37FDF1EF.FBC85E36@ife.ee.ethz.ch>

Paul D wrote:
> 
> Hello fellow insomniacs.

Why insomniac? it's 15:20 here

> I'm trying to use the unlink function to get rid of all files in
> a directory. They all have the extension of .html
> 
> Yet NONE of the following ways I have tried deletes the files!
> (They are always 8.4 in name size)
> 
> unlink ("$ThePath[$counter]" . "*.html");
> unlink ("$ThePath[$counter]" . '*.html');
> unlink ("$ThePath[$counter]" . "????????.html");
> unlink ("$ThePath[$counter]" . '????????.html');
> 
> What am I misunderstanding here? So far as I've read (in Perl Annotated
> Archives), the * and ? should work just as the would for DOS.. ? is one
> charactor, * is any charactor. Help?

you should have read the documentation for unlink. It doesn't do
wildcards.
the first two of your lines try to remove a file with the name '*.html',
the others remove a file with eight question marks followed by .html

see perldoc -f unlink

system('rm *.html')  calls a shell which does the wildcard expansion and
removes the files.
To use unlink, you first have to get a list of files
unlink glob("*.html");
#see perldoc -f glob
opendir DIR,"." or die;
unlink grep {/\.html$/} readdir DIR;
#see doc for opendir, readdir, grep
unlink <*.html>  #which comes closes to what you tried

- Alex


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

Date: Fri, 08 Oct 1999 13:19:14 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: UNLINK not working as I'd expect? Clarify Please?
Message-Id: <3803ee51.246744159@news.ford.com>

[poster cc'd in e-mail]

On Fri, 08 Oct 1999 10:25:20 GMT, Paul D <pdobbs@home.com> wrote:
>Yet NONE of the following ways I have tried deletes the files!
>(They are always 8.4 in name size)
>
>unlink ("$ThePath[$counter]" . "*.html");
>unlink ("$ThePath[$counter]" . '*.html');
>unlink ("$ThePath[$counter]" . "????????.html");
>unlink ("$ThePath[$counter]" . '????????.html');

Wow.  You're mixing apples and oranges here.  

>What am I misunderstanding here? So far as I've read (in Perl Annotated
>Archives), the * and ? should work just as the would for DOS.. ? is one
>charactor, * is any charactor. Help?

unlink() needs a full pathname, not "wildcards".  Also, you're not
checking to see if the unlink works or why it doesn't.

To get the full pathnames from the "wildcards" you need the glob()
function.  So try something like this (not tested):

# spelled out for clarity...
@files=glob("$ThePath[$counter]*.html");
foreach(@files) {
	unlink $_ or warn "Cannot delete $_: $!";
}



-- 
Clinton A. Pierce       "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org        Miracles."  -- Miracle Max, The Princess Bride
http://www.geeksalad.org


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

Date: 08 Oct 1999 04:53:09 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Use of unitialized value
Message-Id: <m1k8oyax22.fsf@halfdome.holdit.com>

>>>>> "Clinton" == Clinton Pierce <cpierce1@ford.com> writes:

Clinton> It's possible to have a hash with an undefined key.  This is perfectly
Clinton> valid Perl:

Clinton> 	$foo{undef}="stuff";
Clinton> 	exists $foo{undef};  # returns true!

Heh.  That's not doing what you think it is doing.  It's creating a
key of "undef".

	$foo{undef} = "stuff";
	print "yes" if exists $foo{"undef"};

A true key of undef becomes "" instantly:

	$foo{+undef} = "stuff";
	print "yes" if exists $foo{""};

The undef is being treated as an empty string.

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 8 Oct 1999 12:54:04 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: Using a regexp in an index function, can it be done?
Message-Id: <7tkphc$kup$1@rguxd.viasystems.com>

Larry Rosler <lr@hpl.hp.com> wrote:
:>> $_ = 'xyzxyzxyz';
:>> my $pattern = qr{((?:zxy)+)};
:>> if (/$pattern/g) {
:>> 	print pos() - length $1, "\n";
:>> }

:>What is the function of the '+' part of the regex?  Isn't just /(zxy)/ 
:>(as Rick had it) enough?  With the '+' it matches more, so is marginally 
:>slower.

Look at $_.  It contains 'zxyzxy' so the regexp with the + actually
matches 2 of them.  I was just demonstrating that you could have a
quantifier and that what was in $1 was longer than the length of the
plain, unquantified pattern string.  I could have done qr{(z.*y)} and
shown the same thing.  It would have eaten most of the string, but
still it would start at the same place and print 2.

print "pos=", pos(), " matched=$1 start_pos=", pos() - length $1, "\n";

would perhaps have been more informative.

-- 
// Lee.Lindley   /// I used to think that being right was everything.
// @bigfoot.com  ///  Then I matured into the realization that getting
////////////////////   along was more important.  Except on usenet.


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

Date: Fri, 08 Oct 1999 12:22:53 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: We do complex Perl Programming
Message-Id: <xmlL3.1162$QI5.51332@monger.newsread.com>

> We are an E-commerce based company and do any type of complex Perl
> programming in record time.

Wouldn't people rather have simple and elegant Perl programming?

I've done it both ways, and the simple and elegant stuff is a lot
nicer.

Scott


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

Date: Fri, 8 Oct 1999 08:41:29 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: We do complex Perl Programming
Message-Id: <Pine.GSO.4.10.9910080840380.14462-100000@crusoe.crusoe.net>

> > We are an E-commerce based company and do any type of complex Perl
> > programming in record time.
> 
> Wouldn't people rather have simple and elegant Perl programming?
> 
> I've done it both ways, and the simple and elegant stuff is a lot
> nicer.

Agreed.  Hmm, I need to look in the Guinness Book of World Records for
this company.  I didn't know the book had a "Fastest Complex Perl
Programming" entry.

-- 
jeff pinyan    japhy@pobox.com
perl stuff     japhy+perl@pobox.com
CPAN ID: PINYAN            http://www.perl.com/CPAN/authors/id/P/PI/PINYAN



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

Date: Fri, 8 Oct 1999 13:29:29 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: What is THE book for PERL?
Message-Id: <WAkL3.1578$nU4.7106@news1.online.no>


Johnny 'Loopy' Ooi <jjyooi@dcs.qmw.ac.uk> wrote in message
news:37FD9728.257BC43@dcs.qmw.ac.uk...
> Can anyone in the know tell me the _best_ book to read/buy for
research
> and reference into PERL?

If you only want to buy _ONE_ book about Perl, you should buy "The Perl
CD Bookshelf"

http://www.bestbookbuys.com/cgi-bin/bbb.cgi?searchparam=1565924622&searc
htype=ISBN

You'll get "Perl in a Nutshell" in paperback, and "Perl in a Nutshell",
both "Learing Perl 5"s, "Programming Perl 5", "Advanced Perl
Programming" and "The Perl Cookbook" on CD.

--
Trond Michelsen





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

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


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