"Sean M. Burke" <[EMAIL PROTECTED]> writes:
> At 11:37 AM 2003-03-12 -0500, [some guy] wrote:
> >Sorry to bug you, but I have a quick question I cant find the answer to.
> >
> > When using URI::URL (or normal URI) and breaking down a url to grab
> > $url->path_segments(); is the first one that is returned always
> > blank or is it just me? and if this is correct, why is it always
> > blank? I find myself having to grab $blah[1] to get the first actual
> > segment.
>
> I've been wondering about this for ages. But just now I thought of
> the answer (or at least an answer): relative URL objects! They don't
> have to start with a slash, so their $blah[0] might have something in
> it.
I guess this should go in the URI manpage as well. It does not even
mention that $blah[0] is empty for absolute URIs.
Regards,
Gisle
>
> See:
>
> % perl -d -e 1
> Loading DB routines from perl5db.pl version 1.19
> Editor support available.
>
> Enter h or `h h' for help, or `perldoc perldebug' for more help.
>
> main::(-e:1): -1
> DB<1> use URI
>
> DB<2> $x = URI->new('stuff/things')
>
> DB<3> x $x->canonical->as_string
> 0 'stuff/things'
> DB<4> x $x->path_segments
> 0 'stuff'
> 1 'things'