user3369592 user3369592 - 5 months ago 85
Perl Question

perl redirect url with the paramter using $Std->url()

I am new to Perl/Mason.
My url is

https://www.myurl.com/myPar/2016image
which will return a png image.
In this url,
myPar
is the parameter. ( equals to $orderViewHelper->{orderId} ).
I have created an
orderViewHelper
which will hold
myImage
object so I can access it in other classes.
Is there a way that I can use
$Std->url()
to get the image and put it into myImage?

$orderViewHelper->{myImage} = $Std->url('https://www.myurl.com/$orderViewHelper->{orderId}/2016image',
{ absolute =>1
});

Answer

I think this will work:

$orderViewHelper->{myImage} = $Std->url("https://www.myurl.com/$orderViewHelper->{orderId}/2016image", { absolute =>1 });