[17020] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4432 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 26 11:05:29 2000

Date: Tue, 26 Sep 2000 08:05:12 -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: <969980711-v9-i4432@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 26 Sep 2000     Volume: 9 Number: 4432

Today's topics:
    Re: /me bangs head agains't brick wall brianr@liffe.com
        CD-ROM autorun with Perl??? <j_shipley@my-deja.com>
    Re: CD-ROM autorun with Perl??? <amonotod@netscape.net>
    Re: CD-ROM autorun with Perl??? <j_shipley@my-deja.com>
    Re: checking for a valid date-time (Clay Irving)
    Re: Controlling line length read by <> <nico@monnet.to>
    Re: Controlling line length read by <> (Bernard El-Hagin)
    Re: Controlling line length read by <> <nico@monnet.to>
    Re: Controlling line length read by <> (Bernard El-Hagin)
    Re: Controlling line length read by <> <crowj@aol.com>
    Re: Controlling line length read by <> (Bernard El-Hagin)
    Re: Controlling line length read by <> <nico@monnet.to>
    Re: Controlling line length read by <> <godzilla@stomp.stomp.tokyo>
    Re: Converting urls - the other way! <ralawrence@my-deja.com>
    Re: crontab, perl, oracle query <olthoff@multiboard.com>
        DBI::ProxyServer and mysql ? <ntw6maja@fht-esslingen.de>
    Re: DBI::ProxyServer and mysql ? <anders@wall.alweb.dk>
    Re: determine where visitors are "living" <flavell@mail.cern.ch>
        Freeware Perl compiler for Windows? <glynFOOdwr@FSCKdeleteEmeD.co.uk>
    Re: freeware perl script to binary... nobull@mail.com
    Re: freeware perl script to binary... <bmb@ginger.libs.uga.edu>
    Re: Halloween Fun <amonotod@netscape.net>
        Help with Time::localtime <wongjonk@hotmail.com>
    Re: Help with Time::localtime nobull@mail.com
    Re: Help with Time::localtime <nico@monnet.to>
        How can I combine regular expressions? (Philip Lees)
    Re: How can I combine regular expressions? <jeffp@crusoe.net>
        inserting a binary scalar into a DBI blob <xeno@bigger.aa.net>
        Memory Mapped Files <fb@geo-guide.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 26 Sep 2000 13:34:15 +0100
From: brianr@liffe.com
Subject: Re: /me bangs head agains't brick wall
Message-Id: <vtlmwfib7c.fsf@liffe.com>

"CJ Llewellyn" <darryl@work-thicker.co.uk> writes:

> I remembered the actual reason I didn't want to use find, I wanted a
> list/hash of files and directories to ignore such tmp/ or data/ and .xvpic/
> (a directory created by gimp wherever you edit pics).

Not sure I agree with you there. All you need to add to the sub you
pass to find is something like:

$File::Find::prune = 1 if -d and /^(tmp)|(data)|(\.xvpic)$/;

Although I would agree that some of the features like this could bear
more detailed explanation.

-- 
Brian Raven
: I could understand principles of Perl source in 2-3 days [. . .]

Gee, it took me about eleven years.  :-)
             -- Larry Wall in <199806200201.TAA22277@wall.org>


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

Date: Tue, 26 Sep 2000 13:27:09 GMT
From: Jeff <j_shipley@my-deja.com>
Subject: CD-ROM autorun with Perl???
Message-Id: <8qq86k$grk$1@nnrp1.deja.com>

Yup, that is right.  My boss claims that an autorun can be written in
Perl for a cd-rom.  My better judgement/intution says "no".  Admittedly
I am not a Perl genius so I am not a 100% certain.

Could someone just give me a yes or a no on this one please?

Thanks.

J.


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


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

Date: Tue, 26 Sep 2000 14:03:17 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: CD-ROM autorun with Perl???
Message-Id: <8qqaal$jc0$1@nnrp1.deja.com>

In article <8qq86k$grk$1@nnrp1.deja.com>,
  Jeff <j_shipley@my-deja.com> wrote:
> Yup, that is right.  My boss claims that an autorun can be written in
> Perl for a cd-rom.  My better judgement/intution says "no".
> Admittedly I am not a Perl genius so I am not a 100% certain.
>
> Could someone just give me a yes or a no on this one please?
I can do both...  Yes and no.  Yes, it can be done, but not as a script.
You would have to compile it into an .exe file.  See the PDK at
www.activestate.com.

amonotod

--
    `\|||/                     amonotod@
      (@@)                     netscape.net
  ooO_(_)_Ooo________________________________
  _____|_____|_____|_____|_____|_____|_____|_____|


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


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

Date: Tue, 26 Sep 2000 14:06:23 GMT
From: Jeff <j_shipley@my-deja.com>
Subject: Re: CD-ROM autorun with Perl???
Message-Id: <8qqage$jm1$1@nnrp1.deja.com>

The double-sided response makes perfect sense to me and was just the
response I was looking for.

Thanks amonotod for the reply -- and the link!  :)

J.

In article <8qqaal$jc0$1@nnrp1.deja.com>,
  amonotod <amonotod@netscape.net> wrote:
> In article <8qq86k$grk$1@nnrp1.deja.com>,
>   Jeff <j_shipley@my-deja.com> wrote:
> > Yup, that is right.  My boss claims that an autorun can be written
in
> > Perl for a cd-rom.  My better judgement/intution says "no".
> > Admittedly I am not a Perl genius so I am not a 100% certain.
> >
> > Could someone just give me a yes or a no on this one please?
> I can do both...  Yes and no.  Yes, it can be done, but not as a
script.
> You would have to compile it into an .exe file.  See the PDK at
> www.activestate.com.
>
> amonotod
>
> --
>     `\|||/                     amonotod@
>       (@@)                     netscape.net
>   ooO_(_)_Ooo________________________________
>   _____|_____|_____|_____|_____|_____|_____|_____|
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


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


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

Date: 26 Sep 2000 12:08:35 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: checking for a valid date-time
Message-Id: <slrn8t14e3.ngu.clay@panix3.panix.com>

On Mon, 25 Sep 2000 23:21:26 +0900, Dan and Shelly 
<wedeking@msa.attmil.ne.jp> wrote:

>Does anyone know a better way than this:
>
>start:
>$a = <STDIN>;
>chomp($a);
>if ("$a" =~ /(\d{2})(\d{2})(\d{2})/) {
> $days = $1;
> $hours = $2;
> $minutes = $3;
>} else { print "$a isn't valid.\n" }
>
>if ($days < 32 && $hours < 24 && $minutes < 60) {
> print "$a is valid\n";
>} else { print "$a isn't valid\n" }
>goto start

Perl modules are your friend.

  #!/usr/local/bin/perl -w
  
  use Time::ParseDate;
  
  while ($time = <DATA>) {
      chomp $time;
      $epoch_seconds = parsedate("$time", VALIDATE => 1);
      if (! $epoch_seconds) {
          print "$time is invalid\n";
      }
  }
  
  
  __DATA__
  12:00:00
  01:52:45
  25:15:00
  04:61:00
  15:05:64

prints:

  25:15:00 is invalid
  04:61:00 is invalid
  15:05:64 is invalid

-- 
Clay Irving <clay@panix.com>
Ah, but a man's reach should exceed his grasp 
- or what's a heaven for? -- Robert Browning 


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

Date: Tue, 26 Sep 2000 13:19:14 +0100
From: "Nicolas MONNET" <nico@monnet.to>
Subject: Re: Controlling line length read by <>
Message-Id: <lJ%z5.171$My3.4130@tengri.easynet.fr>

What the fuck was bernard.el-hagin@lido-tech.net (Bernard El-Hagin) trying
to say:
> 
> Hi,
> 
> 	Is it possible to make the <> ignore lines which contain more than
> an arbitrary amount of characters when reading a file (or any other
> source of data)?
> 
> Regards, Bernard
> --
> perl -le 'open JustAnotherPerlHacker,""or$_="B$!e$!r$!n$!a$!r$!d$!";
> print split/No such file or directory/;'

perlfoc -f substr

- or -

perldoc -f read

-- 
perl -e 'print `echo Just a Lame Perl Luser | gzip -9 | cat | gzip -cd`'



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

Date: 26 Sep 2000 11:35:14 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Controlling line length read by <>
Message-Id: <slrn8t12fh.en.bernard.el-hagin@gdndev25.lido-tech>

On Tue, 26 Sep 2000 13:19:14 +0100, Nicolas MONNET <nico@monnet.to> wrote:
>What the fuck was bernard.el-hagin@lido-tech.net (Bernard El-Hagin) trying
>to say:
>> 
>> Hi,
>> 
>> 	Is it possible to make the <> ignore lines which contain more than
>> an arbitrary amount of characters when reading a file (or any other
>> source of data)?
>> 
>> Regards, Bernard
>> --
>> perl -le 'open JustAnotherPerlHacker,""or$_="B$!e$!r$!n$!a$!r$!d$!";
>> print split/No such file or directory/;'
>
>perlfoc -f substr

I think substr would require the whole line to be known so it would
still read an entire line (I could be wrong), but...

>- or -
>
>perldoc -f read

 ...this looks like what I'm looking for. Thanks very much.

Cheers,
Bernard
--
perl -le 'open JustAnotherPerlHacker,""or$_="B$!e$!r$!n$!a$!r$!d$!";
print split/No such file or directory/;'


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

Date: Tue, 26 Sep 2000 15:12:55 +0100
From: "Nicolas MONNET" <nico@monnet.to>
Subject: Re: Controlling line length read by <>
Message-Id: <Xn1A5.9$S3.790@tengri.easynet.fr>

What the fuck was bernard.el-hagin@lido-tech.net (Bernard El-Hagin) trying
to say:

>>perlfoc -f substr
> 
> I think substr would require the whole line to be known so it would
> still read an entire line (I could be wrong), but...
> 
>>- or -
>>
>>perldoc -f read
> 
> ...this looks like what I'm looking for. Thanks very much.

 .. if you only want to read one line

On the next 'read' you will not get the beginning of the next line,
you'll get the rest of the line ...

-- 
perl -e 'print `echo Just a Lame Perl Luser | gzip -9 | cat | gzip -cd`'



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

Date: 26 Sep 2000 13:22:56 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Controlling line length read by <>
Message-Id: <slrn8t18pf.en.bernard.el-hagin@gdndev25.lido-tech>

On Tue, 26 Sep 2000 15:12:55 +0100, Nicolas MONNET <nico@monnet.to> wrote:
>What the fuck was bernard.el-hagin@lido-tech.net (Bernard El-Hagin) trying
>to say:
>
>>>perlfoc -f substr
>> 
>> I think substr would require the whole line to be known so it would
>> still read an entire line (I could be wrong), but...
>> 
>>>- or -
>>>
>>>perldoc -f read
>> 
>> ...this looks like what I'm looking for. Thanks very much.
>
>.. if you only want to read one line
>
>On the next 'read' you will not get the beginning of the next line,
>you'll get the rest of the line ...

That's right. And that's a problem I ran into when toying with 'read'
just now. Is there any way to read only n-bytes of each line read by <>?

Cheers,
Bernard
--
perl -le 'open JustAnotherPerlHacker,""or$_="B$!e$!r$!n$!a$!r$!d$!";
print split/No such file or directory/;'


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

Date: Tue, 26 Sep 2000 10:00:02 -0400
From: John Crowley <crowj@aol.com>
Subject: Re: Controlling line length read by <>
Message-Id: <39D0ABE2.36F69CF5@aol.com>



Bernard El-Hagin wrote:
> 
> Hi,
> 
>         Is it possible to make the <> ignore lines which contain more than
> an arbitrary amount of characters when reading a file (or any other
> source of data)?
> 
> Regards,
> Bernard
> --
> perl -le 'open JustAnotherPerlHacker,""or$_="B$!e$!r$!n$!a$!r$!d$!";
> print split/No such file or directory/;'

my $MAX=1024; # kbyte

while (<>) {

  next if length > $MAX;

  # otherwise process the line

}


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

Date: 26 Sep 2000 14:20:01 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Controlling line length read by <>
Message-Id: <slrn8t1c4f.en.bernard.el-hagin@gdndev25.lido-tech>

On Tue, 26 Sep 2000 10:00:02 -0400, John Crowley <crowj@aol.com> wrote:
>
>
>Bernard El-Hagin wrote:
>> 
>> Hi,
>> 
>>         Is it possible to make the <> ignore lines which contain more than
>> an arbitrary amount of characters when reading a file (or any other
>> source of data)?
>> 
>> Regards,
>> Bernard
>> --
>> perl -le 'open JustAnotherPerlHacker,""or$_="B$!e$!r$!n$!a$!r$!d$!";
>> print split/No such file or directory/;'
>
>my $MAX=1024; # kbyte
>
>while (<>) {
>
>  next if length > $MAX;
>
>  # otherwise process the line
>
>}

Obviously that's not what I'm looking for. I want to entirely skip lines
which are too long to avoid my program chocking if someone tries to pass
it 100MB in one line (extreme example, I admit :-)

Cheers,
Bernard
--
perl -le 'open JustAnotherPerlHacker,""or$_="B$!e$!r$!n$!a$!r$!d$!";
print split/No such file or directory/;'


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

Date: Tue, 26 Sep 2000 16:30:29 +0100
From: "Nicolas MONNET" <nico@monnet.to>
Subject: Re: Controlling line length read by <>
Message-Id: <Fw2A5.21$S3.867@tengri.easynet.fr>

What the fuck was bernard.el-hagin@lido-tech.net (Bernard El-Hagin) trying
to say:

> Obviously that's not what I'm looking for. I want to entirely skip lines
> which are too long to avoid my program chocking if someone tries to pass
> it 100MB in one line (extreme example, I admit :-)


Now I understand what you want to do, and it's basically
impossible: to figure how long a line is, perl has to read 
it before hand. This would be possible, however, with some
Unicode text format where lines are prefixed with their
length (if I remember properly); in that case you could 
write a program that would seek to the next line.



-- 
perl -e 'print `echo Just a Lame Perl Luser | gzip -9 | cat | gzip -cd`'



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

Date: Tue, 26 Sep 2000 07:48:48 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Controlling line length read by <>
Message-Id: <39D0B750.740AC092@stomp.stomp.tokyo>

Bernard El-Hagin wrote:
 
> John Crowley wrote:
> Others wrote:

> > Bernard El-Hagin wrote:


This Article:

> > > Is it possible to make the <> ignore lines which contain more than
> > > an arbitrary amount of characters when reading a file (or any other
> > > source of data)?

> Obviously that's not what I'm looking for. I want to entirely skip lines
> which are too long to avoid my program chocking if someone tries to pass
> it 100MB in one line (extreme example, I admit :-)


Different Article:

> On the next 'read' you will not get the beginning of the next line,
> you'll get the rest of the line ...

> > > That's right. And that's a problem I ran into when toying with 'read'
> > > just now. Is there any way to read only n-bytes of each line read by <>?


(Parameters Changed In Other Articles)



You have changed your parameters a number of times
within this thread and parallel threads. Do you 
know what you want to do? What you want to do,
what method is used, makes a difference.

Consider making a decision as to what you want
to do and, stick with this decision. This will
help you to avoid annoying those who would help
you, by your constantly changing your parameters.

Constantly changing your parameters, asking a
question and responding with argument, 
smacks of trolling.


Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class



TEST SCRIPT:
____________


#!/usr/local/bin/perl

print "Content-type: text/plain\n\n";


print "Input:\n\n";

open (TEST, "test.txt");

while (<TEST>)
 { print $_; }

close (TEST); 


print "\n\nLength Method:\n\n";

open (TEST, "test.txt");

while (<TEST>)
 {
  if (length ($_) <= 17)
   { print $_; }
 }

close (TEST);


print "\n\nSubstring Method:\n\n";

open (TEST, "test.txt");

while (<TEST>)
 {
  $_ = substr ($_, 0, 16);
  print "$_\n";
 }

close (TEST);


exit;


PRINTED RESULTS:
________________


Input:

read this line 1 no
read this line 2
read this line 3 no
read this line 4
read this line 5 no


Length Method:

read this line 2
read this line 4


Substring Method:

read this line 1
read this line 2
read this line 3
read this line 4
read this line 5


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

Date: Tue, 26 Sep 2000 14:52:00 GMT
From: Richard Lawrence <ralawrence@my-deja.com>
Subject: Re: Converting urls - the other way!
Message-Id: <8qqd66$mvu$1@nnrp1.deja.com>

In article <slrn8suuji.cn0.rgarciasuarez@rafael.kazibao.net>,
  rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
> Richard Lawrence wrote in comp.lang.perl.misc:
> >
> >However converting something back (ie. from "hello there" to "hello%
> >20there") has me stuck. Can anyone help?
>
> Use the URI::Escape module.
>

Thanks!

Unfortunately my server doesn't have that and i'm not able to get it
installed.

Is there an alternative without having to use this module?

Rich


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


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

Date: Tue, 26 Sep 2000 09:50:46 -0400
From: "Darryl Olthoff" <olthoff@multiboard.com>
Subject: Re: crontab, perl, oracle query
Message-Id: <8qq9jo$pg9$1@panther.uwo.ca>

> Any ideas?

Yeah, show us some code.




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

Date: Tue, 26 Sep 2000 16:29:14 +0200
From: Matthias Jaekle <ntw6maja@fht-esslingen.de>
Subject: DBI::ProxyServer and mysql ?
Message-Id: <39D0B2BA.97EAF99D@fht-esslingen.de>

Hello,

I have some difficulties to run the DBI::ProxyServer
together with mysql.
I allways get the message: missing hostname.

For testing, I have running the Proxy, mysql and the
client on the same computer (134.108.35.70) under Linux.

What I do ist the following: First I start
dbiproxy --debug -logfile /var/log/dbiproxy -localport 3000

and after that I execute the following Perl code:

use DBI; 
$user     = "mysqluser";
$password = "mysqlpassword";
# running version without proxy
# my $dsn = "DBI:mysql:database=$db;host=$host";

# dsn code for proxy
my $dsn =
'DBI:Proxy:134.108.35.70;port=3000;dsn=DBI:mysql:database=veran;host=134.108.35.70';

my $dbh = DBI->connect($dsn,$user,$password) or die $DBI::errstr;

The result of all these ist that the client report:
DBI->connect(134.108.35.70;port=3000;dsn=DBI:mysql:database=veran;host=134.108.35.70)
failed:  Missing hostname.

So, what do I make wrong ?

Many thanks for your help
Bye
Matthias Jaekle


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

Date: Tue, 26 Sep 2000 16:50:29 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: DBI::ProxyServer and mysql ?
Message-Id: <0K2A5.2699$T3.130728@news000.worldonline.dk>

Matthias Jaekle wrote:

> Hello,
> 
> I have some difficulties to run the DBI::ProxyServer
> together with mysql.
> I allways get the message: missing hostname.
> 
> For testing, I have running the Proxy, mysql and the
> client on the same computer (134.108.35.70) under Linux.
> 
> What I do ist the following: First I start
> dbiproxy --debug -logfile /var/log/dbiproxy -localport 3000
> 
> and after that I execute the following Perl code:
> 
> use DBI;
> $user     = "mysqluser";
> $password = "mysqlpassword";
> # running version without proxy
> # my $dsn = "DBI:mysql:database=$db;host=$host";
> 
> # dsn code for proxy
> my $dsn =
> 
'DBI:Proxy:134.108.35.70;port=3000;dsn=DBI:mysql:database=veran;host=134.108.35.70';
> 
'DBI:Proxy:134.108.35.70;port=3000;dsn=DBI:mysql:database=veran;host=134.108.35.70';
> 
> my $dbh = DBI->connect($dsn,$user,$password) or die $DBI::errstr;
> 
> The result of all these ist that the client report:
> 
DBI->connect(134.108.35.70;port=3000;dsn=DBI:mysql:database=veran;host=134.108.35.70)
> 
DBI->connect(134.108.35.70;port=3000;dsn=DBI:mysql:database=veran;host=134.108.35.70)
> failed:  Missing hostname.
> 
> So, what do I make wrong ?
> 
> Many thanks for your help
> Bye
> Matthias Jaekle
I don't know about the proxy, but it seems that
host=localhost
would be a shot??

-anders
-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Tue, 26 Sep 2000 13:15:55 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: determine where visitors are "living"
Message-Id: <Pine.GHP.4.21.0009261309460.17922-100000@hpplus03.cern.ch>

On Tue, 26 Sep 2000, Craig Berry wrote:

>  If a good guess can often help and a bad guess usually doesn't hurt 

that's a fair comment...

> (like Akamai's trick of routing
> browsers to 'nearby' caching servers), this can pay off.

But for _that_ kind of application, you couldn't care less where the
user is physically located.  You're only looking for network-nearness,
and that can be quite different from geography.  Network-nearness can
be measured (by number of hops, by RTT, etc.) (modulo the effects of
QoS or diff.serv. measures, but this goes way off-topic so I'll stop
there).

cheers



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

Date: Tue, 26 Sep 2000 15:39:13 +0100
From: "Glyndwr" <glynFOOdwr@FSCKdeleteEmeD.co.uk>
Subject: Freeware Perl compiler for Windows?
Message-Id: <nw2A5.897$616.12327@news6-win.server.ntlworld.com>

The thread about a Perl compiler for Unix has reminded me to get around to
looking for a Win32 Perl compiler, for all my Windoze friends who want to
delight at my scripts but not install the interpreter (they're odd like
that).

I've come across ActiveState's PDK and Perl2EXE, but they have the distinct
disadvantage (for a poor student) of costing money. Any one know of any
freeware ones? I didn't turn anything up on a web search, so I suspect it's
a long shot, but I thought I'd ask.

TIA.

--
                                           -=G=-
print join " ",reverse split /\s+/,'hacker. Perl another Just',"\n";
Web: http://www.fscked.co.uk                             ICQ: 66545073




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

Date: 26 Sep 2000 12:04:55 +0100
From: nobull@mail.com
Subject: Re: freeware perl script to binary...
Message-Id: <u9zokv76so.fsf@wcl-l.bham.ac.uk>

rgarciasuarez@free.fr (Rafael Garcia-Suarez) writes:

> Paul Spandler wrote in comp.lang.perl.misc:
> >
> >I want to convert perl scripts into binaries (basically to hide the
> >script source in a chrooted environment.)
> 
> perldoc -q source ==>
> 
> =head2 How can I hide the source for my Perl program?
> 
> [...]
> If your program does insecure things, and relies on people not knowing
> how to exploit those insecurities, it is not secure.
> [...]

The FAQ fails to mention the obvious:

chgrp somegroup script
chmod g+s,o-r script

This may or may not work depending on how SUID/SGID scripts are
implemented on your system.

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


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

Date: Tue, 26 Sep 2000 10:29:19 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: freeware perl script to binary...
Message-Id: <Pine.A41.4.21.0009261027400.11972-100000@ginger.libs.uga.edu>

> Abigail wrote:
> > 
> > Paul Spandler (p.m.spandler@bton.ac.uk) wrote
> > == I'm looking for a freeware unix perl to executable file converter.
> > 
> > chmod, which can be found at: <ftp://ftp.gnu.org/gnu/fileutils/>, and
> > runs on more Unices than you can think of.

On Tue, 26 Sep 2000, Paul Spandler wrote:

> Oops, sorry...maybe I should have explained myself better!
> 
> I want to convert perl scripts into binaries (basically to hide the
> script source in a chrooted environment.)
> 
> Thanks
> 
> Paul

I think Abigail understood you very well.  You can't afford $149?

Brad



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

Date: Tue, 26 Sep 2000 13:55:52 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: Halloween Fun
Message-Id: <8qq9ss$in1$1@nnrp1.deja.com>

In article <39D034B6.41412047@stomp.stomp.tokyo>,
  "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> jtjohnston wrote:
>
> > I need a date function based on my server's time/date.
>
> Have you tried localtime () function? Usually this
> works well to pull your date/time stamp.
>
> > I've fooled around with this and cannot put together what I want. If
> > someone could pass along a couple of lines of code, it would be much
> > appreciated. I don't seem to have enough to hack into?? Real newbie
> > question, but ... blah blah :)
>
> (snipped eye candy code)
>
> Visually pretty code. Nice article and all.
> However you forgot something of importance,
> your question.
>
> What is your question?
>

He wanted to know if there were any really incompetent, idiototic,
wanna-be programmers with a supposed mastery of English and inferred
references out there, able to read his post and not get a thing from it.
Guess who responded with a no-content answer?

> Godzilla!

amonotod

--
    `\|||/                     amonotod@
      (@@)                     netscape.net
  ooO_(_)_Ooo________________________________
  _____|_____|_____|_____|_____|_____|_____|_____|


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


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

Date: Tue, 26 Sep 2000 18:19:07 +0800
From: "Jonathan Wong" <wongjonk@hotmail.com>
Subject: Help with Time::localtime
Message-Id: <8qptde$1ls$1@horn.hk.diyixian.com>

Hi all,

I have a small problem with time. I wrote in my script:

use Time::localtime;
$now = localtime;

I can access the year/month/day values by using $now->mon, etc.....

My problem is that I need them for the day after and the day before today!!
$now->mday +1 won't work during month end and month beginning.

How can I achieve that???

Thanks for answering this small stupid problem!!!


Jonathan






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

Date: 26 Sep 2000 12:07:56 +0100
From: nobull@mail.com
Subject: Re: Help with Time::localtime
Message-Id: <u9ya0f76nn.fsf@wcl-l.bham.ac.uk>

"Jonathan Wong" <wongjonk@hotmail.com> writes:

> use Time::localtime;
> $now = localtime;
> 
> I can access the year/month/day values by using $now->mon, etc.....
> 
> My problem is that I need them for the day after and the day before today!!
> $now->mday +1 won't work during month end and month beginning.

The obvious (but flawed) solution is:

$today = localtime;
$yesterday = localtime(time - 86400);
$tomorrow = localtime(time + 86400);

This will not work before 01:00 on the day after or after 23:00 on the
day before the Spring daylight saving transition. Nor will it work
before 01:00 or after 23:00 on the day of the Fall transition.  At all
other times it works.

The fix for that is:

use Time::localtime;
$now = time;
$today = localtime($time);
$noonish = $time - $today->hour * 3600 + 43200;
$yesterday = localtime($noonish - 86400);
$tomorrow = localtime($noonish + 86400);

print "Yesterday was day ",$yesterday->mday," of the month\n"; 
print "Tomorrow will be day ",$tomorrow->mday," of the month\n"; 

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


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

Date: Tue, 26 Sep 2000 13:23:14 +0100
From: "Nicolas MONNET" <nico@monnet.to>
Subject: Re: Help with Time::localtime
Message-Id: <5N%z5.172$My3.4316@tengri.easynet.fr>

What the fuck was "Jonathan Wong" <wongjonk@hotmail.com> trying to say:
> Hi all,
> 
> I have a small problem with time. I wrote in my script:
> 
> use Time::localtime;
> $now = localtime;
> 
> I can access the year/month/day values by using $now->mon, etc.....
> 
> My problem is that I need them for the day after and the day before
> today!!
> $now->mday +1 won't work during month end and month beginning.
> 
> How can I achieve that???
> 
> Thanks for answering this small stupid problem!!!

Not sure about that Time::localtime thing, but what about
initialising $tomorrow to time+60*60*24 

And fuck, what about this crosspost.

-- 
perl -e 'print `echo Just a Lame Perl Luser | gzip -9 | cat | gzip -cd`'



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

Date: Tue, 26 Sep 2000 12:18:34 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: How can I combine regular expressions?
Message-Id: <39d091f2.82037533@news.grnet.gr>

Hi. I've written a routine that transliterates Greek text into English
(used for converting names, addresses, etc.). Sometimes, one Greek
letter becomes two English letters (e.g. theta -> th or TH).

When one of these is at the start of a word I need to match the case
of the second letter in the pair with that of the following character.
These lines do the trick (for Greek letters chi, theta and psi, in
case you're interested).

$line =~ s/\bCH([a-z]|\W)/Ch$1/g;	# adjust case of second letter

$line =~ s/\bTH([a-z]|\W)/Th$1/g;	# if followed by lower case
$line =~ s/\bPS([a-z]|\W)/Ps$1/g;	# letter or non-word character

Is there any way I can combine these into just one glorious, Perlish,
obfuscated expression?

By the way, I'm becoming increasingly impressed by the awesome power
of Perl for these tasks. The above lines of code replace a whole
string of nested IF blocks within a loop that were needed in the
language the routine was originally written in.

TIA.

Phil
--
Philip Lees
ICS-FORTH, Heraklion, Crete, Greece
Ignore coming events if you wish to send me e-mail
'The aim of high technology should be to simplify, not complicate' - Hans Christian von Baeyer


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

Date: Tue, 26 Sep 2000 08:54:15 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: How can I combine regular expressions?
Message-Id: <Pine.GSO.4.21.0009260840500.5957-100000@crusoe.crusoe.net>

[posted & mailed]

On Sep 26, Philip Lees said:

>$line =~ s/\bCH([a-z]|\W)/Ch$1/g;	# adjust case of second letter
>$line =~ s/\bTH([a-z]|\W)/Th$1/g;	# if followed by lower case
>$line =~ s/\bPS([a-z]|\W)/Ps$1/g;	# letter or non-word character
>
>Is there any way I can combine these into just one glorious, Perlish,
>obfuscated expression?

Sure.  These regexes all have a common start and finish:

  $line =~ s/\b(MAGIC1)([a-z]|\W)/MAGIC2/g;

Now we just need to figure out what the magic is.  MAGIC1 is just an
alternation of all the possible two-character combos you're going to deal
with:  (AL|BE|GA|DE|EP|...).  MAGIC2 will be whatever $1 matched, with the
second character lowercase.  To attain this, we use the \u and \L
escape.  \L changes everything to lowercase, and \u changes the next
character to uppercase.

  $line =~ s/\b(AL|BE|GA|DE|EP)([a-z]|\W)/\u\L$1\E$2/g;

The \E is for ending the effect of \L.  Now, I'd make one more
optimization.  Don't save ([a-z]|\W), just make sure it COULD match:

  $line =~ s/\b(AL|BE|GA|DE|EP)(?=[a-z]|\W)/\u\L$1/g;

That time, I used the (?=) positive look-ahead assertion.  It basically
says "without ACTUALLY advancing where we are, COULD we match this?"

So there's your nice regex.  Read 'perlre' to learn more about it.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/



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

Date: 26 Sep 2000 07:06:54 -0600
From: Xeno Campanoli <xeno@bigger.aa.net>
Subject: inserting a binary scalar into a DBI blob
Message-Id: <39d0ad7e$1_3@huge.aa.net>

I'm stumped this morning as to how to assign a binary Perl
Perl scalar into an Oracle blob through the DBI interface.
It complains whether or not I use $dbh->quote, and I cannot
seem to find any other facility in the Perldoc DBI documentation.
I'd expect a call like $dbh->binary($binarythingy) I suppose,
but perhaps that's too easy.  Thanks in advance for any feedback.

Sincerely, Xeno

-- 
Xeno Campanoli (erstwhile Xeno Whitenack, and Rick Burgess)
Email:	xeno@aa.net	(Web pages:  http://www.aa.net/~xeno)


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

Date: Tue, 26 Sep 2000 13:50:13 +0200
From: "Frode Bjerkholt" <fb@geo-guide.com>
Subject: Memory Mapped Files
Message-Id: <K10A5.238$o9.3212@news1.online.no>

Hi :-)

Is there a module out there, that handles memory mapped files on Linux?
In addition it have to support read only access by mulitple
processes/threads at the same time.

Thanks in advance :-)

Frode Bjerkholt




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

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


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