[24104] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6298 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 24 18:05:39 2004

Date: Wed, 24 Mar 2004 15:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 24 Mar 2004     Volume: 10 Number: 6298

Today's topics:
    Re: Comparing 2 date/times? <mr@sandman.net>
    Re: Comparing 2 date/times? <mr@sandman.net>
    Re: dollar sign and spaces from a string <mr@sandman.net>
    Re: FIFO problem - yet another .sig rot script... <bik.mido@tiscalinet.it>
    Re: File traversing <tadmc@augustmail.com>
        Getopts and use strict problem (R. Raghuraman)
    Re: Getopts and use strict problem (Walter Roberson)
    Re: Getopts and use strict problem (Anno Siegel)
    Re: Getopts and use strict problem <xx087@freenet.carleton.ca>
    Re: Getopts and use strict problem <uri.guttman@fmr.com>
    Re: Getopts and use strict problem (Anno Siegel)
    Re: Getopts and use strict problem <uri.guttman@fmr.com>
    Re: graph smoothing... <gls@byu.edu>
    Re: HashFromString <tadmc@augustmail.com>
    Re: Help with NET::Inet <wendywds@hotmail.com>
        how to remove hash from a GLOB?? <newsserv@advercast.com>
    Re: how to remove hash from a GLOB?? (Anno Siegel)
    Re: how to remove hash from a GLOB?? <newsserv@advercast.com>
    Re: how to remove hash from a GLOB?? (Anno Siegel)
    Re: Perl web Link Checker <david@tvis.co.uk>
    Re: Removing folders recursively <dwall@fastmail.fm>
    Re: Removing folders recursively (Anno Siegel)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 24 Mar 2004 22:16:25 +0100
From: Sandman <mr@sandman.net>
Subject: Re: Comparing 2 date/times?
Message-Id: <mr-2E206E.22162524032004@news.fu-berlin.de>

In article <qq28c.123593$IF6.4184964@ursa-nb00s0.nbnet.nb.ca>,
 "Brett Baisley" <baisley@hotmail.com.REMOVETHIS> wrote:

> Hello
> 
> I need help with a Perl app. I get a datetime value from a mySQL table and I
> need to compare that date/time with the current time.

MySQL has some really good time comparing functions in itself. Go to 
www.mysql.com and read the online documentation about Date and Time functions.

> I use localtime in perl to get the current time, but then the two are not
> formatted the same. What is the best method to do this?

The module Date::ManIp is probably the most comprehensive date and time 
manipulation tool for perl and it could probably do everything you want. It 
might be overkill, though.

-- 
Sandman[.net]


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

Date: Wed, 24 Mar 2004 22:35:21 +0100
From: Sandman <mr@sandman.net>
Subject: Re: Comparing 2 date/times?
Message-Id: <mr-DCB7CD.22352124032004@news.fu-berlin.de>

In article <slrnc61dnf.9k9.xx087@smeagol.ncf.ca>,
 Glenn Jackman <xx087@freenet.carleton.ca> wrote:

> >  Hello
> >  
> >  I need help with a Perl app. I get a datetime value from a mySQL table and 
> >  I
> >  need to compare that date/time with the current time.
> >  
> >  I use localtime in perl to get the current time, but then the two are not
> >  formatted the same. What is the best method to do this?
> 
> fetch the date from mysql in seconds since the epoch -- use the
> UNIX_TIMESTAMP() function:
>     select UNIX_TIMESTAMP(dateField) from ...

While MySQL has some kickass date and time functions, the above might fail 
sometimes and all the time in some cases.

The epoch always has a start date, and depending on whether your system has 
support for negative integer (or whatever the actual techniccal term is) the 
lowest possible date is either in 1970 or 1904 (generally).

Now, with linux redhat 8, this will work:

mysql> select unix_timestamp('1980-11-23');
+------------------------------+
| unix_timestamp('1980-11-23') |
+------------------------------+
|                    343782000 |
+------------------------------+

But this won't:

mysql> select unix_timestamp('1950-11-23');
+------------------------------+
| unix_timestamp('1950-11-23') |
+------------------------------+
|                            0 |
+------------------------------+

And this will never work in any system running MySQL:

mysql> select unix_timestamp('1750-11-23');
+------------------------------+
| unix_timestamp('1750-11-23') |
+------------------------------+
|                            0 |
+------------------------------+


If you're going to use dates before the unix epoch, you have to use a tool that 
will support it, which rules out MySQL. For Perl, there is Date::Manip that 
will handle just about anything:

#!/usr/bin/perl
use Date::Manip;
use strict;
use warnings;

my $date = UnixDate("1750-11-23", "%s");
print $date;

__END__
Output: -6914336400

For PHP there is the adodb-package that has special functions to replace the 
php fucntions.

-- 
Sandman[.net]


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

Date: Wed, 24 Mar 2004 22:13:01 +0100
From: Sandman <mr@sandman.net>
Subject: Re: dollar sign and spaces from a string
Message-Id: <mr-042D3F.22130124032004@news.fu-berlin.de>

In article <c3rkdn$prg$1@mamenchi.zrz.TU-Berlin.DE>,
 anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:

> > I understand all of this
> 
> So you say, but your words show you don't.

Then you misread them. That happens.

> > (and have used pretty much the same wording 
> > myself in 
> > the past) but it is important to understand that this negative spiral does 
> > in 
> 
> I have described a control loop, you're talking of a negative spiral.

Different words, same concept.

> The concepts are exact opposites.  A control loop steers a system towards
> an equilibrium, an negative spiral steers it away from an equilibrium.
> What we have here is *not* a negative spiral.

Then you don't understand the difference in our point of views. You described 
it as a loop that went downwards with the number of newbies and upwards when 
there are fewer nebies. That downward motion is what I call a negative spiral. 
You are free to disagree with it being a negative spiral, but that doesn't mean 
it's an inappropriate titel for me to attach to the scenario.

> > no way JUSTIFY insults, it only causes them.
> 
> The imputation that the regulars here *insult* people deliberately and
> routinely is itself insulting.

I'd be happy to point it out to you if you'd like it.

> > And it's lotto for the newbie that 
> > come here if it's a good day or a bad day.
> 
> Yes, it is.  It's lotto for everyone.  What has that to do with anything?

It shouldn't be. 

> Your answer is either clueless (you don't understand), or it's dishonest
> (you do understand, but prefer to turn things around).

Niether is true.

> Either is reason enough to end this debate.

Then there is no such reason, allthough I don't think anything productive can 
come from it, regardless of you not having a reason to end it.

> And your lines are *still* too long.

No, they aren't.

> I think it's cluelessness.

Thanks for sharing.

-- 
Sandman[.net]


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

Date: Wed, 24 Mar 2004 16:02:46 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: FIFO problem - yet another .sig rot script...
Message-Id: <rf8360l8opb7npkrklngva9rsce3g6tblm@4ax.com>

On 24 Mar 2004 01:50:04 GMT, Martien Verbruggen
<mgjv@tradingpost.com.au> wrote:

<again what="OT">
>This is a known problem with pine (also ref
           ^^^^^^^^^^^^^
>http://www.caliban.org/files/signature/ChangeLog).

Yes, thanks google I had realized this myself: IIRC I said so in
another post... worse luck, anyway!

>On first quick read, the latest source for pie still have that
>problem. It uses read_file() in os.c to read the signature file, which
>does a fstat, followed by a read of statbuf.st_size bytes. That works
>for regular files, but not for pipes.

It took me quite a while but eventually I realized this myself too,
details in yet another post...

>It's a "bug" in pine that it can't handle named pipes correctly.
>There's not much you can do about it apart from submitting a patch to
>pine's source code, I suppose.

That's something I really can't do, I'll try a feature request
instead: it will cost me really nothing!

</again>


Many thanks,
Michele
-- 
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
  "perl bug File::Basename and Perl's nature"


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

Date: Wed, 24 Mar 2004 08:37:49 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: File traversing
Message-Id: <slrnc6379t.iso.tadmc@magna.augustmail.com>

George Kinley <georgekinley@hotmail.com> wrote:

> I am trying to write some statement to a file, then I want to go back to the
> start of line, how can I do that


   perldoc -f seek

      seek(FILE, -length $just_printed, 2) or die ...   # untested


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


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

Date: 24 Mar 2004 07:32:28 -0800
From: raghuraman@infosys.com (R. Raghuraman)
Subject: Getopts and use strict problem
Message-Id: <a72db9f8.0403240732.5f84af3d@posting.google.com>

Hi,
I'm trying out a test program with getopt::std

GetOptsTest.pl:

use strict;
use diagnostics;
use Getopt::Std;

my %opts;

getopts('abc', \%opts);

if ($opts{"a"} ==1)
  {
    print "option A selected \n";
  }

if ($opts{"b"} == 1)
  {
    print "option B selected \n";
  }

if ($opts{"c"} == 1)
  {
    print "option C selected \n";
  }


when I run this with perl /cygdrive/c/GetOptsTest.pl -ab

I get the following output:
Use of uninitialized value in numeric eq (==) at /cygdrive/c/GetOptsTest.pl
        line 14 (#1)
    (W uninitialized) An undefined value was used as if it were already
    defined.  It was interpreted as a "" or a 0, but maybe it was a mistake.
    To suppress this warning assign a defined value to your variables.

    To help you figure out what was undefined, perl tells you what operation
    you used the undefined value in.  Note, however, that perl optimizes your
    program and the operation displayed in the warning may not necessarily
    appear literally in your program.  For example, "that $foo" is
    usually optimized into "that " . $foo, and the warning will refer to
    the concatenation (.) operator, even though there is no . in your
    program.

option C selected



Is this a problem with Getopt or am I doing something wrong?


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

Date: 24 Mar 2004 16:24:48 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Getopts and use strict problem
Message-Id: <c3scog$id$1@canopus.cc.umanitoba.ca>

In article <a72db9f8.0403240732.5f84af3d@posting.google.com>,
R. Raghuraman <raghuraman@infosys.com> wrote:
:I'm trying out a test program with getopt::std

:getopts('abc', \%opts);

:if ($opts{"a"} ==1)

:I get the following output:
:Use of uninitialized value in numeric eq (==) at /cygdrive/c/GetOptsTest.pl
:        line 14 (#1)

You are comparing the value without checking first to see if it exists.
If the user did not specify the -a option then $opts{"a"} is undef .
-- 
   Warhol's Law: every Usenet user is entitled to his or her very own
   fifteen minutes of flame                  -- The Squoire



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

Date: 24 Mar 2004 18:39:27 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Getopts and use strict problem
Message-Id: <c3skkv$gjl$2@mamenchi.zrz.TU-Berlin.DE>

R. Raghuraman <raghuraman@infosys.com> wrote in comp.lang.perl.misc:

> Hi,
> I'm trying out a test program with getopt::std

Getopt::Std.  Case matters.

> GetOptsTest.pl:
> 
> use strict;
> use diagnostics;
> use Getopt::Std;
> 
> my %opts;
> 
> getopts('abc', \%opts);

You can declare %opts in place

    getopts( 'abc', \ my %opts);

Not that it is necessarily better, but it's shorter.

> if ($opts{"a"} ==1)

Well asking for numeric equality means you need a defined value under
warnings (strict has nothing to do with it).  A boolean value is allowed
to be undefined, so to avoid the warning just write

    if ( $opts{a} )

Note that I have also lost the unnecessary "".  The {} around a hash key
do auto-quoting of sufficiently simple strings.

[snip code for "a" and "b"]

> if ($opts{"c"} == 1)
>   {
>     print "option C selected \n";
>   }
> 
> when I run this with perl /cygdrive/c/GetOptsTest.pl -ab
> 
> I get the following output:
> Use of uninitialized value in numeric eq (==) at /cygdrive/c/GetOptsTest.pl
>         line 14 (#1)

[snip diagnostics output]

> option C selected

You didn't get *that* with "GetOptsTest.pl -ab", did you?

Anno


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

Date: 24 Mar 2004 18:53:42 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: Getopts and use strict problem
Message-Id: <slrnc63m9m.iio.xx087@smeagol.ncf.ca>

R. Raghuraman <raghuraman@infosys.com> wrote:
[...]
>  use Getopt::Std;
>  my %opts;
>  getopts('abc', \%opts);
>  
>  if ($opts{"a"} ==1)
>    {
>      print "option A selected \n";
>    }
[...]
>  Use of uninitialized value in numeric eq (==) at /cygdrive/c/GetOptsTest.pl

As others have said, $opts{a} may not exist, so:

    if (exists $opts{a} and $opts{a}) {
        print "option A selected"
    }

Or, after your call to getopts, you can set default values for
unspecified options:
    
    getopts('abc', \%opts);
    $opts{$_} ||= undef foreach qw(a b c);

    if ($opts{a}) {
        print "option A selected"
    }

-- 
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca


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

Date: 24 Mar 2004 11:24:32 -0500
From: Uri Guttman <uri.guttman@fmr.com>
Subject: Re: Getopts and use strict problem
Message-Id: <siscisguxlfj.fsf@tripoli.fmr.com>

>>>>> "RR" == R Raghuraman <raghuraman@infosys.com> writes:

  RR> my %opts;

  RR> getopts('abc', \%opts);

  RR> if ($opts{"a"} ==1)

if ( $opts{"a"} )

  RR> Use of uninitialized value in numeric eq (==) at /cygdrive/c/GetOptsTest.pl
  RR>         line 14 (#1)

that is a undefined value warning and has nothing to do with
strict. since your options are all boolean, just do a simple boolean
test for them. the == 1 is redundant and the cause of your warning as
you are comparing undef to 1 when the option isn't set.

  RR> Is this a problem with Getopt or am I doing something wrong?

the latter.

uri


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

Date: 24 Mar 2004 22:13:00 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Getopts and use strict problem
Message-Id: <c3t15c$o6c$1@mamenchi.zrz.TU-Berlin.DE>

Glenn Jackman  <xx087@freenet.carleton.ca> wrote in comp.lang.perl.misc:
> R. Raghuraman <raghuraman@infosys.com> wrote:
> [...]
> >  use Getopt::Std;
> >  my %opts;
> >  getopts('abc', \%opts);
> >  
> >  if ($opts{"a"} ==1)
> >    {
> >      print "option A selected \n";
> >    }
> [...]
> >  Use of uninitialized value in numeric eq (==) at /cygdrive/c/GetOptsTest.pl
> 
> As others have said, $opts{a} may not exist, so:
> 
>     if (exists $opts{a} and $opts{a}) {
>         print "option A selected"
>     }

Sorry, but this needs correction.  exists() tests the existence of a hash
*key*.  It emphatically does not guarantee a defined value.  You want
defined() for that.  See "perldoc -f exists" for the full story.

Of course, the test is best written as "if ( $opts{a} )", as has been
noted.

> Or, after your call to getopts, you can set default values for
> unspecified options:
>     
>     getopts('abc', \%opts);
>     $opts{$_} ||= undef foreach qw(a b c);

More simply, "$_ ||= undef for values %opts", but what would it achieve?  
You are replacing more specific boolean false values ("" and 0) with
undef.  The user may be unhappy, and the following test would have run
as well (i.e. without warnings) without it.

>     if ($opts{a}) {
>         print "option A selected"
>     }

Anno


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

Date: 24 Mar 2004 14:46:56 -0500
From: Uri Guttman <uri.guttman@fmr.com>
Subject: Re: Getopts and use strict problem
Message-Id: <siscekrixc27.fsf@tripoli.fmr.com>

>>>>> "GJ" == Glenn Jackman <xx087@freenet.carleton.ca> writes:

  GJ> R. Raghuraman <raghuraman@infosys.com> wrote:
  GJ> [...]
  >> use Getopt::Std;
  >> my %opts;
  >> getopts('abc', \%opts);
  >> 
  >> if ($opts{"a"} ==1)
  >> {
  >> print "option A selected \n";
  >> }
  GJ> [...]
  >> Use of uninitialized value in numeric eq (==) at /cygdrive/c/GetOptsTest.pl

  GJ> As others have said, $opts{a} may not exist, so:

  GJ>     if (exists $opts{a} and $opts{a}) {

overkill. what is wrong with just if ($opts{a}) ?

  GJ> Or, after your call to getopts, you can set default values for
  GJ> unspecified options:
    
  GJ>     getopts('abc', \%opts);
  GJ>     $opts{$_} ||= undef foreach qw(a b c);

that will override a setting of '' or 0 if those come in from the
comamnd line (assuming you enable option values with the right getopts
call). that code is just making all the options exist in the hash which
gains you nothing.

uri


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

Date: 24 Mar 2004 09:57:38 -0700
From: Greg Snow <gls@byu.edu>
Subject: Re: graph smoothing...
Message-Id: <tfjisgu89od.fsf@fisher.byu.edu>

"Bill Parker" <bill@gites.org.uk> writes:

> I'm using GD::Graph quite successfully to produce a (temperature by time)
> graph.
> 
> But it's quite spikey and so I thought I'd overlay it with some sort of
> smoothed graph, so's the trend can (well, may be) displayed. But my
> statistics knowledge is very rusty now:
> 
> So can anyone recommend a method for smoothing out the data into something
> "pretty" but with a sound maths or scientific basis behind it? I'd rather to
> use a perl module if one exists - as I said, I'm so rusty on what to do with
> my data that I'm not sure what to look for in a statistics module of some
> sort.

If you want something more complex than a simple running mean (as has
been suggested already) then I would suggest having your perl program
shell out to an actual statistical package to do the smoothing
(remember Perl was originally designed to glue different packages
together). 

Assuming that you would prefer a free (but high quality) statistics
package, I would suggest looking at R (http://www.r-project.org, click 
on CRAN in the left panel and choose a mirror near you).  The loess
function gives a good smooth, but for temperature over time you may
want to look at the stl function in the ts package.  You can either
have R compute the numbers for you to add to your own graph, or you
can have R create the graph for you and just display it.

If you are interested in more detail, you should probably contact me
directly as this is moving towards being off topic.

-- 
Greg Snow, PhD                
Department of Statistics      
Brigham Young University      
Provo, UT  84602              email:  gls@byu.edu


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

Date: Wed, 24 Mar 2004 08:33:17 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: HashFromString
Message-Id: <slrnc6371d.iso.tadmc@magna.augustmail.com>

Toni <ante.cepic@siemens.com> wrote:

> #config file

> PATHS Path1 "C:\Program Files\Path1\" Path2 "c:\Path2" ...
                                     ^^
                                     ^^
How do you handle double quote characters in paths?

I'll assume that you don't allow double quotes in paths...


> because I have spaces in the paths between "" (e.g. "C:\Program
> Files\Path1\").
> I want in the hash keys (Path1, Path2, ...) and values ("C:\Program
> Files\Path1\", "c:\Path2", ...)
> Does anybody has idea?


Your Question is Asked Frequently.

   perldoc -q split

       How can I split a [character] delimited string except when inside
       [character]? (Comma-separated files)


It is complicated by your use of backwards slashes.

If you change your config file to use sensible slashes,
then it gets really easy:

   use Text::ParseWords;
   $_ = 'PATHS Path1 "C:/Program Files/Path1/" Path2 "c:/Path2"';
   my(undef, %hash) = shellwords( $_ );


With the data exactly as you've presented it (no quotes allowed and
backwards slashes) it can be harder:

   my(undef, %hash) = grep { defined and /\S/ } split /\s*"([^"]+)"\s*|\s+/;


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


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

Date: Wed, 24 Mar 2004 07:20:48 -0700
From: "Wendy S" <wendywds@hotmail.com>
Subject: Re: Help with NET::Inet
Message-Id: <c3s5gn$6q6$1@news.asu.edu>

"J. Gleixner" <glex_nospam@qwest.invalid> wrote
> Based on that URL, and by looking at:
> http://aspn.activestate.com/ASPN/Modules/dist_html?dist_id=9351
> You'd need use ppm and:
> install Net-ext

I tried that and got an error:
ppm> install Net-ext
Error: PPD for 'Net-ext.ppd' could not be found.
ppm>

The link above does not list Windows as an available platform, so I assume
that's why. :(

-- 
Wendy in Chandler, AZ




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

Date: Wed, 24 Mar 2004 14:50:05 GMT
From: "Jon Oringer" <newsserv@advercast.com>
Subject: how to remove hash from a GLOB??
Message-Id: <xeh8c.5093$1C1.2813181@twister.nyc.rr.com>

I'm using MasonX::Request::WithApacheSession to store session information on
a user. I would then like to save this information to file - so that if the
user comes back after their cookie expires, they can simply login - and I
get the hash off of the disk, and put it back in $m->{session}

So -- I'm having problems in that Storable cannot store the GLOB type

my $serialized = Storable::freeze $m->{session}

I get the error:

Can't store GLOB items at blib/lib/Storable.pm (autosplit into
blib/lib/auto/Storable/_freeze.al) line 283

How do you guys deal with storing the session hash to disk between logins?
Is there another way I'm overlooking?

Thanks!

Jon





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

Date: 24 Mar 2004 15:20:44 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: how to remove hash from a GLOB??
Message-Id: <c3s90c$9r9$1@mamenchi.zrz.TU-Berlin.DE>

Jon Oringer <newsserv@advercast.com> wrote in comp.lang.perl.misc:
> I'm using MasonX::Request::WithApacheSession to store session information on
> a user. I would then like to save this information to file - so that if the
> user comes back after their cookie expires, they can simply login - and I
> get the hash off of the disk, and put it back in $m->{session}
> 
> So -- I'm having problems in that Storable cannot store the GLOB type
> 
> my $serialized = Storable::freeze $m->{session}
> 
> I get the error:
> 
> Can't store GLOB items at blib/lib/Storable.pm (autosplit into
> blib/lib/auto/Storable/_freeze.al) line 283

GLOB refs are usually filehandles.  It doesn't make sense to restore
these from a disk file, you must open the file again in the current
run.

Anno


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

Date: Wed, 24 Mar 2004 20:54:32 GMT
From: "Jon Oringer" <newsserv@advercast.com>
Subject: Re: how to remove hash from a GLOB??
Message-Id: <cAm8c.5141$1C1.2898572@twister.nyc.rr.com>


"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:c3s90c$9r9$1@mamenchi.zrz.TU-Berlin.DE...
> Jon Oringer <newsserv@advercast.com> wrote in comp.lang.perl.misc:
> > I'm using MasonX::Request::WithApacheSession to store session
information on
> > a user. I would then like to save this information to file - so that if
the
> > user comes back after their cookie expires, they can simply login - and
I
> > get the hash off of the disk, and put it back in $m->{session}
> >
> > So -- I'm having problems in that Storable cannot store the GLOB type
> >
> > my $serialized = Storable::freeze $m->{session}
> >
> > I get the error:
> >
> > Can't store GLOB items at blib/lib/Storable.pm (autosplit into
> > blib/lib/auto/Storable/_freeze.al) line 283
>
> GLOB refs are usually filehandles.  It doesn't make sense to restore
> these from a disk file, you must open the file again in the current
> run.
>
> Anno



hash information is stored in $m->{session} and it will be there until the
cookie expires.
I need to save it to disk incase the cookie does expire.
if its on disk temporarily - this doens't help me.
i need to store it permanantly in my own file.
Jon




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

Date: 24 Mar 2004 22:26:21 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: how to remove hash from a GLOB??
Message-Id: <c3t1ud$o6c$2@mamenchi.zrz.TU-Berlin.DE>

Jon Oringer <newsserv@advercast.com> wrote in comp.lang.perl.misc:
> 
> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> news:c3s90c$9r9$1@mamenchi.zrz.TU-Berlin.DE...
> > Jon Oringer <newsserv@advercast.com> wrote in comp.lang.perl.misc:
> > > I'm using MasonX::Request::WithApacheSession to store session
> information on
> > > a user. I would then like to save this information to file - so that if
> the
> > > user comes back after their cookie expires, they can simply login - and
> I
> > > get the hash off of the disk, and put it back in $m->{session}
> > >
> > > So -- I'm having problems in that Storable cannot store the GLOB type
> > >
> > > my $serialized = Storable::freeze $m->{session}
> > >
> > > I get the error:
> > >
> > > Can't store GLOB items at blib/lib/Storable.pm (autosplit into
> > > blib/lib/auto/Storable/_freeze.al) line 283
> >
> > GLOB refs are usually filehandles.  It doesn't make sense to restore
> > these from a disk file, you must open the file again in the current
> > run.
> >
> > Anno
> 
> hash information is stored in $m->{session} and it will be there until the
> cookie expires.
> I need to save it to disk incase the cookie does expire.
> if its on disk temporarily - this doens't help me.
> i need to store it permanantly in my own file.

Well, you can't, not blindly with Storable, if the structure contains
globrefs (or coderefs, afaik).  That's all I was saying, I wasn't
offering a solution.

In fact, I don't quite understand the issue.  A cookie *is* a disk
file, used to keep session information.  Why don't you simply increase
the cookie timeout?  Or are you trying to circumvent someone else's
timeout?  I have no idea how that is handled, but I'd expect it to be
more involved than your approach.

Anno


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

Date: Wed, 24 Mar 2004 16:18:39 +0000
From: zzapper <david@tvis.co.uk>
Subject: Re: Perl web Link Checker
Message-Id: <l4d360591apk6kn1je4m952pcoo6s08gab@4ax.com>

On Wed, 24 Mar 2004 08:10:27 +1100, wrote:

>On Tue, 23 Mar 2004 14:34:49 +0000, zzapper wrote:
>
>> Hi,
>> 
>> I've tried using http://www.linklint.org but this hasn't been updated
>> since 2001? It doesn't cope with JavaScript links (AFAIK). Is there any
>> other project?
>> 
>> 
>> zzapper (vim, cygwin, wiki & zsh)
>
>
>
>Try CPAN and look for checkbot.

Thanx Owen that's exactly what I was looking for!!

Am using latest version 1.74

zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s.^.CyrnfrTfcbafbeROenzSZbbyranne.|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips


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

Date: Wed, 24 Mar 2004 16:41:57 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: Removing folders recursively
Message-Id: <Xns94B677022886Adkwwashere@216.168.3.30>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:

> Shabam <info@pcconnect.net> wrote in comp.lang.perl.misc:
>> I'm currently using the following function to delete entire directories
>> including all content in it.
[snip]
> 
> There are modules that deal with this.  Get File::Remove from CPAN.

Is it just me, or is the way the remove() function in File::Remove is called 
a bit contrived?  I'm referring to the first argument: if it's a reference to 
a scalar, and that scalar value is true, then the remove is recursive.  After 
looking at the code I see WHY this was done, but I still don't particularly 
like it.  I'd rather call it like this:

    remove(recurse=>1, files=>\@list);

This would be easy to change, and IMHO would be a little easier to use. More 
to type, but easier to read. What do you think?

-- 
David Wall


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

Date: 24 Mar 2004 18:14:57 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Removing folders recursively
Message-Id: <c3sj71$gjl$1@mamenchi.zrz.TU-Berlin.DE>

David K. Wall <dwall@fastmail.fm> wrote in comp.lang.perl.misc:
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> 
> > Shabam <info@pcconnect.net> wrote in comp.lang.perl.misc:
> >> I'm currently using the following function to delete entire directories
> >> including all content in it.
> [snip]
> > 
> > There are modules that deal with this.  Get File::Remove from CPAN.
> 
> Is it just me, or is the way the remove() function in File::Remove is called 
> a bit contrived?  I'm referring to the first argument: if it's a reference to 
> a scalar, and that scalar value is true, then the remove is recursive.  After 
> looking at the code I see WHY this was done, but I still don't particularly 
> like it.  I'd rather call it like this:
> 
>     remove(recurse=>1, files=>\@list);
> 
> This would be easy to change, and IMHO would be a little easier to use. More 
> to type, but easier to read. What do you think?

Better, yes, easy to change too, but awkward to make compatible. (You'd
end up with a function whose behavior depends on the presence of an
arrayref among its first four parameters -- a bit eerie.)

If something must be done, I'd additionally permit a hashref for the
optional first parameter, allowing the format

    remove( { recurse => 1 }, file1, ...)

Other options (verbose, dry run, logging, ahhh, featuritis) could also
be passed that way.

It is my impression that a CPAN module has about the same obligation to
remain compatible through changes that Perl itself has followed in its
development.  So incompatible changes just because you have had second
thoughts are out.  (Of course, nothing is enforced on CPAN, authors are
free to do otherwise.)

Anno


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V10 Issue 6298
***************************************


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